Evaluate NeurEco Compression model with the Python API#

To evaluate a NeurEco Compression model in Python API, import NeurEcoTabular library:

from NeurEco import NeurEcoTabular as Tabular

Initialize a NeurEco object to handle the Compressor problem:

model = Tabular.Compressor()

Build NeurEco Compression model with the Python API or load previously build and saved to “the/path/to/the/saved/compression/model.ernn” model:

model.load("the/path/to/the/saved/compression/model.ernn")

Once model contains a compression decompression model, call method evaluate with the parameters set accordingly:

model.evaluate(inputs, vec=None)

Evaluates a Tabular model on a set of input data.

inputs

required, NumPy array: input data array: shape (n, m) where n is the number of samples and m is the number of input features.

vec

optional, NumPy array: perform evaluation with the model’s weights set to values in vec.

return

NumPy array: output data array: shape (n, p) where n is the number of samples and p is the number of output features.

Evaluate the compression coefficients and decompress them#

Any Compression model can be divided in its model_Compressor and model_Decompressor parts via the call to separate_models method, both of them are Regression models:

neurEco_Compressor = Tabular.Regressor()
neurEco_Decompressor = Tabular.Regressor()
separate_status = model.separate_models(neurEco_Compressor, neurEco_Decompressor)

To evaluate the compression coefficients (the evaluation for a Regression model is the same as for a Compression model, see Evaluate NeurEco Regression model with the Python API):

To decompress the obtained array compression_coefficients:

The obtained decompressed_output is equal to the output obtained with original Compression model.