-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Focal loss c++ implementation #1807
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
Conversation
curApprox += approxDelta[k]; | ||
} | ||
const float w = hasWeight ? weight[k] : 1; | ||
double FocalAlpha = 0.75; |
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.
It is necessary to pass these parameters into the metric somehow.
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'd better wait for maintainers' advice on how to do it in the most correct way(probably in the way I did it with loss params)
} | ||
const float w = hasWeight ? weight[k] : 1; | ||
double FocalAlpha = 0.75; | ||
double FocalGamma = 2; |
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.
This parameter too.
@arcadia-devtools Ship it! |
CLA already signed |
@arcadia-devtools Ship it! |
thanks your great job. |
Thank you for your contribution. Sorry for the long wait. I've merged this PR (the original author is preserved). |
I hereby agree to the terms of the CLA available at [https://yandex.ru/legal/cla/?lang=en].
Adds a focal loss CPU implementation. Focal loss is widely used in classification tasks with highly imbalanced data.
Details can be found here:
https://arxiv.org/abs/1708.02002 - original paper
https://paperswithcode.com/method/focal-loss - 216 papers used it.
Possible problems:
"loss_function": "Focal:focal_alpha=0.75;focal_gamma=2.0"