solarforecastarbiter.metrics.deterministic.cost

solarforecastarbiter.metrics.deterministic.cost(obs, fx, cost_params, error_fnc=<function error>)[source]

Compute the cost for forecast errors according to cost_params. cost_params.type determines which cost function of constant_cost(), time_of_day_cost(), datetime_cost(), or error_band_cost() will be used.

In general, the cost is calculated as

\[\text{cost} = \sum_{i=1}^n C_i(S(\text{obs}_i, \text{fx}_i))\]

where \(C_i\) is determined by the cost function and \(S\) is the error function.

Parameters:
  • obs ((n,) pandas.Series) – Observed values
  • fx ((n,) pandas.Series) – Forecasted values
  • cost_params (solarforecastarbiter.datamodel.Cost) – Parameters that the define the cost value along with how to aggregate the costs.
  • error_fnc (function) – A function that returns the error, default fx - obs. First argument is obs, second argument is fx.
Returns:

cost (float) – The cost of the forecast errors.