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

Native support for Focal Loss #3706

Closed
glevv opened this issue Jan 2, 2021 · 5 comments
Closed

Native support for Focal Loss #3706

glevv opened this issue Jan 2, 2021 · 5 comments
Assignees

Comments

@glevv
Copy link

glevv commented Jan 2, 2021

Could you add native support for Focal Loss? There are implementations for LGBM and XGB. They show better performance on imbalanced data, but they are slow and clunky. Also allow to use MSE for classification (also known as square loss, it's a proper scorer function and in some cases could be better than LogLoss). More classification losses could be added to stand out in this department (since all GBDTs algorithms use LogLoss and nothing else).

@guolinke
Copy link
Collaborator

thank you, a good feature request!

For use regression objective for classification, I think LightGBM already supports it.
You can use the LightGBM native API, not sklearn API. And then set objective to l2, metric to classification metrics. I think it should work.

@guolinke
Copy link
Collaborator

@btrotta @shiyu1994 are you interesting in implementing Focal loss?

@StrikerRUS
Copy link
Collaborator

@guolinke

You can use the LightGBM native API, not sklearn API.

I think sklearn API can be used as well, but the most general class LGBMModel from it.

lgb.LGBMModel(objective='l2', metric='binary_logloss').fit(X, y)

@shiyu1994
Copy link
Collaborator

I can implement it.

@shiyu1994 shiyu1994 self-assigned this Jan 12, 2021
@StrikerRUS StrikerRUS changed the title Classification losses Native support for Focal Loss Mar 27, 2021
@StrikerRUS
Copy link
Collaborator

Closed in favor of being in #2302. We decided to keep all feature requests in one place.

Welcome to contribute this feature! Please re-open this issue (or post a comment if you are not a topic starter) if you are actively working on implementing this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants