Skip to content

fix: metrics average over compared pairs and throw on empty input - #226

Open
skymanbp wants to merge 1 commit into
DataHaskell:mainfrom
skymanbp:fix/metrics
Open

fix: metrics average over compared pairs and throw on empty input#226
skymanbp wants to merge 1 commit into
DataHaskell:mainfrom
skymanbp:fix/metrics

Conversation

@skymanbp

Copy link
Copy Markdown
Contributor

Split out of #214.

mse/mae/r2/accuracy/logLoss divided by length truth while zipWith truncated to the shorter vector, and scored zero predictions as perfect. They now average over compared pairs and throw on none. The internal meanSquaredError divided by the longer length and indexed out of bounds when predictions ran longer; it now returns Nothing on mismatched or empty input.

Before:

ghci> mse VU.empty (VU.fromList [5,5,5])
0.0
ghci> mse (VU.fromList [2,2]) (VU.fromList [0,0,0,0])
2.0

After:

ghci> mse VU.empty (VU.fromList [5,5,5])
*** Exception: [ERROR] mse cannot be called on empty data sets
ghci> mse (VU.fromList [2,2]) (VU.fromList [0,0,0,0])
4.0

sklearn raises ValueError on both empty input and length mismatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant