make_forecasting_scorer#
- make_forecasting_scorer(func, name=None, greater_is_better=False, multioutput='uniform_average', multilevel='uniform_average')[source]#
Create a metric class from a metric function.
- Parameters:
- funccallable
Callable to convert to a forecasting scorer class. Score function (or loss function) with signature
func(y, y_pred, **kwargs)
.- namestr, default=None
Name to use for the forecasting scorer loss class.
- greater_is_betterbool, default=False
If True then maximizing the metric is better. If False then minimizing the metric is better.
- multioutput{‘raw_values’, ‘uniform_average’} or array-like of shape (n_outputs,), default=’uniform_average’
Defines how to aggregate metric for multivariate (multioutput) data.
If array-like, values used as weights to average the errors.
If
'raw_values'
, returns a full set of errors in case of multioutput input.If
'uniform_average'
, errors of all outputs are averaged with uniform weight.
- multilevel{‘raw_values’, ‘uniform_average’, ‘uniform_average_time’}
Defines how to aggregate metric for hierarchical data (with levels).
If
'uniform_average'
(default), errors are mean-averaged across levels.If
'uniform_average_time'
, metric is applied to all data, ignoring level index.If
'raw_values'
, does not average errors across levels, hierarchy is retained.
- Returns:
- scorer:
Metric class that can be used as forecasting scorer.