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

Skip to content

Conversation

@lorentzenchr
Copy link
Member

Reference Issues/PRs

This PR avoids the call to predict_proba when executing predict in HGBT.

What does this implement/fix? Explain your changes.

Any other comments?

@github-actions
Copy link

github-actions bot commented Nov 25, 2023

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: b26e3d2. Link to the linter CI: here

@lorentzenchr lorentzenchr added the Quick Review For PRs that are quick to review label Nov 28, 2023
Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

Codewise this looks more efficient. Did you find a measurable performance benefit?

In any case, LGTM.

@thomasjpfan thomasjpfan added the Waiting for Second Reviewer First reviewer is done, need a second one! label Dec 7, 2023
Copy link
Member

@betatim betatim left a comment

Choose a reason for hiding this comment

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

Looks good to me. I assume it is faster because it does less work (we save the detour via self._loss).

One thing that would have helped me understand why this is an equivalent thing to do is more documentation on what _raw_predict returns. Mostly because my editor couldn't help me find the implementation of self._loss.predict_proba. There is a _loss.c in the directory, but no _loss.pyx, so I guess the actual code for this comes from sklearn/_loss/loss.py?? (you see confusion reigns supreme :D)

@lorentzenchr
Copy link
Member Author

@betatim Think GLMs: You compute a raw prediction in "link space". This is called linear predictor for GLM, just X @ coef. Then you use a one-to-one function (the inverse link function) to map it back to the scale of the target y, e.g. expit(raw) for binary classification.

@glemaitre
Copy link
Member

@jeremiedbb it seems this has not been merged for the 1.4. Would you be inclined in including it in the 1.4 or should we postpone for 1.5?

@thomasjpfan thomasjpfan added this to the 1.5 milestone Jan 20, 2024
@thomasjpfan thomasjpfan merged commit 897c0c5 into scikit-learn:main Jan 20, 2024
@lorentzenchr
Copy link
Member Author

The whatsnew entry needs to be moved to 1.5, right?

@glemaitre
Copy link
Member

Indeed. We need to. I'll make the fix.

@lorentzenchr lorentzenchr deleted the hgbt_predict_class branch January 23, 2024 20:06
glemaitre added a commit to glemaitre/scikit-learn that referenced this pull request Feb 10, 2024
@lorentzenchr lorentzenchr added Performance and removed Waiting for Second Reviewer First reviewer is done, need a second one! labels May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:ensemble Performance Quick Review For PRs that are quick to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants