Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MRG] Standardize sample weights validation in BaseDecisionTree #15495

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

Merged
merged 2 commits into from
Nov 4, 2019

Conversation

fbchow
Copy link
Contributor

@fbchow fbchow commented Nov 2, 2019

Reference Issues/PRs

Fixes #15358 for BaseDecisionTree

What does this implement/fix? Explain your changes.

Replaces custom validation logic with standardized method utils.validation._check_sample_weight (relatively newly introduced).

Any other comments?

Two things to check:

  1. the new validation method only accepts float32 and float64, but the class is using ._tree.DOUBLE which we think is the same
  2. In the case of an empty array, we now get a TypeError instead of a ValueError due to shared implementation.

We think these are both ok changes.

Copy link
Member

@TomDLT TomDLT left a comment

Choose a reason for hiding this comment

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

LGTM, thanks !
let's just wait for a second pair of eyes

@adrinjalali adrinjalali merged commit bcb8eda into scikit-learn:master Nov 4, 2019
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.

Use _check_sample_weight to consistently validate sample_weight
5 participants