mae_score Function

public pure function mae_score(predicted, expected) result(output)

Compute the mean absolute error of a model

This function is only valid for continuous datasets

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in), dimension(:,:) :: predicted

Predicted and expected values

real(kind=real32), intent(in), dimension(:,:) :: expected

Predicted and expected values

Return Value real(kind=real32), dimension(size(expected,2))

Mean absolute error


Source Code

  pure function mae_score(predicted, expected) result(output)
    !! Compute the mean absolute error of a model
    !!
    !! This function is only valid for continuous datasets
    implicit none

    ! Arguments
    real(real32), dimension(:,:), intent(in) :: predicted, expected
    !! Predicted and expected values
    real(real32), dimension(size(expected,2)) :: output
    !! Mean absolute error

    ! Compute the accuracy
    output = 1._real32 - sum(abs(expected - predicted),dim=1)/size(expected,1)

  end function mae_score