Loss functions

Numpy-based loss functans that can be used by environments or non-pytorch models.

source

pinball_loss

 pinball_loss (Y_true:numpy.ndarray, Y_pred:numpy.ndarray,
               underage_cost:ddopai.utils.Parameter|numpy.ndarray,
               overage_cost:ddopai.utils.Parameter|numpy.ndarray)

Pinball loss calculating the cost of underestimating and overestimating the target value based on specific underage and overage costs. Used to evaulate the Newsvendor cost.

Type Details
Y_true ndarray
Y_pred ndarray
underage_cost ddopai.utils.Parameter | numpy.ndarray
overage_cost ddopai.utils.Parameter | numpy.ndarray
Returns ndarray returns the cost per observation

source

quantile_loss

 quantile_loss (Y_true:numpy.ndarray, Y_pred:numpy.ndarray,
                quantile:Union[float,ddopai.utils.Parameter])

Similar evaluation function to the pinball loss, but with the quantile of range [0, 1] as a parameter instead of SKU-specific cost levels for underage and overage.

Type Details
Y_true ndarray
Y_pred ndarray
quantile Union
Returns ndarray returns the cost per observation