Quickstart: Parametric Frequency Sweep with the Python API
Quickstart: Parametric Frequency Sweep with the Python API#
This tutorial uses Frequency Selective Surface provided with NeurEco installation.
To work with the Parametric Frequency Sweep NeurEco models in Python, import NeurEcoFrequential library:
from NeurEco import NeurEcoFrequential as Frequential
Import numpy to handle the data sets:
import numpy as np
Load the data sets (see Data preparation for NeurEco Parametric Frequency Sweep with the Python API and Frequency Selective Surface):
x_train = np.load("inputs_train.npy")
y_train = np.load("targets_train.npy")
x_valid = np.load("inputs_valid.npy")
y_valid = np.load("targets_valid.npy")
x_test = np.load("inputs_test.npy")
y_test = np.load("targets_test.npy")
To initialize a NeurEco object to handle the Parametric Frequency Sweep problem:
model = Frequential.PFS()
To build the model, call method build with the parameters set for the problem under consideration (see Build NeurEco Parametric Frequency Sweep model with the Python API). For this example, we provide a validation data set explicitly.
model.build(x_train, y_train,
# the rest of these parameters are optional
validation_input_data=x_valid,
validation_output_data=y_valid,
write_model_to="./FSS/model_fss.efnn",
checkpoint_address="./FSS/fss.checkpoint")
Note
For detailed documentation on build, see Build NeurEco Parametric Frequency Sweep model with the Python API.
To evaluate the NeurEco Model on the testing data (the second year of data), call evaluate method:
neureco_outputs_test = model.evaluate(x_test)
Note
For detailed documentation on evaluate, see Evaluate NeurEco Parametric Frequency Sweep model with the Python API.
To export the model as an FMU file:
model.export_fmu("./FSS/model_fss.fmu")
This export requires neureco_embed_pfs license.
Note
For detailed documentation on export, see Export NeurEco Parametric Frequency Sweep model python
When the model is not needed any more, delete it from the memory:
model.delete()
Note
For detailed documentation on Parametric Frequency Sweep with the python API, see Parametric Frequency Sweep with the Python API.