ddop.metrics.make_scorer

ddop.metrics.make_scorer(score_func, greater_is_better=True, **kwargs)

Make a scorer from a performance metric or loss function. This factory function wraps scoring functions for use in sklearn.model_selection.GridSearchCV and sklearn.model_selection.cross_val_score. It takes a score function from ddop.metrics, such as ddop.metrics.total_costs, and returns a callable that scores an estimator’s output. The signature of the call is (estimator, X, y) where estimator is the model to be evaluated, X is the data and y is the ground truth labeling.

Parameters
  • score_func (callable) – Score function included in ddop.metrics.

  • greater_is_better (bool, default=True) – 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.

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

Returns

scorer – Callable object that returns a scalar score; greater is better.

Return type

callable