Skip to content

Instantly share code, notes, and snippets.

@jrzaurin
Last active August 5, 2020 06:44
Show Gist options
  • Save jrzaurin/650b2487416716af8a8c428604aa519f to your computer and use it in GitHub Desktop.
Save jrzaurin/650b2487416716af8a8c428604aa519f to your computer and use it in GitHub Desktop.
How to use custom loss for training lightgbm
focal_loss = lambda x,y: focal_loss_lgb(x, y, alpha=0.25, gamma=1.)
focal_loss_eval = lambda x,y: focal_loss_lgb_eval_error(x, y, alpha=0.25, gamma=1.)
model = lgb.train(best, self.lgtrain, fobj=focal_loss, feval=focal_loss_eval)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment