Cost Functions¶
- class staliro.cost_func.CostFunc¶
The transformation from a
Sampleto a cost value.This class is parameterized by two type variables,
CandE.Cis the type of the cost returned by this class and thevalueattribute inResultreturn value.Eis the type of the annotation data in theextraattribute of the return value.
- @staliro.costfunc(f: Callable[[Sample], Result[T, E]]) CostFunc[T, E]¶
- @staliro.costfunc(f: Callable[[Sample], T]) CostFunc[T, None]
Transform a python function into a
CostFunc.If the provided function returns any value other than a
Result, the value will be wrapped in aResultwith theextrafield set toNone. This decorator can be called with or without parentheses.