Energy Consumption
Contents
Energy Consumption#
This example demonstrates Tabular Regression using the Energy Consumption dataset.
On this page
Problem Description#
Goal: Predict the energy consumption of a house based on environmental factors.
Input Features (5):
Temperature difference (inside vs. outside)
Wind direction
Wind speed
Sunshine intensity
Relative humidity
Output (1):
Energy consumption
Dataset#
The dataset is split into training and test sets:
x_train.csv— Training inputs (5 features)y_train.csv— Training outputs (energy consumption)x_test.csv— Test inputsy_test.csv— Test outputs (for evaluation)
Note
These files ship in the EnergyConsumption example folder of the NeurEco
installation (see Examples for the location). Extract that folder and run
the commands below from inside it so the relative paths resolve.
Building the Model#
Launch NeurEco and select Tabular Regression
Load
x_train.csvas input andy_train.csvas outputOptionally load test files for automatic evaluation
Click BUILD
Monitor training progress
Once complete, evaluate and export
from NeurEco import NeurEcoTabular as Tabular
import numpy as np
# Load data
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))
# Create and build model
model = Tabular.Regressor()
config = Tabular.RegressorBuildConfig(
input_data=x_train,
output_data=y_train,
write_model_to="./energy_model/energy.ednn",
checkpoint_address="./energy_model/energy.checkpoint",
valid_percentage=33.33,
inputs_shifting="min_centered",
inputs_scaling="max_centered",
)
model.build(config)
# Evaluate
predictions = model.evaluate(x_test)
l2_error = np.sqrt(np.sum((predictions - y_test) ** 2) / np.sum(y_test ** 2))
print(f"L2 Relative Error: {l2_error:.6f}")
# Export
model.export_onnx("./energy_model/energy.onnx", precision="float32")
# Cleanup
model.delete()
Create build_energy.conf:
{
"neurecoRegression_build": {
"DevSettings": {
"valid_percentage": 33.33
},
"exc_filenames": ["x_train.csv"],
"output_filenames": ["y_train.csv"],
"test_exc_filenames": ["x_test.csv"],
"test_output_filenames": ["y_test.csv"],
"input_normalization": {
"shift_type": "min_centered",
"scale_type": "max_centered",
"normalize_per_feature": true
},
"output_normalization": {
"shift_type": "auto",
"scale_type": "auto",
"normalize_per_feature": true
},
"write_model_to": "./energy_model/energy.ednn",
"checkpoint_address": "./energy_model/energy.checkpoint"
}
}
Run:
neureco Regression build build_energy.conf
Expected Results#
After training, you should observe:
Small, parsimonious network
Quick training — Usually completes within minutes
Key Takeaways#
This example demonstrates:
Data efficiency — NeurEco achieves good results with modest training data
Automatic architecture — No need to manually design the network
Checkpoint availability — Multiple models saved during training
Easy export — One command to export for deployment
Variations to Try#
Adjust
valid_percentageto see its effect on model selectionTry different normalization settings
Limit model size with
links_maximum_numberCompare different checkpoints’ performance on test data