Quickstart: Tabular Regression with the Python API#

This tutorial uses Energy consumption provided with NeurEco installation.


The GUI functionality Export NeurEco to Python , see Export Tabular Regression from the GUI to the Python API, facilitates the initial transition from the usage of NeurEco with the GUI to its usage with the Python API.

To work with the Tabular NeurEco models in Python, import NeurEcoTabular library:

from NeurEco import NeurEcoTabular as Tabular

Import numpy to handle the data sets:

import numpy as np

Load the data sets (see Data preparation for NeurEco Regression with the Python API and Energy consumption):

x_train = np.genfromtxt("./x_train.csv", delimiter=";", skip_header=True)
y_train = np.genfromtxt("./y_train.csv", delimiter=";", skip_header=True)
y_train = np.reshape(y_train, (-1, 1))
x_test = np.genfromtxt("x_test.csv", delimiter=";", skip_header=True)
y_test = np.genfromtxt("y_test.csv", delimiter=";", skip_header=True)
y_test = np.reshape(y_test, (-1, 1))

To initialize a NeurEco object to handle the Regression problem:

regression_model = Tabular.Regressor()

To build the model, call method build with the parameters set for the problem under consideration (see Build NeurEco Regression model with the Python API):

regression_model.build(input_data=x_train, output_data=y_train,
                # the rest of these parameters are optional


For detailed documentation on build, see Build NeurEco Regression model with the Python API

To evaluate the NeurEco Model on the testing data, call evaluate method:

neureco_test_outputs = regression_model.evaluate(x_test)


For detailed documentation on evaluate, see Evaluate NeurEco Regression model with the Python API

To export the model to the chosen format, run one of the following commands:

regression_model.export_c("./EnergyConsumptionModel/EnergyConsumption.h", precision="double")
regression_model.export_onnx("./EnergyConsumptionModel/EnergyConsumption.onnx", precision="float16")
regression_model.export_vba("./EnergyConsumptionModel/EnergyConsumption.bas", precision="float")

Export to these formats requires embed license.


For detailed documentation on export, see Export NeurEco Regression model with the Python API

When the model is not needed any more, delete it from the memory:



For detailed documentation on Tabular Regression with the python API, see Tabular Regression with the Python API.