Exporting Models
Contents
Exporting Models#
This page covers how to export your NeurEco Tabular models for deployment in various formats and environments.
On this page
Export Formats Overview#
NeurEco Tabular models can be exported to multiple formats:
Native Format
Format |
Extension |
Description |
|---|---|---|
NeurEco |
|
Native format for continued work in NeurEco or Python API |
Deployment Formats (require embed license)
Format |
Extension |
Best For |
|---|---|---|
FMU |
|
Simulation environments (Simulink, Dymola, OpenModelica, etc.) |
ONNX |
|
Cross-platform deployment, ML framework integration |
C Header |
|
Embedded systems, microcontrollers, high-performance applications |
VBA |
|
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.
Save in native format:
model.save("./model/regression.ednn")
Export to FMU:
model.export_fmu("./model/regression.fmu")
Export to ONNX:
model.export_onnx("./model/regression.onnx", precision="float32")
Export to C header:
model.export_c("./model/regression.h", precision="float64")
Export to VBA:
model.export_vba("./model/regression.bas", precision="float32")
Export commands:
# Export to C
neureco Regression exportC ./model/regression.ednn ./model/regression.h float64
# Export to ONNX
neureco Regression exportONNX ./model/regression.ednn ./model/regression.onnx float32
# Export to VBA
neureco Regression exportVBA ./model/regression.ednn ./model/regression.bas float32
# Export to FMU (last argument: platform flag, 3 = Windows and Linux)
neureco Regression exportFMU ./model/regression.ednn ./model/regression.fmu 3
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:
Export model as FMU
In Simulink, add an FMU Import block
Browse and select the .fmu file
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:
Export model to .bas file
Open Excel, press Alt+F11 to open VBA editor
Import the .bas module
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 |
|---|---|---|
|
64-bit |
Maximum accuracy, scientific computing |
|
32-bit |
Good balance of accuracy and size, most applications |
|
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.
# Load a specific checkpoint model (index 5 = "Checkpoint 6" in the log and the GUI)
model = Tabular.Regressor()
model.load_model_from_checkpoint("./model/regression.checkpoint", model_index=5)
# Export it
model.export_onnx("./model/checkpoint_6.onnx", precision="float32")
Best Practices#
Choose the right format: Match the export format to your deployment environment
Test after export: Verify that the exported model produces the same results as the original
Consider precision tradeoffs: Lower precision saves memory but may affect accuracy
Keep the native format: Always save in .ednn format as a backup
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#
Convert to Keras or PyTorch for deep learning frameworks
Use advanced features for model analysis