CLI Reference
Contents
CLI Reference#
Complete reference for the NeurEco command-line interface (CLI).
On this page
Overview#
The neureco command builds and evaluates models from JSON configuration files,
and exports models to other formats:
neureco <Template> build <configuration file>
neureco <Template> evaluate <configuration file>
neureco <Template> <export command> <model file> <output file> <option>
Templates:
Template |
Model |
Model file |
|---|---|---|
|
Tabular regression |
|
|
Tabular classification |
|
|
Tabular compression |
|
|
Parametric Frequency Sweep |
|
|
Dynamic ODE |
|
|
Convolutional Dynamic |
|
Template names are not case-sensitive, and ConvolutionalDynamic is accepted as
well as ConvolutiveDynamic. The backend names of earlier releases (DNN,
FNN, RNN and CNN) are also accepted, see Backend Names.
Commands:
Command |
Templates |
|---|---|
|
All templates: train a model |
|
All templates: run a model on data files |
|
Regression, Classification, Compression |
|
All templates |
Help and license:
neureco -hlists the templates and their commands.neureco <Template> -hlists the commands of one template, andneureco <Template> -vprints the version of its backend.neureco hardwareinfoasks for your contact details and writeshardware_info.txt, the file that Adagos needs to create your license, to the current folder. The desktop app writes the same file from Help > Hardware id generator (see Licensing).
Quick Start#
In a folder that holds x_train.csv, y_train.csv, x_test.csv and
y_test.csv (for example the folder where you extracted the example
EnergyConsumption.zip, see Tabular examples), write
the Tabular build configuration to build.conf and the
Tabular evaluate configuration to eval.conf, then
run:
# Build a regression model
neureco Regression build build.conf
# Evaluate it on the test data
neureco Regression evaluate eval.conf
# Export it to ONNX
neureco Regression exportONNX ./model/regressor.ednn ./model/regressor.onnx float32
Configuration Files#
A configuration file is a JSON object with one root key,
neureco<Template>_<command>, that holds the settings:
{
"neurecoRegression_build": {
"exc_filenames": ["x_train.csv"],
"output_filenames": ["y_train.csv"]
}
}
Root keys:
Template |
|
|
|---|---|---|
Regression |
|
|
Classification |
|
|
Compression |
|
|
PFS |
|
|
ODE |
|
|
Convolutional Dynamic |
|
|
The export commands take their arguments on the command line and need no configuration file.
Rules:
Use the same template in the command and in the root key, for example
neureco ODE buildwithneurecoODE_build. Otherwiseneurecostops with an error that names both.The Tabular root keys select the mode, so
classificationandbuild_compressneed not be set. A file that also sets one of them against its root key (for example"classification": falseunderneurecoClassification_build) is rejected with an error.neurecoConvolutionalDynamic_buildandneurecoConvolutionalDynamic_evaluateare accepted as well.Relative paths are relative to the folder that contains the configuration file, not to the folder where the command runs.
NeurEco ignores the fields it does not know, so a misspelled field name silently keeps the default value. Check each field name against the tables below.
Backend Names#
Earlier releases name the backend instead of the template, in the command and in the root key. These names still work, and the tutorial configuration files use them:
Backend |
Templates |
Root keys |
|---|---|---|
|
Regression, Classification, Compression |
|
|
PFS |
|
|
ODE |
|
|
Convolutional Dynamic |
|
For example, neureco DNN build build.conf with a neurecoDNN_build root key
builds a Tabular model. With neurecoDNN_build, the mode comes from two fields:
"classification": true for a classification, "build_compress": true for a
compression, and neither for a regression.
Tabular Configuration#
Build Configuration#
Root keys: neurecoRegression_build, neurecoClassification_build or
neurecoCompression_build
{
"neurecoRegression_build": {
"exc_filenames": ["x_train.csv"],
"output_filenames": ["y_train.csv"],
"test_exc_filenames": ["x_test.csv"],
"test_output_filenames": ["y_test.csv"],
"DevSettings": {
"valid_percentage": 33.33,
"parameter_number_limit": 0,
"initial_beta_reg": 0.1,
"final_learning": true,
"disconnect_inputs_if_possible": true
},
"UserSettings": {
"use_gpu": false,
"gpu_id": 0
},
"input_normalization": {
"shift_type": "auto",
"scale_type": "auto",
"normalize_per_feature": true
},
"output_normalization": {
"shift_type": "auto",
"scale_type": "auto",
"normalize_per_feature": false
},
"write_model_to": "./model/regressor.ednn",
"checkpoint_address": "./model/regressor.checkpoint",
"write_model_output_to_directory": "./model/BuildingResults"
}
}
For a classification, use neurecoClassification_build and one-hot encoded
output files. For a compression, use neurecoCompression_build, leave out the
output files and add the compression fields below.
Parameters:
Parameter |
Description |
|---|---|
|
List of training input files |
|
List of training output files, one per input file (not used by Compression) |
|
List of validation input files (optional). When set, |
|
List of validation output files (optional) |
|
List of test input files (optional; monitored during the build, never used for training) |
|
List of test output files (optional) |
|
Path of the final model ( |
|
Path of the checkpoint file written during the build |
|
Folder for the output files of the build |
|
Percentage of the training data kept for validation when no validation files are given |
|
Maximum number of links in the network ( |
|
Initial regularization coefficient (see The Regularization Coefficient) |
|
|
|
|
|
Build on a GPU, and the id of the GPU to use |
|
|
|
|
|
|
|
Same three fields, for the outputs |
|
|
Compression parameters:
Parameter |
Description |
|---|---|
|
Path of the compressor (encoder) model |
|
Path of the decompressor (decoder) model |
|
Maximum acceptable relative reconstruction error |
|
Minimum number of compression coefficients |
|
Ratio of the compressor size to the decompressor size, in (0, 1] |
Resume parameters:
Parameter |
Description |
|---|---|
|
|
|
Start the build from a model of this checkpoint (or from this |
|
Index of that model in the checkpoint, from 0 ( |
|
|
Evaluate Configuration#
Root keys: neurecoRegression_evaluate, neurecoClassification_evaluate
or neurecoCompression_evaluate
{
"neurecoRegression_evaluate": {
"neureco_filename": "./model/regressor.ednn",
"exc_filenames": ["x_test.csv"],
"optional_output_reference": ["y_test.csv"],
"write_model_output_to_directory": "./EvaluationResults"
}
}
Parameter |
Description |
|---|---|
|
The model to evaluate: an |
|
With a checkpoint file: index of the model, from 0 ( |
|
List of input files to evaluate |
|
List of reference output files, one per input file (optional) |
|
Folder for the predictions: one |
|
Format of the prediction files: |
Export Commands#
neureco Regression exportC ./model/regressor.ednn ./model/regressor.h float64
neureco Regression exportONNX ./model/regressor.ednn ./model/regressor.onnx float32
neureco Regression exportVBA ./model/regressor.ednn ./model/regressor.bas float32
neureco Regression exportFMU ./model/regressor.ednn ./model/regressor.fmu 3
The third argument is the precision: float64 or float32, and also
float16 for ONNX. exportFMU takes a platform flag instead: use 3
(Windows and Linux). Exporting requires an embed license.
PFS Configuration#
Build Configuration#
Root key: neurecoPFS_build
{
"neurecoPFS_build": {
"input_filenames": ["inputs_train.npy"],
"output_filenames": ["targets_train.npy"],
"validation_input_filenames": ["inputs_valid.npy"],
"validation_output_filenames": ["targets_valid.npy"],
"test_input_filenames": ["inputs_test.npy"],
"test_output_filenames": ["targets_test.npy"],
"settings": {
"validation_percentage": 30,
"compressed_space_size": 5,
"min_number_of_enrichments": 10,
"max_number_of_enrichments": 200,
"unsuccessful_enrichments": 4,
"enrichment_rate": 0.2
},
"write_model_to": "./model/pfs_model.efnn",
"checkpoint_address": "./model/pfs_model.checkpoint",
"write_model_output_to_directory": "./model/BuildingResults"
}
}
PFS parameters:
Parameter |
Description |
|---|---|
|
Lists of training input and output files |
|
Lists of validation files (optional) |
|
Lists of test files (optional) |
|
Percentage of the training data kept for validation when no validation files are given |
|
Dimension of the compressed output space ( |
|
Minimum number of enrichment steps ( |
|
Maximum number of enrichment steps ( |
|
Unsuccessful enrichment steps before the build stops ( |
|
Parameter addition rate, in (0, 1] |
|
|
Evaluate Configuration#
Root key: neurecoPFS_evaluate
{
"neurecoPFS_evaluate": {
"neureco_filename": "./model/pfs_model.efnn",
"input_filenames": ["inputs_test.npy"],
"write_model_output_to_directory": "./EvaluationResults"
}
}
neureco_filename is the model, input_filenames the list of input files, and
the predictions are written to write_model_output_to_directory.
Export Command#
neureco PFS exportFMU ./model/pfs_model.efnn ./model/pfs_model.fmu 3
The last argument is the platform flag: use 3 (Windows and Linux).
Dynamic Configuration#
For both Dynamic templates, the first column of every input and output file is the
time (see Data Preparation). The examples below use the file layout
of the example NonLinearOscillator.zip (one excitation, one output), so they run
in the folder where you extract it.
ODE Build Configuration#
Root key: neurecoODE_build
{
"neurecoODE_build": {
"exc_filenames": [
"data/train/train_exc_1.csv",
"data/train/train_exc_2.csv"
],
"output_filenames": [
"data/train/train_out_1.csv",
"data/train/train_out_2.csv"
],
"validation_exc_filenames": ["data/valid/valid_exc_1.csv"],
"validation_output_filenames": ["data/valid/valid_out_1.csv"],
"test_exc_filenames": ["data/test/test_exc_1.csv"],
"test_output_filenames": ["data/test/test_out_1.csv"],
"settings": {
"valid_percentage": 30,
"min_hidden_states": 1,
"max_hidden_states": 3,
"steady_state_exc": [0.0],
"steady_state_out": [0.0],
"input_normalization": {
"shift_type": "mean",
"scale_type": "l2",
"normalize_per_feature": true
},
"output_normalization": {
"shift_type": "mean",
"scale_type": "l2",
"normalize_per_feature": true
}
},
"write_model_to": "./model/ode_model.ernn",
"checkpoint_address": "./model/ode_model.checkpoint",
"write_model_output_to_directory": "./model/BuildingResults"
}
}
ODE parameters:
Parameter |
Description |
|---|---|
|
Lists of training excitation (input) and output files, one output file per excitation file |
|
Lists of validation files (optional) |
|
Lists of test files (optional) |
|
Percentage of the training data kept for validation when no validation files are given |
|
Minimum number of hidden states |
|
Maximum number of hidden states ( |
|
Steady-state excitation values, one per excitation, for example |
|
Steady-state output values, one per output (optional; set both or neither) |
|
|
|
|
The normalization and the steady state sit inside settings.
ODE Evaluate Configuration#
Root key: neurecoODE_evaluate
{
"neurecoODE_evaluate": {
"ernn_filename": "./model/ode_model.ernn",
"exc_filenames": ["data/test/test_exc_1.csv"],
"write_model_output_to_directory": "./EvaluationResults"
}
}
ernn_filename is the model, exc_filenames the list of excitation files to
evaluate, and the predictions are written to write_model_output_to_directory.
Each evaluation uses the steady-state initialization described in
Evaluating ODE Models.
Convolutional Dynamic Build Configuration#
Root key: neurecoConvolutiveDynamic_build
{
"neurecoConvolutiveDynamic_build": {
"data": {
"training": {
"inputs": [
"data/train/train_exc_1.csv",
"data/train/train_exc_2.csv"
],
"targets": [
"data/train/train_out_1.csv",
"data/train/train_out_2.csv"
]
},
"validation": {
"inputs": ["data/valid/valid_exc_1.csv"],
"targets": ["data/valid/valid_out_1.csv"]
},
"test": {
"inputs": ["data/test/test_exc_1.csv"],
"targets": ["data/test/test_out_1.csv"]
},
"validation_percentage": 30
},
"normalizers": {
"inputs": {
"shift_type": "min",
"scale_type": "minmax",
"normalize_per_feature": true
},
"targets": {
"shift_type": "min",
"scale_type": "minmax",
"normalize_per_feature": true
}
},
"settings": {
"window_size": 32,
"window_stride": 1,
"hidden_layer_number": 2,
"layer_multiplier": 2.0,
"last_layer_grid_number": 0,
"tol_last_layer": 0.1,
"activation_function": "Tanh",
"padding_mode": "CONSTANT",
"padding_value": 0.0,
"use_gpu": false,
"gpu_id": 0
},
"write_model_to": "./model/cnn_model.ecnn",
"checkpoint_address": "./model/cnn_model.checkpoint",
"write_model_output_to_directory": "./model/BuildingResults",
"resume": false
}
}
The layout differs from the ODE file: the data files sit under data, as
inputs (excitations) and targets (outputs) of the training,
validation and test sets, and the normalization sits under normalizers.
Convolutional Dynamic parameters:
Parameter |
Description |
|---|---|
|
Lists of training excitation and output files |
|
Validation and test files, same layout (optional) |
|
Percentage of the training data kept for validation when no validation files are given |
|
|
|
Window size (at least 3) and training window stride (see Window Size and Stride) |
|
Convolutional network settings (see Building Convolutional Dynamic Models) |
|
Activation function and padding of the convolutional layers |
|
Build on a GPU, and the id of the GPU to use |
|
|
Convolutional Dynamic Evaluate Configuration#
Root key: neurecoConvolutiveDynamic_evaluate
{
"neurecoConvolutiveDynamic_evaluate": {
"ecnn_filename": "./model/cnn_model.ecnn",
"exc_filenames": ["data/test/test_exc_1.csv"],
"write_model_output_to_directory": "./model",
"model_output_format": "csv"
}
}
ecnn_filename is the model and exc_filenames the list of excitation files to
evaluate. The predictions are written to write_model_output_to_directory as
<input name>_ecnn files, in the model_output_format format ("npy" by
default, or "csv"). This folder is created if it does not exist.
Export Commands (Dynamic)#
neureco ODE exportFMU ./model/ode_model.ernn ./model/ode_model.fmu 3
neureco ConvolutiveDynamic exportFMU ./model/cnn_model.ecnn ./model/cnn_model.fmu 3
The last argument is the platform flag: use 3 (Windows and Linux).
File Formats#
Supported data file formats:
CSV: comma or semicolon delimited (
.csv)NumPy: binary array format (
.npy)MATLAB: MAT-files (
.mat)
CSV Format#
feature1;feature2;feature3
1.0;2.0;3.0
4.0;5.0;6.0
7.0;8.0;9.0
The first row can be a header (optional)
Delimiter:
;or,
Complex Values in CSV (PFS)#
For PFS output files, complex numbers can be written as:
0.1+0.2j(0.1+0.2j)(0.1,0.2)
Troubleshooting#
Common Issues#
“File not found” error:
Check that the file paths are correct
Use forward slashes (
/) or escaped backslashes (\\)Relative paths are relative to the folder of the configuration file
Configuration error:
Verify the JSON syntax (use a JSON validator)
Check that the root key matches the template and the command
Check the spelling of every field name: unknown fields are ignored
“Shape mismatch” error:
Input and output files must have the same number of samples
Check that the data dimensions match the model