ramp-workflow
ramp-workflow copied to clipboard
FIX use balanced accuracy from scikit-learn
closes #127
In scikit-learn, they consider this score meaningful only in binary classification. So it will not work for multiclass.
In fact, this the reason it is failing on iris (more over iris is fully balanced so not sure it is meaninful to use it there)
And the discussion to make it multiclass is there: https://github.com/scikit-learn/scikit-learn/pull/10587
I don't want to get into these debates now, just make sure it is backward compatible. It would probably be better to create a new score, like balanced_accuracy_sk
or something like that.
I checked. It is back compatible for multi-class apparently and does not give bad results for the binary case. But I would need a bit more time to check.
Basically the only thing is to expose the adjusted
parameter. True
will fall back to the previous implementation while False
will not adjust for chance.
ok
Codecov Report
Merging #128 into master will decrease coverage by
0.03%
. The diff coverage is90.47%
.
@@ Coverage Diff @@
## master #128 +/- ##
==========================================
- Coverage 93.82% 93.78% -0.04%
==========================================
Files 101 101
Lines 3092 3107 +15
==========================================
+ Hits 2901 2914 +13
- Misses 191 193 +2
Impacted Files | Coverage Δ | |
---|---|---|
rampwf/score_types/balanced_accuracy.py | 93.33% <90.47%> (-6.67%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 6814600...74887fb. Read the comment docs.