Exporting Models#

This page covers how to export your NeurEco Tabular models for deployment in various formats and environments.

Export Formats Overview#

NeurEco Tabular models can be exported to multiple formats:

Native Format

Format

Extension

Description

NeurEco

.ednn

Native format for continued work in NeurEco or Python API

Deployment Formats (require embed license)

Format

Extension

Best For

FMU

.fmu

Simulation environments (Simulink, Dymola, OpenModelica, etc.)

ONNX

.onnx

Cross-platform deployment, ML framework integration

C Header

.h

Embedded systems, microcontrollers, high-performance applications

VBA

.bas

Microsoft Excel integration

Export Workflow#

1. Access the Export panel

Switch to the Export tab in NeurEco GUI.

2. Select checkpoint (optional)

Use the checkpoint slider to choose which model to export (default: final model).

3. Choose export format

Click the button for your desired format:

  • Save — NeurEco native format (.ednn)

  • FMU — Functional Mock-up Unit

  • ONNX — Open Neural Network Exchange

  • C — C header file

  • VBA — Visual Basic for Applications

4. Select precision (if applicable)

For some formats, choose the numerical precision:

  • float64 — 64-bit (highest accuracy)

  • float32 — 32-bit (good balance)

  • float16 — 16-bit (smallest size)

5. Specify output path

Choose the destination filename and location.

Format Details#

Native NeurEco Format (.ednn)#

The native format preserves all model information and is used for:

  • Continued work in NeurEco

  • Python API integration

  • Re-exporting to other formats later

# Save
model.save("model.ednn")

# Load later
model = Tabular.Regressor()
model.load("model.ednn")

FMU (Functional Mock-up Unit)#

FMU is a standard for exchanging simulation models. Use it with:

  • MATLAB/Simulink

  • Dymola

  • OpenModelica

  • AMESim

  • Other FMI-compatible tools

The exported FMU contains the neural network as a self-contained simulation component.

Usage in Simulink:

  1. Export model as FMU

  2. In Simulink, add an FMU Import block

  3. Browse and select the .fmu file

  4. Connect inputs and outputs

ONNX (Open Neural Network Exchange)#

ONNX is an open format for ML models, enabling interoperability with:

  • TensorFlow

  • PyTorch

  • ONNX Runtime

  • Many other frameworks

Using the ONNX model (with ONNX Runtime; install it with pip install onnxruntime if needed):

import onnxruntime as ort
import numpy as np

# Load the ONNX model
session = ort.InferenceSession("model.onnx")

# Get input name
input_name = session.get_inputs()[0].name

# Run inference
x_test = np.array([[1.0, 2.0, 3.0]], dtype=np.float32)
result = session.run(None, {input_name: x_test})
print(result[0])

C Header File#

The C export produces a standalone header file containing:

  • Network weights and biases

  • Inference function

  • No external dependencies

Using the C header:

#include "model.h"

int main() {
    double inputs[5] = {1.0, 2.0, 3.0, 4.0, 5.0};
    double outputs[1];

    // Run inference
    neureco_evaluate(inputs, outputs);

    printf("Prediction: %f\n", outputs[0]);
    return 0;
}

This is ideal for:

  • Microcontrollers (Arduino, STM32, etc.)

  • Embedded systems

  • Real-time applications

  • Environments without Python

VBA (Visual Basic for Applications)#

VBA export enables using NeurEco models directly in Microsoft Excel.

Using in Excel:

  1. Export model to .bas file

  2. Open Excel, press Alt+F11 to open VBA editor

  3. Import the .bas module

  4. Use the function in your spreadsheet:

=NeurEcoPredict(A1, B1, C1, D1, E1)

Precision Options#

When exporting, you can choose numerical precision:

Precision

Bits

Use Case

float64

64-bit

Maximum accuracy, scientific computing

float32

32-bit

Good balance of accuracy and size, most applications

float16

16-bit

Memory-constrained devices, when slight accuracy loss is acceptable

Recommendation: Start with float32 for most applications. Use float64 only if you observe precision issues, and float16 only when memory is critical.

Note

The legacy names float and double remain accepted as aliases for float32 and float64 in the Python API, the CLI and configuration files, so existing scripts keep working.

Exporting Compression Models#

Compression models produce three separate files:

# During build, specify all three output paths
config = Tabular.CompressorBuildConfig(
    input_data=x_train,
    write_model_to="./model/complete.ednn",           # Full pipeline
    write_compression_model_to="./model/encoder.ednn",    # Encoder only
    write_decompression_model_to="./model/decoder.ednn",  # Decoder only
)

Each can be exported independently:

# Export encoder for embedded device
encoder = Tabular.Compressor()
encoder.load("./model/encoder.ednn")
encoder.export_c("./embedded/encoder.h", precision="float32")

# Export decoder for server
decoder = Tabular.Compressor()
decoder.load("./model/decoder.ednn")
decoder.export_onnx("./server/decoder.onnx", precision="float32")

Exporting from Checkpoints#

You can export any model from the checkpoint history:

Use the checkpoint slider to select the model, then export normally.

Best Practices#

  1. Choose the right format: Match the export format to your deployment environment

  2. Test after export: Verify that the exported model produces the same results as the original

  3. Consider precision tradeoffs: Lower precision saves memory but may affect accuracy

  4. Keep the native format: Always save in .ednn format as a backup

  5. Document model inputs/outputs: Keep track of input feature order and scaling

Verifying Exported Models#

After exporting, verify the model works correctly:

import onnxruntime as ort
import numpy as np

# Original NeurEco evaluation
original_output = model.evaluate(x_test)

# ONNX evaluation
session = ort.InferenceSession("model.onnx")
input_name = session.get_inputs()[0].name
onnx_output = session.run(None, {input_name: x_test.astype(np.float32)})[0]

# Compare
max_diff = np.max(np.abs(original_output - onnx_output))
print(f"Maximum difference: {max_diff}")

if max_diff < 1e-5:
    print("Export verification: PASSED")
else:
    print("Export verification: Check precision settings")

Next Steps#