-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Add capability to get possible max and min values for a model #2737
Conversation
Apparently It fails to compile at linking time, but I do not experience this error locally |
You could move the implementation from gbdt_prediction.cpp to gbdt.cpp . |
… to upper and lower bound, move implementation to gdbt.cpp
Changed according to comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoanFM Thanks for your PR! Please check some comments below:
Co-Authored-By: Nikita Titov <[email protected]>
…ython and a basic test
@JoanFM New asserts in basic test cause failures for all OSes:
I guess it's due to you have not the latest commit installed locally. Also, I think 4-6 digits after a dot will be enough to allow future contributions with insignificant changes will not require value adjustments. |
Thank you for your comments @StrikerRUS , I have done the changes, I hope it helps |
…ck to test with hardcoded value
640aa78
to
a753edf
Compare
9261d31
to
00bdde1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments before merging.
Also, ping @jameslamb as I'm a little bit confused by function names in R (trailing _
).
Co-Authored-By: Nikita Titov <[email protected]>
Co-Authored-By: Nikita Titov <[email protected]>
Co-Authored-By: Nikita Titov <[email protected]>
Co-Authored-By: Nikita Titov <[email protected]>
…to max_min_leafs
61c6dbe
to
aa362e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoanFM LGTM! Thanks a lot for your contribution!
@@ -357,6 +357,16 @@ class Booster { | |||
return boosting_->FeatureImportance(num_iteration, importance_type); | |||
} | |||
|
|||
double UpperBoundValue() const { | |||
std::lock_guard<std::mutex> lock(mutex_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why mutex is needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to guarantee that this value is read while no one is changing any inner value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, that is why we need reader/writer locks.
lower_bound <- 0L | ||
lgb.call( | ||
"LGBM_BoosterGetLowerBoundValue_R" | ||
, ret = upper_bound |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was too slow getting to review here, apologies! @guolinke I'm going to make a followup PR with some changes:
- using trailing
_
is very uncommon in R, these methods should be calledupper_bound()
andlower_bound()
- there is a bug on this line...return of the call to
LGBM_BoosterGetLowerBoundValue_R
should go intolower_bound
, notupper_bound
- there should be unit tests added whenever we introduce new methods in the public API of the package
Proposal to provide feature described in: #2736