Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WIP] ENH: Resample additional arrays apart from X and y#463

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
glemaitre wants to merge16 commits intoscikit-learn-contrib:master
base:master
Choose a base branch
Loading
fromglemaitre:is/sample_weight_sampling

Conversation

glemaitre
Copy link
Member

@glemaitreglemaitre commentedAug 27, 2018
edited
Loading

Implement the last point of#462 and should be merged after it.
Partially addressing#460

@glemaitreglemaitre changed the title EHN: resample additional arrays apart from X and y[WIP] EHN: resample additional arrays apart from X and yAug 27, 2018
@pep8speaks
Copy link

pep8speaks commentedAug 27, 2018
edited
Loading

Hello@glemaitre! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on August 29, 2018 at 09:59 Hours UTC

@glemaitre
Copy link
MemberAuthor

Sampling extra arrays could be easy in the case of prototype selection.
One can just peak the weight of the selected samples.

However, what would be a good and meaningful default when new sample weight need to be created.

Right now, I created an*arrays sequence but we might interested to only limit tosample_weight since the creation of new instances would make sense only if we know what are we creating. Up-sampling in arrays that we don't know anything about it could be weird.

@glemaitre
Copy link
MemberAuthor

Ups I forgot to ping@jnothman in my last comment

@codecov
Copy link

codecovbot commentedAug 29, 2018
edited
Loading

Codecov Report

Merging#463 intomaster willdecrease coverage by0.35%.
The diff coverage is94.97%.

Impacted file tree graph

@@            Coverage Diff             @@##           master     #463      +/-   ##==========================================- Coverage   98.92%   98.57%   -0.36%==========================================  Files          85       75      -10       Lines        5324     4633     -691     ==========================================- Hits         5267     4567     -700- Misses         57       66       +9
Impacted FilesCoverage Δ
imblearn/pipeline.py97.07% <ø> (+2.1%)⬆️
imblearn/utils/estimator_checks.py96.62% <100%> (-0.46%)⬇️
imblearn/ensemble/_balance_cascade.py100% <100%> (ø)⬆️
...ling/_prototype_selection/_random_under_sampler.py100% <100%> (ø)⬆️
...nder_sampling/_prototype_selection/_tomek_links.py100% <100%> (ø)⬆️
...rototype_selection/_condensed_nearest_neighbour.py100% <100%> (ø)⬆️
imblearn/over_sampling/_random_over_sampler.py100% <100%> (ø)⬆️
imblearn/combine/_smote_tomek.py100% <100%> (ø)⬆️
...rototype_selection/_neighbourhood_cleaning_rule.py100% <100%> (ø)⬆️
imblearn/combine/_smote_enn.py100% <100%> (ø)⬆️
... and73 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updateffdde80...7a8fad0. Read thecomment docs.

Copy link
Member

@jnothmanjnothman left a comment

Choose a reason for hiding this comment

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

Btw, I don't think returning non-X,y will work with the current handling ofPipeline.fit's kwargs. We really need sample prop routing to handle that case. Currently, the handling would be unambiguous if one of:

  • the resampler is the last step, in which case we return any additional sample props like weights
  • the resampler is the second-last step, and there is no fit_param calledlast_step_name__sample_weight, in which case we pass all sample props into the last step'sfit, I think.

Otherwise, it's unclear where to pass the returnedsample_weight given that**fit_params intends to prescribe this at the timePipeline.fit is called.

The corresponding label of `X_resampled`.

sample_weight_resampled : ndarray, shape (n_samples_new,)
Copy link
Member

Choose a reason for hiding this comment

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

I would rather have a dict of non-X,y returned. (Optionally? In scikit-learn I would rather this be mandatory so we don't need to handle both cases.)

``sample_weight`` was not ``None``.

idx_resampled : ndarray, shape (n_samples_new,)
Indices of the selected features. This output is optional and only
Copy link
Member

Choose a reason for hiding this comment

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

Do you mean the selectedsamples?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

yes

Resampled sample weights. This output is returned only if
``sample_weight`` was not ``None``.

idx_resampled : ndarray, shape (n_samples_new,)
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain why this should be returned fromfit_resample, rather than stored as an attribute?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I think that it was some original design (before it was in scikit-learn). But actually it would be better to keep it as an attribute with the singlefit_resample.

@glemaitre
Copy link
MemberAuthor

Otherwise, it's unclear where to pass the returned sample_weight given that **fit_params intends to prescribe this at the time Pipeline.fit is called.

If I understand well and from what I could see, Pipeline does not supportsample_weight right now. But in the meanwhile, do you recommend to add afit_resample(X, y, **sample_props) signature and return a dictsample_props.

@jnothman
Copy link
Member

You're rightPipeline does not really supportsample_weight now... I think supporting returning it fromPipeline.fit_resample makes sense.

@glemaitreglemaitreforce-pushed themaster branch 2 times, most recently frombbf2b12 to513203cCompareSeptember 7, 2018 13:26
@chkoarchkoar changed the title[WIP] EHN: resample additional arrays apart from X and y[WIP] ENH: Resample additional arrays apart from X and yJun 12, 2019
@glemaitreglemaitreforce-pushed themaster branch 2 times, most recently fromf1bc189 to8f87307CompareJune 28, 2019 12:32
@chkoar
Copy link
Member

@glemaitre#460 is closed but#457 is still open and probably relevant. Could we close this PR in favor of new one in the future? It is two years old.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jnothmanjnothmanjnothman left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@glemaitre@pep8speaks@jnothman@chkoar

[8]ページ先頭

©2009-2025 Movatter.jp