ddop.metrics.pairwise_costs

ddop.metrics.pairwise_costs(y_true, y_pred, cu, co)

Compute pairwise costs based on the the difference between y_true and y_pred and the given underage and overage costs.

Parameters
  • y_true (array-like) – The true values

  • y_pred (array-like) – The predicted vales

  • cu (int or float) – the underage costs per unit.

  • co (int or float) – the overage costs per unit.

Returns

costs

Return type

ndarray of shape (n_samples, n_outputs)

Examples

>>> from ddop.metrics import pairwise_costs
>>> y_true = [[2,2], [2,4], [3,6]]
>>> y_pred = [[1,2], [3,3], [4,7]]
>>> cu = [2,4]
>>> co = [1,1]
>>> pairwise_costs(y_true, y_pred, cu, co)
array([[2., 0.],
       [1., 4.]
       [1., 1.])