160 void save(
const filesystem::path&)
const;
166 void load(
const filesystem::path&);
void set(TrainingStrategy *)
Re-initializes the selector by setting its training strategy.
virtual NeuronsSelectionResults perform_neurons_selection()=0
Runs the selection algorithm.
Index minimum_neurons
Lower bound on the hidden-layer size.
Definition neuron_selection.h:183
void set_trials_number(const Index new_trials_number)
Sets the number of training trials per candidate (mean is used).
Definition neuron_selection.h:99
void set_maximum_epochs(const Index new_maximum_epochs)
Sets the maximum training epochs per evaluation.
Definition neuron_selection.h:116
void set_minimum_neurons(const Index new_minimum_neurons)
Sets the minimum hidden-layer size considered.
Definition neuron_selection.h:94
void check() const
Validates the bound configuration; throws if anything is missing.
void set_maximum_neurons(const Index new_maximum_neurons)
Sets the maximum hidden-layer size considered.
Definition neuron_selection.h:89
void set_display(bool new_display)
Toggles per-iteration progress printing.
Definition neuron_selection.h:105
float maximum_time
Maximum wall-clock selection time in seconds.
Definition neuron_selection.h:201
void load(const filesystem::path &)
Loads the selector configuration from a file.
void set_default()
Resets all hyperparameters to their default values.
VectorR training_error_history
Per-iteration training error of the best candidate so far.
Definition neuron_selection.h:180
virtual void print() const
Prints a human-readable summary of the selector to stdout.
Definition neuron_selection.h:169
void set_training_strategy(TrainingStrategy *new_training_strategy)
Sets the training strategy directly.
Definition neuron_selection.h:80
virtual void to_JSON(JsonWriter &) const =0
Writes selector hyperparameters to a streaming JSON writer.
void set_validation_error_goal(const float new_validation_error_goal)
Sets the validation error goal.
Definition neuron_selection.h:111
bool display
Whether progress should be printed to stdout during selection.
Definition neuron_selection.h:204
void save(const filesystem::path &) const
Saves the selector configuration to a file.
Index maximum_validation_failures
Maximum consecutive validation-error increases tolerated.
Definition neuron_selection.h:198
StoppingCondition
Reasons that can terminate a neurons-selection run.
Definition neuron_selection.h:44
@ SelectionErrorGoal
Validation error reached the configured goal.
Definition neuron_selection.h:46
@ MaximumSelectionFailures
Validation error increased too many times.
Definition neuron_selection.h:48
@ MaximumEpochs
Configured epoch budget exhausted.
Definition neuron_selection.h:47
@ MaximumTime
Configured time budget exhausted.
Definition neuron_selection.h:45
@ MaximumNeurons
Maximum hidden-layer size reached.
Definition neuron_selection.h:49
Index maximum_neurons
Upper bound on the hidden-layer size.
Definition neuron_selection.h:186
bool get_display() const
Whether progress should be printed to stdout.
Definition neuron_selection.h:67
void set_maximum_validation_failures(const Index new_maximum_validation_failures)
Sets the maximum number of consecutive validation-error increases tolerated.
Definition neuron_selection.h:121
bool has_training_strategy() const
Whether a training strategy has been bound.
Definition neuron_selection.h:64
virtual void from_JSON(const JsonDocument &)=0
Loads selector hyperparameters from a parsed JSON document.
Index maximum_epochs
Maximum training epochs per evaluation.
Definition neuron_selection.h:195
virtual ~NeuronSelection()=default
Virtual destructor.
TrainingStrategy * training_strategy
Training strategy used to evaluate candidates; not owned.
Definition neuron_selection.h:174
NeuronSelection(TrainingStrategy *training_strategy=nullptr)
Constructs the selector.
string get_name() const
Canonical name of the selector (set by subclasses).
Definition neuron_selection.h:140
string name
Canonical name of the selector (set by subclasses).
Definition neuron_selection.h:207
const TrainingStrategy * get_training_strategy() const
Read-only access to the bound training strategy.
Definition neuron_selection.h:61
Index trials_number
Number of independent training runs averaged per candidate.
Definition neuron_selection.h:189
float validation_error_goal
Validation error goal; selection stops when reached.
Definition neuron_selection.h:192
void set_maximum_time(const float new_maximum_time)
Sets the maximum wall-clock selection time.
Definition neuron_selection.h:126
VectorR validation_error_history
Per-iteration validation error of the best candidate so far.
Definition neuron_selection.h:177
Coordinates the training of a NeuralNetwork on a Dataset.
Definition training_strategy.h:45
Definition adaptive_moment_estimation.h:19
Matrix< Index, Dynamic, 1 > VectorI
Definition neural_network.h:157
Matrix< float, Dynamic, 1 > VectorR
Definition neural_network.h:156
Outcome of a NeuronSelection run.
Definition neuron_selection.h:219
VectorR validation_error_history
Per-iteration validation error of the best candidate.
Definition neuron_selection.h:254
Index optimal_neurons_number
Hidden-layer size at the optimal architecture.
Definition neuron_selection.h:245
void resize_history(const Index new_size)
Resizes the error history vectors.
void print() const
Prints a human-readable summary of the result to stdout.
float optimum_training_error
Training error at the optimal architecture.
Definition neuron_selection.h:257
VectorI neurons_number_history
Per-iteration hidden-layer size considered.
Definition neuron_selection.h:242
NeuronsSelectionResults(const Index maximum_epochs=0)
Constructs the result pre-sized for an expected iteration count.
float optimum_validation_error
Validation error at the optimal architecture.
Definition neuron_selection.h:260
string elapsed_time
Total elapsed wall-clock time, formatted as "hh:mm:ss".
Definition neuron_selection.h:266
NeuronSelection::StoppingCondition stopping_condition
Stopping condition that ended the selection run.
Definition neuron_selection.h:263
VectorR training_error_history
Per-iteration training error of the best candidate.
Definition neuron_selection.h:251
string write_stopping_condition() const
Returns the canonical string name of the stopping condition.
VectorR optimal_parameters
Network parameters at the optimal architecture.
Definition neuron_selection.h:248
Per-epoch error history and final summary produced by Optimizer::train().
Definition optimizer.h:374