Build NeurEco Parametric Frequency Sweep model with the Python API#

To build a NeurEco Parametric Frequency Sweep model in Python API, import NeurEcoFrequential library:

from NeurEco import NeurEcoFrequential as Frequential

Initialize a NeurEco object to handle the Parametric Frequency Sweep problem:

model = Frequential.PFS()

Call method build with the parameters set for the problem under consideration:

model.build(input_data, output_data,
                 validation_input_data=None,
                 validation_output_data=None,
                 valid_percentage=None,
                 test_input_data=None,
                 test_output_data=None,
                 write_model_to="",
                 checkpoint_address="",
                 compressed_space_size=5,
                 min_number_of_enrichments=100,
                 max_number_of_enrichments=200,
                 unsuccessful_enrichments_threshold=4,
                 enrichment_rate=0.2,
                 resume=False
                 )
input_data

NumPy array, dtype=float64, required: NumPy array of the training input data. The shape is \((m,\ n)\), where \(m\) is the number of samples, and \(n\) is the number of input variables

output_data

NumPy array, dtype=complex128, required: NumPy array of training target data. The shape is \((m,\ n)\) where \(m\) is the number of samples, and \(n\) is the number of output variables.

validation_input_data

NumPy array, dtype=float64, optional: Numpy array of validation input data. The shape is \((m,\ n)\) where \(m\) is the number of samples, and \(n\) is the number of input variables.

validation_output_data

NumPy array, dtype=complexe, optional: Numpy array of validation target data. The shape is \((m,\ n)\) where \(m\) is the number of samples, and \(n\) is the number of output variables.

test_input_data

NumPy array, dtype=float64, optional: Numpy array of test input data. The shape is \((m,\ n)\) where \(m\) is the number of samples, and \(n\) is the number of input variables.

test_output_data

NumPy array, dtype=complexe, optional: Numpy array of test target data. The shape is \((m,\ n)\) where \(m\) is the number of samples, and \(n\) is the number of output variables.

write_model_to

string, optional, default is None: path on the disk where to save the model

valid_percentage

float, optional, default is \(33.33\): Percentage of the data that NeurEco will select to use as validation data. The minimum accepted value is 1 (1%). The maximum accepted value is \(50\) (50%). Ignored unless validation data is None.

checkpoint_address

string, optional, default is “”: the path where the checkpoint model will be saved. The checkpoint model is used for resuming the build of a model, or for choosing an intermediate network with less topological optimization steps.

reduced_space_size

int: the dimension of the reduced space (outputs) used to train the model

min_number_of_enrichments

int: the minimum number of enrichments

max_number_of_enrichments

int: the maximum number of enrichments

unsuccessful_enrichments_threshold

int: maximum number of consecutive unsuccessful enrichment steps (no imrovement of validation error) before stopping the training process

enrichment_rate

float: tunes the quantity of new parameters added at every enrichment step (has to be included between 0 and 1)

resume

Bool, default=False: Used to resume an interrupted build

return

build_status: int: 0 if build is successful, other if otherwise

For more information on the data format, see Data preparation for NeurEco Parametric Frequency Sweep with the Python API.

Data normalization for Parametric Frequency Sweep#

NeurEco performs the data normalization automatically for Parametric Frequency Sweep.

  • for input features: a Min-Max normalization is performed by feature, meaning that each input feature \(f\) is normalized independently from others, so that

    \[f_{normalized}=\frac{f-min(f)}{max(f)}\]
  • for output features: all features are normalized together by division by their maximum absolute value, so that

    \[targets_{normalized}=\frac{targets}{max(|targets|)}\]