Callbacks¶
- class sklearn_genetic.callbacks.ConsecutiveStopping(generations, metric='fitness')[source]¶
Stop the optimization if the current metric value is no greater that at least one metric from the last N generations
- Parameters
- generations: int, default=None
Number of current generations to compare against current generation
- metric: {‘fitness’, ‘fitness_std’, ‘fitness_max’, ‘fitness_min’}, default =’fitness’
Name of the metric inside ‘record’ logged in each iteration
- class sklearn_genetic.callbacks.DeltaThreshold(threshold, metric: str = 'fitness')[source]¶
Stop the optimization if the absolute difference between the current and last metric less or equals than a threshold
- Parameters
- threshold: float, default=None
Threshold to compare the differences between cross validation scores
- metric: {‘fitness’, ‘fitness_std’, ‘fitness_max’, ‘fitness_min’}, default =’fitness’
Name of the metric inside ‘record’ logged in each iteration
- class sklearn_genetic.callbacks.ThresholdStopping(threshold, metric='fitness')[source]¶
Stop the optimization if the metric from cross validation score is greater or equals than the define threshold
- Parameters
- threshold: float, default=None
Threshold to compare against the current cross validation average score and determine if the optimization process must stop
- metric: {‘fitness’, ‘fitness_std’, ‘fitness_max’, ‘fitness_min’}, default =’fitness’
Name of the metric inside ‘record’ logged in each iteration