ramp-workflow icon indicating copy to clipboard operation
ramp-workflow copied to clipboard

FIX use balanced accuracy from scikit-learn

Open glemaitre opened this issue 6 years ago • 8 comments

closes #127

glemaitre avatar Apr 19 '18 15:04 glemaitre

In scikit-learn, they consider this score meaningful only in binary classification. So it will not work for multiclass.

glemaitre avatar Apr 19 '18 15:04 glemaitre

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)

glemaitre avatar Apr 19 '18 15:04 glemaitre

And the discussion to make it multiclass is there: https://github.com/scikit-learn/scikit-learn/pull/10587

glemaitre avatar Apr 19 '18 15:04 glemaitre

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.

kegl avatar Apr 19 '18 15:04 kegl

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.

glemaitre avatar Apr 19 '18 15:04 glemaitre

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.

glemaitre avatar Apr 19 '18 15:04 glemaitre

ok

kegl avatar Apr 19 '18 16:04 kegl

Codecov Report

Merging #128 into master will decrease coverage by 0.03%. The diff coverage is 90.47%.

Impacted file tree graph

@@            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.

codecov[bot] avatar May 09 '18 09:05 codecov[bot]