Building Regression
Contents
Building Regression#
This page covers building Tabular Regression models for predicting continuous numerical values.
On this page
When to Use Regression#
Use the Regression template when:
Your outputs are continuous numerical values (not categories)
You want to predict quantities like temperature, energy, cost, etc.
You’re approximating a function from inputs to outputs
Building a Regression Model#
1. Create a new project
Launch NeurEco GUI and select Tabular Regression.
2. Configure settings
In the Settings tab:
Training data: Select your input and output files
Validation percentage: Adjust if needed (default: 33.33%)
Normalization: Configure input/output normalization
GPU: Enable if available for faster training
3. Start the build
Click the BUILD button. NeurEco will:
Display training progress in the Training panel
Save checkpoints periodically
Enable Evaluation, Metrics, and Export panels once the first checkpoint is saved
4. Monitor progress
Watch the training metrics. The build automatically stops when optimal accuracy is reached.
1. Import and prepare data
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)) # Ensure 2D shape
2. Create the model
model = Tabular.Regressor()
3. Configure and build
config = Tabular.RegressorBuildConfig(
# Required: Data
input_data=x_train,
output_data=y_train,
# Required: Output paths
write_model_to="./model/regression.ednn",
checkpoint_address="./model/regression.checkpoint",
# Optional: Validation
valid_percentage=33.33,
# Optional: Normalization
inputs_shifting="min_centered",
inputs_scaling="max_centered",
inputs_normalize_per_feature=True,
outputs_shifting="auto",
outputs_scaling="auto",
outputs_normalize_per_feature=False,
# Optional: GPU
use_gpu=False,
gpu_id=0,
)
model.build(config)
4. Save the model
The model is automatically saved to the path specified in write_model_to.
1. Create a configuration file
Create build_regression.conf:
{
"neurecoRegression_build": {
"DevSettings": {
"disconnect_inputs_if_possible": true,
"final_learning": true,
"initial_beta_reg": 0.1,
"valid_percentage": 33.33
},
"UserSettings": {
"gpu_id": 0,
"use_gpu": false
},
"checkpoint_address": "./model/regression.checkpoint",
"exc_filenames": ["x_train.csv"],
"output_filenames": ["y_train.csv"],
"input_normalization": {
"normalize_per_feature": true,
"scale_type": "max_centered",
"shift_type": "min_centered"
},
"output_normalization": {
"normalize_per_feature": false,
"scale_type": "auto",
"shift_type": "auto"
},
"write_model_to": "./model/regression.ednn"
}
}
2. Run the build
neureco Regression build build_regression.conf
Regression-Specific Parameters#
While Regression uses all the common build parameters, these settings are particularly important:
Output Normalization
For regression problems:
outputs_normalize_per_feature=Falseis typically recommended when outputs represent the same type of quantitySet to
Trueif predicting different types of outputs (e.g., temperature and pressure simultaneously)
Field Output
If your outputs represent a spatial field (e.g., values at grid points):
Set
field_output=TrueThis tells NeurEco to treat outputs as related spatial values
field_output is not the same as outputs_normalize_per_feature: one flags
the outputs as a field, the other controls how they are normalized. See
Field Output vs. Per-Feature Normalization for the distinction (a field output requires
field_output=True with outputs_normalize_per_feature=False).
Complete Parameter Reference#
Parameter |
Default |
Description |
|---|---|---|
|
Required |
Training inputs (array or file path) |
|
Required |
Training outputs (array or file path) |
|
Required |
Output path for model (.ednn) |
|
None |
Path for checkpoints |
|
33.33 |
Validation split percentage |
|
None |
Separate validation inputs |
|
None |
Separate validation outputs |
|
None |
Test set inputs |
|
None |
Test set outputs |
|
“auto” |
Input shift method |
|
“auto” |
Input scale method |
|
True |
Per-feature input normalization |
|
“auto” |
Output shift method |
|
“auto” |
Output scale method |
|
False |
Per-feature output normalization |
|
0.1 |
Initial regularization coefficient (see The Regularization Coefficient) |
|
True |
Final pruning, a last pass that disconnects unused inputs (if |
|
True |
Allow pruning of the links from the inputs at every structure change and, when |
|
0 |
Max network connections (0=unlimited) |
|
False |
Flag the outputs as a single physical field (distinct from |
|
False |
Enable GPU acceleration |
|
0 |
GPU device ID |
Example: Energy Consumption#
Here’s a complete example predicting energy consumption:
from NeurEco import NeurEcoTabular as Tabular
import numpy as np
# Load the Energy Consumption dataset
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 the 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,
)
model.build(config)
# Evaluate on test data
predictions = model.evaluate(x_test)
error = model.compute_error(predictions, y_test)
print(f"Test error: {error}")
# Clean up
model.delete()
Next Steps#
See advanced features for sensitivity analysis and more