ddop.metrics.total_costs
- ddop.metrics.total_costs(y_true, y_pred, cu, co, multioutput='cumulated')
Compute total 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.
multioutput ({"raw_values", "cumulated"}, default="cumulated") –
- Defines aggregating of multiple output values. Default is “cumulated”.
- ’raw_values’ :
Returns a full set of cost values in case of multioutput input.
- ’cumulated’ :
Costs of all outputs are cumulated.
- Returns
total_costs – The total costs. If multioutput is ‘raw_values’, then the total costs are returned for each output separately. If multioutput is ‘cumulated’, then the cumulated costs of all outputs is returned. The total costs are non-negative floating points. The best value is 0.0.
- Return type
float or ndarray of floats
Examples
>>> from ddop.metrics import total_costs >>> y_true = [[2,2], [2,4], [3,6]] >>> y_pred = [[1,2], [3,3], [4,7]] >>> cu = [2,4] >>> co = [1,1] >>> total_costs(y_true, y_pred, cu, co, multioutput="raw_values") array([4,5]) >>> total_costs(y_true, y_pred, cu, co, multioutput="cumulated") 9