|
OpenNN
Open-source neural networks library
|
Abstract base class for hidden-layer-size selection methods. More...
#include <neuron_selection.h>
Public Types | |
| enum class | StoppingCondition { MaximumTime , SelectionErrorGoal , MaximumEpochs , MaximumSelectionFailures , MaximumNeurons } |
| Reasons that can terminate a neurons-selection run. More... | |
Public Member Functions | |
| NeuronSelection (TrainingStrategy *training_strategy=nullptr) | |
| Constructs the selector. | |
| virtual | ~NeuronSelection ()=default |
| Virtual destructor. | |
| const TrainingStrategy * | get_training_strategy () const |
| Read-only access to the bound training strategy. | |
| bool | has_training_strategy () const |
| Whether a training strategy has been bound. | |
| bool | get_display () const |
| Whether progress should be printed to stdout. | |
| void | set (TrainingStrategy *) |
| Re-initializes the selector by setting its training strategy. | |
| void | set_training_strategy (TrainingStrategy *new_training_strategy) |
| Sets the training strategy directly. | |
| void | set_default () |
| Resets all hyperparameters to their default values. | |
| void | set_maximum_neurons (const Index new_maximum_neurons) |
| Sets the maximum hidden-layer size considered. | |
| void | set_minimum_neurons (const Index new_minimum_neurons) |
| Sets the minimum hidden-layer size considered. | |
| void | set_trials_number (const Index new_trials_number) |
| Sets the number of training trials per candidate (mean is used). | |
| void | set_display (bool new_display) |
| Toggles per-iteration progress printing. | |
| void | set_validation_error_goal (const float new_validation_error_goal) |
| Sets the validation error goal. | |
| void | set_maximum_epochs (const Index new_maximum_epochs) |
| Sets the maximum training epochs per evaluation. | |
| void | set_maximum_validation_failures (const Index new_maximum_validation_failures) |
| Sets the maximum number of consecutive validation-error increases tolerated. | |
| void | set_maximum_time (const float new_maximum_time) |
| Sets the maximum wall-clock selection time. | |
| void | check () const |
| Validates the bound configuration; throws if anything is missing. | |
| virtual NeuronsSelectionResults | perform_neurons_selection ()=0 |
| Runs the selection algorithm. | |
| string | get_name () const |
| Canonical name of the selector (set by subclasses). | |
| virtual void | from_JSON (const JsonDocument &)=0 |
| Loads selector hyperparameters from a parsed JSON document. | |
| virtual void | to_JSON (JsonWriter &) const =0 |
| Writes selector hyperparameters to a streaming JSON writer. | |
| void | save (const filesystem::path &) const |
| Saves the selector configuration to a file. | |
| void | load (const filesystem::path &) |
| Loads the selector configuration from a file. | |
| virtual void | print () const |
| Prints a human-readable summary of the selector to stdout. | |
Protected Attributes | |
| TrainingStrategy * | training_strategy = nullptr |
| Training strategy used to evaluate candidates; not owned. | |
| VectorR | validation_error_history |
| Per-iteration validation error of the best candidate so far. | |
| VectorR | training_error_history |
| Per-iteration training error of the best candidate so far. | |
| Index | minimum_neurons = 0 |
| Lower bound on the hidden-layer size. | |
| Index | maximum_neurons = 0 |
| Upper bound on the hidden-layer size. | |
| Index | trials_number = 1 |
| Number of independent training runs averaged per candidate. | |
| float | validation_error_goal = 0 |
| Validation error goal; selection stops when reached. | |
| Index | maximum_epochs = 10 |
| Maximum training epochs per evaluation. | |
| Index | maximum_validation_failures = 100 |
| Maximum consecutive validation-error increases tolerated. | |
| float | maximum_time = 0 |
| Maximum wall-clock selection time in seconds. | |
| bool | display = true |
| Whether progress should be printed to stdout during selection. | |
| string | name |
| Canonical name of the selector (set by subclasses). | |
Abstract base class for hidden-layer-size selection methods.
Holds a pointer to a TrainingStrategy used to evaluate candidate architectures, the common stopping criteria and trial averaging. Subclasses implement perform_neurons_selection() to drive the search.
|
strong |
Reasons that can terminate a neurons-selection run.
| opennn::NeuronSelection::NeuronSelection | ( | TrainingStrategy * | training_strategy = nullptr | ) |
Constructs the selector.
| training_strategy | Training strategy used to evaluate candidate sizes. |
|
virtualdefault |
Virtual destructor.
| void opennn::NeuronSelection::check | ( | ) | const |
Validates the bound configuration; throws if anything is missing.
|
pure virtual |
Loads selector hyperparameters from a parsed JSON document.
Implemented in opennn::GrowingNeurons.
|
inline |
Whether progress should be printed to stdout.
|
inline |
Canonical name of the selector (set by subclasses).
|
inline |
Read-only access to the bound training strategy.
|
inline |
Whether a training strategy has been bound.
| void opennn::NeuronSelection::load | ( | const filesystem::path & | ) |
Loads the selector configuration from a file.
Receives the source path.
|
pure virtual |
Runs the selection algorithm.
Implemented in opennn::GrowingNeurons.
|
inlinevirtual |
Prints a human-readable summary of the selector to stdout.
| void opennn::NeuronSelection::save | ( | const filesystem::path & | ) | const |
Saves the selector configuration to a file.
Receives the destination path.
| void opennn::NeuronSelection::set | ( | TrainingStrategy * | ) |
Re-initializes the selector by setting its training strategy.
Receives the training strategy used to evaluate candidates.
| void opennn::NeuronSelection::set_default | ( | ) |
Resets all hyperparameters to their default values.
|
inline |
Toggles per-iteration progress printing.
| new_display | True to print progress to stdout. |
|
inline |
Sets the maximum training epochs per evaluation.
| new_maximum_epochs | Epoch budget for each candidate's training. |
|
inline |
Sets the maximum hidden-layer size considered.
| new_maximum_neurons | Upper bound on the number of neurons. |
|
inline |
Sets the maximum wall-clock selection time.
| new_maximum_time | Time budget in seconds. |
|
inline |
Sets the maximum number of consecutive validation-error increases tolerated.
| new_maximum_validation_failures | Failure budget for early stopping. |
|
inline |
Sets the minimum hidden-layer size considered.
| new_minimum_neurons | Lower bound on the number of neurons. |
|
inline |
Sets the training strategy directly.
| new_training_strategy | Strategy used to evaluate candidates. |
|
inline |
Sets the number of training trials per candidate (mean is used).
| new_trials_number | Number of independent training runs averaged. |
|
inline |
Sets the validation error goal.
| new_validation_error_goal | Selection stops when validation error reaches this value. |
|
pure virtual |
Writes selector hyperparameters to a streaming JSON writer.
Implemented in opennn::GrowingNeurons.
|
protected |
Whether progress should be printed to stdout during selection.
|
protected |
Maximum training epochs per evaluation.
|
protected |
Upper bound on the hidden-layer size.
|
protected |
Maximum wall-clock selection time in seconds.
|
protected |
Maximum consecutive validation-error increases tolerated.
|
protected |
Lower bound on the hidden-layer size.
|
protected |
Canonical name of the selector (set by subclasses).
|
protected |
Per-iteration training error of the best candidate so far.
|
protected |
Training strategy used to evaluate candidates; not owned.
|
protected |
Number of independent training runs averaged per candidate.
|
protected |
Validation error goal; selection stops when reached.
|
protected |
Per-iteration validation error of the best candidate so far.