Evaluate NeurEco Classification model with the Python API#

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

from NeurEco import NeurEcoTabular as Tabular

Initialize a NeurEco object to handle the Classification problem:

model = Tabular.Classifier()

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

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

Once model contains a Classification 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.

The evaluated array outputs is non one-hot encoded. Each column j of this array contains the predicted probabilities for the samples to belong to the class number j.

Post-treatment to get the predicted class numbers:

import numpy as np
output_labels = np.argmax(outputs, axis=1)