|
XCSF 1.4.8
XCSF learning classifier system
|
Callback to stop training when a certain metric has stopped improving. More...
#include <pybind_callback_earlystop.h>
Public Member Functions | |
| EarlyStoppingCallback (py::str monitor, int patience, bool restore, double min_delta, int start_from, bool verbose) | |
| Constructs a new early stopping callback. | |
| void | store (struct XCSF *xcsf) |
| Stores best XCSF population in memory. | |
| void | retrieve (struct XCSF *xcsf) |
| Retrieves best XCSF population in memory. | |
| bool | run (struct XCSF *xcsf, py::dict metrics) override |
| Checks whether early stopping criteria has been met. | |
| void | finish (struct XCSF *xcsf) override |
| Executes any tasks at the end of fitting. | |
Public Member Functions inherited from Callback | |
| virtual | ~Callback () |
Private Attributes | |
| py::str | monitor |
| Name of the metric to monitor. | |
| int | patience |
| Stop training after this many trials with no improvement. | |
| bool | restore |
| Whether to restore the best population. | |
| double | min_delta |
| Minimum change to qualify as an improvement. | |
| int | start_from |
| Trials to wait before starting to monitor. | |
| bool | verbose |
| Whether to display messages when an action is taken. | |
| double | best_error = std::numeric_limits<double>::max() |
| Best error. | |
| int | best_trial = 0 |
| Trial number the best error was observed. | |
| bool | do_restore = false |
| Whether the population needs to be restored. | |
Callback to stop training when a certain metric has stopped improving.
Definition at line 42 of file pybind_callback_earlystop.h.
|
inline |
Constructs a new early stopping callback.
| [in] | monitor | Name of the metric to monitor: {"train", "val"}. |
| [in] | patience | Trials with no improvement after which training will be stopped. |
| [in] | restore | Whether to restore the best population. |
| [in] | min_delta | Minimum change to qualify as an improvement. |
| [in] | start_from | Trials to wait before starting to monitor improvement. |
| [in] | verbose | Whether to display messages when an action is taken. |
Definition at line 56 of file pybind_callback_earlystop.h.
|
inlineoverridevirtual |
Executes any tasks at the end of fitting.
| [in] | xcsf | The XCSF data structure. |
Implements Callback.
Definition at line 160 of file pybind_callback_earlystop.h.
References do_restore, restore, and retrieve().
|
inline |
Retrieves best XCSF population in memory.
| [in] | xcsf | The XCSF data structure. |
Definition at line 104 of file pybind_callback_earlystop.h.
References best_error, best_trial, do_restore, get_timestamp(), verbose, and xcsf_retrieve_pset().
Referenced by finish(), and run().
|
inlineoverridevirtual |
Checks whether early stopping criteria has been met.
| [in] | xcsf | The XCSF data structure. |
| [in] | metrics | Dictionary of performance metrics. |
Implements Callback.
Definition at line 125 of file pybind_callback_earlystop.h.
References best_error, best_trial, get_timestamp(), min_delta, monitor, patience, restore, retrieve(), start_from, store(), and verbose.
|
inline |
Stores best XCSF population in memory.
| [in] | xcsf | The XCSF data structure. |
Definition at line 86 of file pybind_callback_earlystop.h.
References best_error, best_trial, do_restore, get_timestamp(), verbose, and xcsf_store_pset().
Referenced by run().
|
private |
Best error.
Definition at line 175 of file pybind_callback_earlystop.h.
Referenced by retrieve(), run(), and store().
|
private |
Trial number the best error was observed.
Definition at line 176 of file pybind_callback_earlystop.h.
Referenced by retrieve(), run(), and store().
|
private |
Whether the population needs to be restored.
Definition at line 177 of file pybind_callback_earlystop.h.
Referenced by finish(), retrieve(), and store().
|
private |
Minimum change to qualify as an improvement.
Definition at line 171 of file pybind_callback_earlystop.h.
Referenced by EarlyStoppingCallback(), and run().
|
private |
Name of the metric to monitor.
Definition at line 168 of file pybind_callback_earlystop.h.
Referenced by EarlyStoppingCallback(), and run().
|
private |
Stop training after this many trials with no improvement.
Definition at line 169 of file pybind_callback_earlystop.h.
Referenced by EarlyStoppingCallback(), and run().
|
private |
Whether to restore the best population.
Definition at line 170 of file pybind_callback_earlystop.h.
|
private |
Trials to wait before starting to monitor.
Definition at line 172 of file pybind_callback_earlystop.h.
Referenced by run().
|
private |
Whether to display messages when an action is taken.
Definition at line 173 of file pybind_callback_earlystop.h.
Referenced by retrieve(), run(), and store().