make_ts_scorer

hcrystalball.metrics.make_ts_scorer(score_func, greater_is_better=True, needs_proba=False, needs_threshold=False, **kwargs)[source]

Make a scorer from a performance metric or loss function.

This factory function wraps scoring functions for use in GridSearchCV and cross_validate. It takes a score function, such as accuracy_score, mean_squared_error, adjusted_rand_index or average_precision and returns a callable that scores an estimator’s output. Read more in the User Guide.

Parameters
  • score_func (callable,) – Score function (or loss function) with signature score_func(y, y_pred, **kwargs).

  • greater_is_better (boolean) – Whether score_func is a score function (default), meaning high is good, or a loss function, meaning low is good. In the latter case, the scorer object will sign-flip the outcome of the score_func.

  • needs_proba (boolean) – Not yet implemented, kept only to be compatible with the scikit-learn API

  • needs_threshold (boolean) – Not yet implemented, kept only to be compatible with the scikit-learn API

  • **kwargs (additional arguments) – Additional parameters to be passed to score_func.

Returns

scorer object that returns a scalar score

Return type

callable