OpenNN
Open-source neural networks library
Loading...
Searching...
No Matches
opennn::GrowingInputs Class Referencefinal

Forward-selection of input features driven by feature-target correlation. More...

#include <growing_inputs.h>

Inheritance diagram for opennn::GrowingInputs:
[legend]

Public Member Functions

 GrowingInputs (TrainingStrategy *training_strategy=nullptr)
 Constructs the selector.
 
Index get_minimum_inputs_number () const override
 Lower bound on the number of selected inputs.
 
Index get_maximum_inputs_number () const override
 Upper bound on the number of selected inputs.
 
void set_default ()
 Resets all hyperparameters to their default values.
 
void set_maximum_inputs_number (const Index)
 Sets the maximum number of selected inputs.
 
void set_minimum_inputs_number (const Index)
 Sets the minimum number of selected inputs.
 
void set_maximum_correlation (const float)
 Sets the upper correlation threshold.
 
void set_minimum_correlation (const float)
 Sets the lower correlation threshold.
 
InputsSelectionResults perform_input_selection () override
 Runs the forward-selection algorithm.
 
void from_JSON (const JsonDocument &) override
 Loads selector hyperparameters from a parsed JSON document.
 
void to_JSON (JsonWriter &) const override
 Writes selector hyperparameters to a streaming JSON writer.
 
- Public Member Functions inherited from opennn::InputsSelection
 InputsSelection (TrainingStrategy *training_strategy=nullptr)
 Constructs the selector.
 
virtual ~InputsSelection ()=default
 Virtual destructor.
 
const TrainingStrategyget_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 *new_training_strategy)
 Re-initializes the selector by setting its training strategy.
 
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.
 
string get_name () const
 Canonical name of the selector (set by subclasses).
 
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.
 

Additional Inherited Members

- Public Types inherited from opennn::InputsSelection
enum class  StoppingCondition {
  MaximumTime , SelectionErrorGoal , MaximumInputs , MaximumEpochs ,
  MaximumSelectionFailures
}
 Reasons that can terminate an input-selection run. More...
 
- Protected Attributes inherited from opennn::InputsSelection
TrainingStrategytraining_strategy = nullptr
 Training strategy used to evaluate candidate subsets; not owned.
 
Index trials_number = 1
 Number of independent training runs averaged per candidate.
 
bool display = true
 Whether progress should be printed to stdout during selection.
 
float validation_error_goal
 Validation error goal; selection stops when reached.
 
Index maximum_epochs
 Maximum training epochs per evaluation.
 
Index maximum_validation_failures = 100
 Maximum consecutive validation-error increases tolerated.
 
float maximum_time
 Maximum wall-clock selection time in seconds.
 
string name
 Canonical name of the selector (set by subclasses).
 

Detailed Description

Forward-selection of input features driven by feature-target correlation.

Starts from the input with the highest correlation to the target and iteratively adds the next-best input as long as the validation error keeps improving and the configured min/max bounds are respected.

Constructor & Destructor Documentation

◆ GrowingInputs()

opennn::GrowingInputs::GrowingInputs ( TrainingStrategy * training_strategy = nullptr)

Constructs the selector.

Parameters
training_strategyTraining strategy used to evaluate candidate subsets.

Member Function Documentation

◆ from_JSON()

void opennn::GrowingInputs::from_JSON ( const JsonDocument & )
overridevirtual

Loads selector hyperparameters from a parsed JSON document.

Implements opennn::InputsSelection.

◆ get_maximum_inputs_number()

Index opennn::GrowingInputs::get_maximum_inputs_number ( ) const
overridevirtual

Upper bound on the number of selected inputs.

Implements opennn::InputsSelection.

◆ get_minimum_inputs_number()

Index opennn::GrowingInputs::get_minimum_inputs_number ( ) const
overridevirtual

Lower bound on the number of selected inputs.

Implements opennn::InputsSelection.

◆ perform_input_selection()

InputsSelectionResults opennn::GrowingInputs::perform_input_selection ( )
overridevirtual

Runs the forward-selection algorithm.

Returns
Best-of-run input subset and supporting statistics.

Implements opennn::InputsSelection.

◆ set_default()

void opennn::GrowingInputs::set_default ( )

Resets all hyperparameters to their default values.

◆ set_maximum_correlation()

void opennn::GrowingInputs::set_maximum_correlation ( const float )

Sets the upper correlation threshold.

Receives the threshold above which two inputs are considered redundant.

◆ set_maximum_inputs_number()

void opennn::GrowingInputs::set_maximum_inputs_number ( const Index )

Sets the maximum number of selected inputs.

Receives the upper bound on the number of selected inputs.

◆ set_minimum_correlation()

void opennn::GrowingInputs::set_minimum_correlation ( const float )

Sets the lower correlation threshold.

Receives the threshold below which an input is considered uninformative.

◆ set_minimum_inputs_number()

void opennn::GrowingInputs::set_minimum_inputs_number ( const Index )

Sets the minimum number of selected inputs.

Receives the lower bound on the number of selected inputs.

◆ to_JSON()

void opennn::GrowingInputs::to_JSON ( JsonWriter & ) const
overridevirtual

Writes selector hyperparameters to a streaming JSON writer.

Implements opennn::InputsSelection.