Created
January 21, 2016 08:41
-
-
Save sudipto80/8fc75f804e04d80b15c7 to your computer and use it in GitHub Desktop.
Mean Squarred Errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Mean Absolute Error | |
let mae (ratings:float list)(predictions:float list) = | |
(List.zip ratings predictions |> List.sumBy (fun t -> abs (fst t - snd t))) | |
/float ratings.Length | |
//Normalized Mean Absolute Error | |
let nmae (ratings:float list)(predictions:float list) = | |
let rMax = ratings |> List.max | |
let rMin = ratings |> List.min | |
(mae ratings predictions )/(rMax - rMin) | |
//Root mean squared error | |
let rmse(ratings:float list)(predictions:float list) = | |
sqrt( ( List.zip ratings predictions | |
|> List.map (fun t -> fst t - snd t) | |
|> List.sum ) | |
/(float predictions.Length )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment