Fix SMAPE on zero values
This commit is contained in:
parent
af21031172
commit
872724722a
@ -1,5 +1,5 @@
|
|||||||
name: geval
|
name: geval
|
||||||
version: 1.15.0.0
|
version: 1.15.0.1
|
||||||
synopsis: Machine learning evaluation tools
|
synopsis: Machine learning evaluation tools
|
||||||
description: Please see README.md
|
description: Please see README.md
|
||||||
homepage: http://github.com/name/project
|
homepage: http://github.com/name/project
|
||||||
|
@ -559,7 +559,7 @@ gevalCore' MAE _ = gevalCoreWithoutInput outParser outParser itemAbsoluteError a
|
|||||||
|
|
||||||
gevalCore' SMAPE _ = gevalCoreWithoutInput outParser outParser smape averageC (* 100.0)
|
gevalCore' SMAPE _ = gevalCoreWithoutInput outParser outParser smape averageC (* 100.0)
|
||||||
where outParser = getValue . TR.double
|
where outParser = getValue . TR.double
|
||||||
smape (exp, out) = (abs (exp-out)) / ((abs exp) + (abs out))
|
smape (exp, out) = (abs (exp-out)) `safeDoubleDiv` ((abs exp) + (abs out))
|
||||||
|
|
||||||
gevalCore' Pearson _ = gevalCoreByCorrelationMeasure pearson
|
gevalCore' Pearson _ = gevalCoreByCorrelationMeasure pearson
|
||||||
gevalCore' Spearman _ = gevalCoreByCorrelationMeasure spearman
|
gevalCore' Spearman _ = gevalCoreByCorrelationMeasure spearman
|
||||||
|
@ -86,7 +86,7 @@ main = hspec $ do
|
|||||||
runGEvalTest "mae-simple" `shouldReturnAlmost` 1.5
|
runGEvalTest "mae-simple" `shouldReturnAlmost` 1.5
|
||||||
describe "SMAPE" $ do
|
describe "SMAPE" $ do
|
||||||
it "simple test" $
|
it "simple test" $
|
||||||
runGEvalTest "smape-simple" `shouldReturnAlmost` 54.2222222222222222
|
runGEvalTest "smape-simple" `shouldReturnAlmost` 45.1851851851852
|
||||||
describe "Spearman's rank correlation coefficient" $ do
|
describe "Spearman's rank correlation coefficient" $ do
|
||||||
it "simple test" $ do
|
it "simple test" $ do
|
||||||
runGEvalTest "spearman-simple" `shouldReturnAlmost` (- 0.5735)
|
runGEvalTest "spearman-simple" `shouldReturnAlmost` (- 0.5735)
|
||||||
|
@ -3,3 +3,4 @@
|
|||||||
-2.5
|
-2.5
|
||||||
3
|
3
|
||||||
0.3
|
0.3
|
||||||
|
0.0
|
||||||
|
|
@ -3,3 +3,4 @@
|
|||||||
0.0
|
0.0
|
||||||
3
|
3
|
||||||
1.2
|
1.2
|
||||||
|
0.0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user