Skip to content
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 base_score only when needed #257

Merged
merged 2 commits into from Jun 26, 2020
Merged

add base_score only when needed #257

merged 2 commits into from Jun 26, 2020

Conversation

StrikerRUS
Copy link
Member

It was quite strange to see global bias in generated code for LightGBM. Also, it simplifies hence speeds up runtime.

@coveralls
Copy link

coveralls commented Jun 25, 2020

Coverage Status

Coverage increased (+0.004%) to 95.255% when pulling bc2f75c on base_score into ec02c72 on master.

*estimators_ast)

if base_score != 0.0:
Copy link
Member

Choose a reason for hiding this comment

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

This is a great idea 👍 Do you think the same logic can be applied to bias and coefficients in case of linear models? I can see how L1-regularized linear models can benefit from this greatly (relatively).

Copy link
Member Author

Choose a reason for hiding this comment

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

Of course, awesome proposal! But I have plans to introduce DotProduct expression with a fallback (very similar one to the current linear_to_ast function). I think I will address sparsity problems there.

def _linear_to_ast(coef, intercept):
feature_weight_mul_ops = [
utils.mul(ast.FeatureRef(index), ast.NumVal(value))
for index, value in enumerate(coef)
]
return utils.apply_op_to_expressions(
ast.BinNumOpType.ADD,
ast.NumVal(intercept),
*feature_weight_mul_ops)

Copy link
Member

@izeigerman izeigerman left a comment

Choose a reason for hiding this comment

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

Awesome, thank you 👍

@izeigerman izeigerman merged commit 13e6c0a into master Jun 26, 2020
@izeigerman izeigerman deleted the base_score branch June 26, 2020 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants