pyepo.metric.metrics

Metrics for SKlearn model

Functions

SPOError(→ float)

Normalized true regret of predicted costs over a dataset.

makeSkScorer(→ Callable)

A function to create sklearn scorer

makeAutoSkScorer(→ Callable)

A function to create Auto-SKlearn scorer

Module Contents

pyepo.metric.metrics.SPOError(pred_cost: numpy.ndarray, true_cost: numpy.ndarray, optmodel: pyepo.model.opt.optModel) float

Normalized true regret of predicted costs over a dataset.

Solves each instance at the predicted and the true cost and returns \(\sum_i l_i / \sum_i |z^*(\mathbf{c}_i)|\); instances with near-zero true optima inflate the ratio.

Parameters:
  • pred_cost – predicted costs of shape (num_data, num_cost)

  • true_cost – true costs of shape (num_data, num_cost)

  • optmodel – a PyEPO optimization model

Returns:

normalized regret

Return type:

float

pyepo.metric.metrics.makeSkScorer(optmodel: pyepo.model.opt.optModel) Callable

A function to create sklearn scorer

Parameters:

optmodel – optimization model

Returns:

callable object that returns a scalar score; less is better.

Return type:

scorer

pyepo.metric.metrics.makeAutoSkScorer(optmodel: pyepo.model.opt.optModel) Callable

A function to create Auto-SKlearn scorer

Parameters:

optmodel – optimization model

Returns:

callable object that returns a scalar score; less is better.

Return type:

scorer