EarlyStopping¶
Defined in fynance.models.training
- class EarlyStopping(patience=5, min_delta=0., mode='max')[source]
Bases:
objectPatience-based early stopping on a monitored metric.
Call
stepwith the validation metric each epoch; it returnsTrueonce the metric has failed to improve forpatiencesteps.- Parameters:
- patienceint, optional
Number of non-improving steps to tolerate. Default 5.
- min_deltafloat, optional
Minimum change counted as an improvement. Default 0.
- mode{‘max’, ‘min’}, optional
Whether the metric should be maximized (e.g. Sharpe) or minimized (e.g. loss). Default ‘max’.
- Attributes:
- bestfloat or None
Best metric seen so far.
- stopbool
Whether stopping has been triggered.
- step(metric)[source]
Update with a new metric value; return True if training should stop.