scikit-learn-contrib / imbalanced-learn

A Python Package to Tackle the Curse of Imbalanced Datasets in Machine Learning
https://imbalanced-learn.org
MIT License
6.85k stars 1.29k forks source link

FIX make sure to accept "minority" as a valid strategy in over-samplers #964

Closed Prakhyath07 closed 1 year ago

Prakhyath07 commented 1 year ago

Reference Issue

What does this implement/fix? Explain your changes.

while using smapling strategy ="minority" we were getting error. i found issue in base.py of oversampler where in _parameter constraint majority was used in stroptions instead of minority

Any other comments?

codecov[bot] commented 1 year ago

Codecov Report

Base: 96.50% // Head: 94.25% // Decreases project coverage by -2.24% :warning:

Coverage data is based on head (14c4a8b) compared to base (7cead9c). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #964 +/- ## ========================================== - Coverage 96.50% 94.25% -2.25% ========================================== Files 103 103 Lines 7264 7280 +16 Branches 1068 1071 +3 ========================================== - Hits 7010 6862 -148 - Misses 147 312 +165 + Partials 107 106 -1 ``` | [Impacted Files](https://codecov.io/gh/scikit-learn-contrib/imbalanced-learn/pull/964?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib) | Coverage Δ | | |---|---|---| | [imblearn/over\_sampling/base.py](https://codecov.io/gh/scikit-learn-contrib/imbalanced-learn/pull/964/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib#diff-aW1ibGVhcm4vb3Zlcl9zYW1wbGluZy9iYXNlLnB5) | `100.00% <ø> (ø)` | | | [...rn/over\_sampling/tests/test\_random\_over\_sampler.py](https://codecov.io/gh/scikit-learn-contrib/imbalanced-learn/pull/964/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib#diff-aW1ibGVhcm4vb3Zlcl9zYW1wbGluZy90ZXN0cy90ZXN0X3JhbmRvbV9vdmVyX3NhbXBsZXIucHk=) | `100.00% <100.00%> (ø)` | | | [...otype\_selection/tests/test\_random\_under\_sampler.py](https://codecov.io/gh/scikit-learn-contrib/imbalanced-learn/pull/964/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib#diff-aW1ibGVhcm4vdW5kZXJfc2FtcGxpbmcvX3Byb3RvdHlwZV9zZWxlY3Rpb24vdGVzdHMvdGVzdF9yYW5kb21fdW5kZXJfc2FtcGxlci5weQ==) | `100.00% <100.00%> (ø)` | | | [...ing/\_prototype\_selection/tests/test\_tomek\_links.py](https://codecov.io/gh/scikit-learn-contrib/imbalanced-learn/pull/964/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib#diff-aW1ibGVhcm4vdW5kZXJfc2FtcGxpbmcvX3Byb3RvdHlwZV9zZWxlY3Rpb24vdGVzdHMvdGVzdF90b21la19saW5rcy5weQ==) | `100.00% <100.00%> (ø)` | | | [imblearn/keras/tests/test\_generator.py](https://codecov.io/gh/scikit-learn-contrib/imbalanced-learn/pull/964/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib#diff-aW1ibGVhcm4va2VyYXMvdGVzdHMvdGVzdF9nZW5lcmF0b3IucHk=) | `9.37% <0.00%> (-90.63%)` | :arrow_down: | | [imblearn/tensorflow/\_generator.py](https://codecov.io/gh/scikit-learn-contrib/imbalanced-learn/pull/964/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib#diff-aW1ibGVhcm4vdGVuc29yZmxvdy9fZ2VuZXJhdG9yLnB5) | `27.58% <0.00%> (-68.97%)` | :arrow_down: | | [imblearn/tensorflow/tests/test\_generator.py](https://codecov.io/gh/scikit-learn-contrib/imbalanced-learn/pull/964/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib#diff-aW1ibGVhcm4vdGVuc29yZmxvdy90ZXN0cy90ZXN0X2dlbmVyYXRvci5weQ==) | `10.75% <0.00%> (-54.84%)` | :arrow_down: | | [imblearn/keras/\_generator.py](https://codecov.io/gh/scikit-learn-contrib/imbalanced-learn/pull/964/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib#diff-aW1ibGVhcm4va2VyYXMvX2dlbmVyYXRvci5weQ==) | `45.20% <0.00%> (-46.58%)` | :arrow_down: | | [imblearn/tests/test\_docstring\_parameters.py](https://codecov.io/gh/scikit-learn-contrib/imbalanced-learn/pull/964/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib#diff-aW1ibGVhcm4vdGVzdHMvdGVzdF9kb2NzdHJpbmdfcGFyYW1ldGVycy5weQ==) | `87.32% <0.00%> (-0.71%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-learn-contrib)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

glemaitre commented 1 year ago

I added some non-regression tests and an entry in the changelog. I will probably try to make a release soon because it is a blocker.

glemaitre commented 1 year ago

Thanks @Prakhyath07 I will fix the CI builds that are failing. There are not related.

Prakhyath07 commented 1 year ago

Reference Issue

What does this implement/fix? Explain your changes.

while using smapling strategy ="minority" we were getting error. i found issue in base.py of oversampler where in _parameter constraint majority was used in stroptions instead of minority

Any other comments?

From my side i didn't find any other issue Thank you so much

dront78 commented 1 year ago

where is 0.10.1?

glemaitre commented 1 year ago

On PyPI and conda-forge, e.g. https://pypi.org/project/imbalanced-learn/