CustomObjective¶
Base class for writing your own regression loss. Subclass it, then pass an instance as
the regressor's loss. See the User Guide:
custom objectives and metrics.
Base class for user-defined regression objectives.
Subclass and implement grad_hess(y, raw) -> (gradient, hessian) and
eval(y, raw, sample_weight=None) -> scalar (lower is better; drives
early stopping). Optionally override init(y, sample_weight=None) (the
starting raw score, default 0.0) and transform(raw) (raw scores ->
predictions, default identity).
Pass an instance as the regressor's loss. Instances must be stateless
across fits and picklable, so define the subclass at module level: bagged
members fit in worker processes.
Read more in the User Guide.