Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Fix SmoteNC zero variance resampling #905

Conversation

freddyaboulton
Copy link

Reference Issue

Fixes #837

What does this implement/fix? Explain your changes.

Fixes the issue as described by @glemaitre here: #837 (comment)

Any other comments?

Had to add ytype to base class generate_samples api in order to know which class we're resampling so we can use the right subset of _X_categorical_minority_encoded

@codecov
Copy link

codecov bot commented Jun 1, 2022

Codecov Report

Merging #905 (ca2935a) into master (6176807) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #905      +/-   ##
==========================================
+ Coverage   97.19%   97.23%   +0.03%     
==========================================
  Files          97       97              
  Lines        6348     6361      +13     
  Branches      711      712       +1     
==========================================
+ Hits         6170     6185      +15     
+ Misses        106      105       -1     
+ Partials       72       71       -1     
Impacted Files Coverage Δ
imblearn/over_sampling/_smote/base.py 99.02% <100.00%> (+0.01%) ⬆️
imblearn/over_sampling/tests/test_common.py 100.00% <100.00%> (ø)
imblearn/keras/_generator.py 94.73% <0.00%> (+2.63%) ⬆️

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 6176807...ca2935a. Read the comment docs.

@freddyaboulton freddyaboulton marked this pull request as ready for review June 1, 2022 23:53
@freddyaboulton freddyaboulton changed the title Fix SmoteNC zero variance resampling [MRG] Fix SmoteNC zero variance resampling Jun 9, 2022
@glemaitre
Copy link
Member

Thanks. Since I remade the implementation of SMOTE to compute the median on each subclass, I added your bug fix (or something similar). Thanks @freddyaboulton

Closing this PR.

@glemaitre glemaitre closed this Jul 10, 2023
@freddyaboulton
Copy link
Author

Thanks @glemaitre !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants