Regression

This example walks through a complete regression workflow using DeepTab — from generating data to evaluating a trained model.

Setup

import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split

from deeptab.models import MambularRegressor

Generate data

We create a synthetic tabular dataset with 1 000 samples and 5 numeric features. The target is a continuous value derived from a linear combination of the features plus Gaussian noise.

np.random.seed(42)

n_samples, n_features = 1000, 5
X = np.random.randn(n_samples, n_features)
y = np.dot(X, np.random.randn(n_features)) + np.random.randn(n_samples)

df = pd.DataFrame(X, columns=[f"feature_{i}" for i in range(n_features)])
df["target"] = y

Split

X = df.drop(columns=["target"])
y = df["target"].values

X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.2, random_state=42
)

Train

Instantiate MambularRegressor with default hyperparameters and fit on the training split.

model = MambularRegressor()
model.fit(X_train, y_train, max_epochs=10)

Evaluate

metrics = model.evaluate(X_test, y_test)
print(metrics)

Note

Replace MambularRegressor with any other regressor from deeptab.models (e.g. ResNetRegressor, FTTransformerRegressor) without changing any other line.

Using your own data

import pandas as pd
from sklearn.model_selection import train_test_split
from deeptab.models import MambularRegressor

df = pd.read_csv("your_data.csv")
X = df.drop(columns=["target"])
y = df["target"].values

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

model = MambularRegressor()
model.fit(X_train, y_train, max_epochs=50)
print(model.evaluate(X_test, y_test))

All stable regressors

Swap MambularRegressor for any class below — no other code changes are needed:

Class

Architecture

Notes

MLPRegressor

Feedforward MLP

Fastest baseline

ResNetRegressor

Residual MLP

Better than MLP for deeper networks

FTTransformerRegressor

Feature-Tokenizer Transformer

Strong general-purpose model

TabTransformerRegressor

Transformer on categorical embeddings

Best for categorical-heavy data

SAINTRegressor

Self + intersample attention

Good for semi-supervised settings

TabMRegressor

Batch-ensembling MLP

Ensemble accuracy at low cost

TabRRegressor

Retrieval-augmented

Strong when local similarity matters

NODERegressor

Differentiable decision trees

Gradient-boosting inductive bias

NDTFRegressor

Neural decision tree forest

Use n_ensembles and max_depth

TabulaRNNRegressor

RNN / LSTM / GRU

Use model_type to select cell

MambularRegressor

Stacked Mamba SSM

Efficient sequence model

MambaTabRegressor

Single Mamba block

Lightest Mamba variant

MambAttentionRegressor

Mamba + attention hybrid

Local + global patterns

ENODERegressor

Extended NODE

NODE with feature embeddings

AutoIntRegressor

Attention-based interaction

Explicit feature crossing

Experimental regressors (ModernNCARegressor, TromptRegressor, TangosRegressor) are available from deeptab.models.experimental. See Experimental models.

Next steps