Skip to main content

The unified framework for interpretable, physics-informed, and high-performance time series forecasting.

Project description

TAM (Time series Additive Model)

🧪 EXAMPLES | 📚 THEORY | 📄 JOSS PAPER

PyPI Version Powered by PyTorch CI Pipeline License: LGPL Python 3.10+ GitHub Repo stars DOI: TAM

The unified framework for interpretable, physics-informed, and high-performance time series forecasting.

TAM gives you the transparency of standard statistical models (like linear regression and splines) with the raw processing power and scale of deep learning. Build your model using simple formula syntax, and our engine will resolve it efficiently on modern GPU architectures via PyTorch, featuring a glass-box architecture with isolated, interpretable components, robust memory management, and exact mathematical resolution.


🎯 Statement of Need (Why TAM?)

Traditional Generalized Additive Models (GAMs) are strictly bound by CPU limits, making them computationally intractable for massive datasets and highly complex feature topologies. Furthermore, exact dual kernel methods like Gaussian Processes suffer from a temporal scaling bottleneck, preventing them from handling long, high-frequency time series.

TAM bridges the gap between classical statistics and modern tensor algebra. By solving a global convex optimization problem strictly in the Primal space, TAM completely bypasses the dual inversion bottleneck. To prevent Out-Of-Memory (OOM) crashes on extreme scales, TAM's hardware-aware dispatcher protects the system on two fronts: it utilizes Group-Chunking to safely process infinite data volumes, and automatically routes massive feature spaces to a matrix-free Sparse Conjugate Gradient solver. This allows researchers to scale interpretable learning directly within GPU/CPU caches.


⚙️ Stable Framework (v1.2+)

These modules form the mathematically proven, production-ready core of the framework, designed for robust industrial deployment and evaluated for JOSS:

  • Machine Learning for Time Series: TAM projects a matrix of exogenous features into a finite-dimensional space via basis mappings against a target.

  • Core (StaticTAM): Fits the optimal linear model via primal resolution, with optional joint tuning of:

    • the ridge penalty $\lambda$ using Generalized Cross-Validation (GCV),
    • other hyperparameters via Multi-Start Coordinate Descent.
  • Adaptive (AdaptiveTAM): Corrects residuals in real-time using parallel sliding-windows to handle concept drift.

  • Expertise (OperaTAM): Aggregates external expert models dynamically with mathematical regret bounds.

  • Evaluation (BenchmarkTracker): Tracks temporal degradation, calculates NaN-safe metrics, and analyzes residual autocorrelation.


🔬 Experimental Research Lab (BETA / EXP)

We actively collaborate with the academic community to push the boundaries of TAMs. These modules are under active theoretical development:

  • Physics-Informed (UniversalPhysicsEffect) (BETA): Embeds physical laws (ODEs/PDEs) directly into the model as analytical regularization constraints.
  • Dynamic (KalmanTAM) (BETA): Tracks evolving behaviors and coefficients over time via an Extended Kalman Filter.
  • Hierarchy (HierarchicalTAM) (BETA): Optimizes parent/child series simultaneously in the Primal space (National = Sum of Regions).
  • AutoML (AutoTAM) (EXP): Evolutionary Search to discover optimal GAM topologies using successive halving & parsimony pruning.
  • Hybrid (NeuralTAM) (EXP): Integrates Deep Neural Networks via orthogonal residual backfitting to capture extreme non-linearities.
  • Safety (SafetyTAM) (EXP): Provides statistically guaranteed confidence intervals via Adaptive Conformal Inference (ACI).

🏗️ System Architecture Overview

The modern architecture (v1.2.1+) is divided into four distinct tiers: Data Ingestion & Preprocessing, the Core Engine, the Meta-Learner Orchestrators, and Output Management.

Architecture Diagram

Raw data flows through dynamic normalizers before being processed by the StaticTAM core. The outputs can then be wrapped by advanced Meta-Learners (like AdaptiveTAM or OperaTAM) to handle real-world constraints like data drift, risk bounds, multi-level aggregation, and stochastic state tracking.


🛠️ Installation

pip install tam-ml

⚠️ Hardware Note: TAM relies heavily on PyTorch for VRAM management and tensor acceleration. Ensure you have installed the correct PyTorch distribution (CUDA for NVIDIA, or MPS for Apple Silicon) for your specific hardware to fully leverage the framework's GPU capabilities.


🧩 The Dictionary of Effects

TAM is designed as a framework where you build models by summing generic "Effects".

To understand the deep mathematical behavior of the framework, click on any effect to read its complete theoretical documentation (including its mapping function and structural penalty): Linear / Fourier / Spline / Chebyshev / Categorical / Interaction / RBF / Neural / Tree / Linear Tree / Wavelet / PID / Physics (BETA)


🚀 Quick Start

Fit a standard interpretable model on historical data using an R-style formula syntax.

💡For Scikit-Learn Users: You do not need to manually split your target y and feature matrix X. The framework parses the formula string to dynamically extract the target and build the tensor matrices directly from your Pandas DataFrame.

import pandas as pd
import numpy as np
import tam as ta
from importlib import resources

# 1. Load Data
df = pd.read_csv(resources.files('tam.data').joinpath('airpassengers.csv')).dropna().copy()
df['date'] = pd.to_datetime(df['date'])
d_dict = {'train': df.iloc[:-24], 'test': df.iloc[-24:]}

# 2. Define competing architectures via formulas
f1 = "log_passengers ~ c(month, topo='fourier', ap=-8.0) + l(lag_log_passengers, ap=-30.0)"
f2 = "log_passengers ~ n(month) + l(lag_log_passengers, ap=-30.0)"

# 3. Fit and predict standard models
df['E1'] = ta.StaticTAM(formula=f1, date_col="date").fit(d_dict['train']).predict(df)["Estimatedlog_passengers"].values
df['E2'] = ta.StaticTAM(formula=f2, date_col="date").fit(d_dict['train']).predict(df)["Estimatedlog_passengers"].values

# 4. Dynamically aggregate experts using OperaTAM
opera = ta.OperaTAM("log_passengers ~ l(E1) + l(E2)", algorithm='MLPOL', date_col='date', horizon_steps=12)
df['OPERA'] = opera.predict_online(df)['prediction_opera'].values

# Option B (Production): Train on history, apply frozen weights to the future
# opera.fit(d_dict['train'])
# test_predictions = opera.predict(d_dict['test'])

# 5. Evaluate and plot
for name, col in [("Expert 1", "E1"), ("Expert 2", "E2"), ("OPERA", "OPERA")]:
    tr = ta.BenchmarkTracker(name)
    tr.y_pred_full = np.exp(df[col].values)
    tr.slice_and_evaluate(d_dict, target_col='value')
    print(f"[{name}] Test MAPE: {tr.get_metric('test', 'MAPE'):.2f}%")

opera.plot_weights(df=df)

📂 Project Structure & Documentation

  • src/tam/ - 🐍 SOURCE CODE
  • math/ - 🧠 THE "WHY": Mathematical theory, theorems, and RKHS equations.
  • architecture/ - 💻 THE "HOW": PyTorch OOP, VRAM management, and code extraction.

Read the full documentation:


👥 Project & Community


Citation

If you use these packages in your research, please cite them using their permanent archives:

TAM

@misc{tam2026package,
  title={TAM: Time series Additive Model (v1.2.3)},
  author={Allioux, Yann and Doumeche, Nathan and Bedek, Eloi},
  year={2026},
  doi={10.5281/zenodo.20543272}
}

🐛 Issues & Support

  • Found a bug or VRAM leak? Please open an Issue on our repository with a minimal reproducible example.
  • Have a question about the math? Check the 📚 THEORY manual or start a Discussion.

Status Flags

  • (BETA): Active research module. Mostly functional but not fully validated.
  • (EXP): Experimental or incomplete. May not function reliably.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tam_ml-1.2.5.tar.gz (11.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tam_ml-1.2.5-py3-none-any.whl (11.6 MB view details)

Uploaded Python 3

File details

Details for the file tam_ml-1.2.5.tar.gz.

File metadata

  • Download URL: tam_ml-1.2.5.tar.gz
  • Upload date:
  • Size: 11.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tam_ml-1.2.5.tar.gz
Algorithm Hash digest
SHA256 38e29a77bc13697b89da5e58a621ebef94c88f898617e9b25e73ae99535c2164
MD5 928594a0f761fec51d0834b5aed7da50
BLAKE2b-256 330d045623182cc0b00fc4731bd75216277b86119c81f62a7cb9a30c5da7f916

See more details on using hashes here.

Provenance

The following attestation bundles were made for tam_ml-1.2.5.tar.gz:

Publisher: publish.yml on EDF-Lab/tam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tam_ml-1.2.5-py3-none-any.whl.

File metadata

  • Download URL: tam_ml-1.2.5-py3-none-any.whl
  • Upload date:
  • Size: 11.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tam_ml-1.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 199c4449081efb69ed66c228230fd3191e0b1cfc63266b888e30f32b9fd8e821
MD5 c5e20b31672bc3df137e5e8d3f78cc4b
BLAKE2b-256 ae2f56486049f64f7a9d848f6257e7ce0f01d5a7f4ae8b81a4915ebe6de35210

See more details on using hashes here.

Provenance

The following attestation bundles were made for tam_ml-1.2.5-py3-none-any.whl:

Publisher: publish.yml on EDF-Lab/tam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page