Skip to content

Conversation

osanai-hisashi
Copy link
Contributor

Reference Issue

What does this implement/fix? Explain your changes.

With current implementation idx_under is concatenated with idx_under,
idx_maj_sample and idx_tmp. And idx_maj_sample is created with
indices of majority class so wrong indices will be created.
This patch fixes the way of creating idx_under.

Any other comments?

@coveralls
Copy link

coveralls commented Jan 17, 2017

Coverage Status

Coverage remained the same at 98.907% when pulling 39c3424 on osanai-hisashi:master into 9503eca on scikit-learn-contrib:master.

# If we need to offer support for the indices
if self.return_indices:
idx_under = np.flatnonzero(y == self.min_c_)
idx_maj = np.flatnonzero(y == self.maj_c_)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will make the algorithm failed in the case of multiclass.
idx_maj needs to be defined for each class in the for loop.

Subsequently, the rest of the algorithm needs to take it into account.

@glemaitre
Copy link
Member

@osanai-hisashi We want to keep the OSS to tackle the multiclass problem.
Therefore, there is a need to define idx_maj as the index of all the class apart of the minority.

So the solution still need some work to be compliant, but there is a bug in the index as you mentioned.

With current implementation idx_under is concatenated with idx_under,
idx_maj_sample and idx_tmp. And idx_maj_sample is created with
indices of majority class so wrong indices will be created.
This patch fixes the way of creating idx_under.
@coveralls
Copy link

coveralls commented Jan 17, 2017

Coverage Status

Coverage remained the same at 98.907% when pulling 7e26011 on osanai-hisashi:master into 9503eca on scikit-learn-contrib:master.

@osanai-hisashi
Copy link
Contributor Author

thanks for the review. I will move L185 into the for loop with a condition change (y == key).

@glemaitre
Copy link
Member

LGTM @chkoar can you make the MRG+1 just to be sure

@glemaitre glemaitre changed the title [MRG] idx_under should be expressed by indices of parameter X [MRG+1] idx_under should be expressed by indices of parameter X Jan 17, 2017
@glemaitre glemaitre requested a review from chkoar January 17, 2017 11:30
@glemaitre glemaitre merged commit 453c69c into scikit-learn-contrib:master Jan 20, 2017
christophe-rannou pushed a commit to christophe-rannou/imbalanced-learn that referenced this pull request Apr 3, 2017
…-contrib#220)

With current implementation idx_under is concatenated with idx_under,
idx_maj_sample and idx_tmp. And idx_maj_sample is created with
indices of majority class so wrong indices will be created.
This patch fixes the way of creating idx_under.
glemaitre pushed a commit to glemaitre/imbalanced-learn that referenced this pull request Jun 15, 2017
…-contrib#220)

With current implementation idx_under is concatenated with idx_under,
idx_maj_sample and idx_tmp. And idx_maj_sample is created with
indices of majority class so wrong indices will be created.
This patch fixes the way of creating idx_under.
glemaitre pushed a commit to glemaitre/imbalanced-learn that referenced this pull request Jun 15, 2017
…-contrib#220)

With current implementation idx_under is concatenated with idx_under,
idx_maj_sample and idx_tmp. And idx_maj_sample is created with
indices of majority class so wrong indices will be created.
This patch fixes the way of creating idx_under.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants