10000 Tree MAE fix to ensure sample_weights are used during impurity calculation. by JohnStott · Pull Request #11461 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

Tree MAE fix to ensure sample_weights are used during impurity calculation. #11461

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

Closed
wants to merge 1 commit into from

Conversation

JohnStott
Copy link
Contributor
@JohnStott JohnStott commented Jul 9, 2018

In the proposed fix, you will see I have multiplied by the sample weight after applying the absolute to the difference (not before). This is in line with the consensus / discussion found here, where negative sample weights are considered: #3774 (and also because during initialisation, self.weighted_n_node_samples is a summation of the sample weights with no "absolute" applied (this is used in the impurity division calc)).

Reference Issues/PRs

Fixes: #11460 (Tree MAE is not considering sample_weights when calculating impurity!)

What does this implement/fix? Explain your changes.

Any other comments?

Tree MAE is not considering sample_weights when calculating impurity!

In the proposed fix, you will see I have multiplied by the sample weight *after* applying the absolute to the difference (not before).  This is in line with the consensus / discussion found here, where negative sample weights are considered: scikit-learn#3774 (and also because during initialisation, self.weighted_n_node_samples is a summation of the sample weights with no "absolute" applied (this is used in the impurity divisor)).
@JohnStott JohnStott closed this Jul 9, 2018
@JohnStott JohnStott deleted the JohnStott-patch-1 branch July 9, 2018 13:54
@JohnStott
Copy link
Contributor Author

(I've just noticed upload incompatibilities (whitespace) introduced due to Windows-> Unix, I'll resubmit later and also check through the validation issues as seen in last commit)

@jnothman
Copy link
Member
jnothman commented Jul 9, 2018 via email

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.

Tree MAE is not considering sample_weights when calculating impurity!
2 participants
0