Skip to main content

Zero-config time series forecasting & analysis library. Pure numpy + scipy implementation with 30+ models, regression, and adaptive intelligence.

Project description


Vectrix — Navigate the Vector Space of Time

Pure Python Time Series Forecasting Engine

Dependencies Pure Python No Compiled Extensions

PyPI Python License Tests


Quick Start · Models · Installation · Usage · Benchmarks · API Reference · 한국어


◈ What is Vectrix?

Vectrix is a time series forecasting library that runs on 3 dependencies (NumPy, SciPy, Pandas) with no compiled extensions. No C compiler, no cmdstan, no system packages — pip install and it works.

Forecasting

Pass a list, DataFrame, or CSV path to forecast(). Vectrix runs multiple models (ETS, ARIMA, Theta, TBATS, CES, MSTL), evaluates each with cross-validation, and returns the best prediction with confidence intervals. You don't choose a model — it does.

from vectrix import forecast
result = forecast("sales.csv", steps=12)

Flat-Line Defense

A common failure mode in automated forecasting is flat predictions — the model outputs a constant line. Vectrix has a 4-level detection and correction system that catches this and falls back to a model that actually captures the signal.

Forecast DNA

Before fitting any model, Vectrix profiles your data with 65+ statistical features (trend strength, seasonality strength, entropy, spectral density, etc.) and uses them to recommend which models are likely to work best.

Regression

R-style formula interface with full diagnostics. OLS, Ridge, Lasso, Huber, and Quantile regression are included.

from vectrix import regress
model = regress(data=df, formula="sales ~ temperature + promotion")
print(model.summary())

Diagnostics include Durbin-Watson, Breusch-Pagan, VIF, normality tests, and time series adjustments (Newey-West, Cochrane-Orcutt).

Analysis

analyze() profiles the data and reports changepoints, anomalies, and data characteristics.

from vectrix import analyze
report = analyze(df, date="date", value="sales")
print(report.summary())

Regime Detection & Self-Healing

A pure-numpy HMM (Baum-Welch + Viterbi) detects regime shifts. When a regime change occurs, the self-healing system uses CUSUM + EWMA to detect drift and applies conformal prediction to recalibrate the forecast.

Business Constraints

8 constraint types can be applied to any forecast: non-negative, range, capacity, year-over-year change limit, sum constraint, monotonicity, ratio, and custom functions.

Hierarchical Reconciliation

Bottom-up, top-down, and MinTrace reconciliation for hierarchical time series.

Everything is Pure Python

All of the above — forecasting models, regime detection, regression diagnostics, constraint enforcement, hierarchical reconciliation — is implemented in pure Python with only NumPy, SciPy, and Pandas. No compiled extensions, no system dependencies.


◈ Quick Start

pip install vectrix
from vectrix import forecast

result = forecast("sales.csv", steps=12)
print(result)
result.plot()

◈ Why Vectrix?

Vectrix statsforecast Prophet Darts
Pure Python (no C/Fortran) ❌ (numba) ❌ (cmdstan) ❌ (torch)
Dependencies 3 5+ 10+ 20+
Auto model selection
Flat-line defense
Business constraints 8 types
Built-in regression R-style

◈ Models

Core Forecasting Models
Model Description
AutoETS 30 ExT×S combinations, AICc selection
AutoARIMA Seasonal ARIMA, stepwise order selection
Theta / DOT Original + Dynamic Optimized Theta
AutoCES Complex Exponential Smoothing
AutoTBATS Trigonometric multi-seasonal decomposition
GARCH GARCH, EGARCH, GJR-GARCH volatility
Croston Classic, SBA, TSB intermittent demand
Logistic Growth Saturating trends with capacity constraints
AutoMSTL Multi-seasonal STL + ARIMA residuals
Baselines Naive, Seasonal, Mean, Drift, Window Average
Experimental Methods
Method Description
Lotka-Volterra Ensemble Ecological dynamics for model weighting
Phase Transition Critical slowing → regime shift
Adversarial Stress 5 perturbation operators
Hawkes Demand Self-exciting point process
Entropic Confidence Shannon entropy quantification
Adaptive Intelligence
System Description
Regime Detection Pure numpy HMM (Baum-Welch + Viterbi)
Self-Healing CUSUM + EWMA drift → conformal correction
Constraints 8 types: ≥0, range, cap, YoY, Σ, ↑↓, ratio, fn
Forecast DNA 65+ features → meta-learning recommendation
Flat Defense 4-level prevention system
Regression & Diagnostics
Capability Description
Methods OLS, Ridge, Lasso, Huber, Quantile
Formula R-style: regress(data=df, formula="y ~ x")
Diagnostics Durbin-Watson, Breusch-Pagan, VIF, normality
Selection Stepwise, regularization CV, best subset
Time Series Newey-West, Cochrane-Orcutt, Granger
Business Intelligence
Module Description
Anomaly Automated outlier detection & explanation
What-if Scenario-based forecast simulation
Backtesting Rolling origin cross-validation
Hierarchy Bottom-up, top-down, MinTrace
Intervals Conformal + bootstrap prediction

◈ Installation

pip install vectrix                # Core (numpy + scipy + pandas)
pip install "vectrix[numba]"       # + Numba JIT (2-5x speedup)
pip install "vectrix[ml]"          # + LightGBM, XGBoost, scikit-learn
pip install "vectrix[all]"         # Everything

◈ Usage

Easy API

from vectrix import forecast, analyze, regress

result = forecast([100, 120, 115, 130, 125, 140], steps=5)

report = analyze(df, date="date", value="sales")
print(f"Difficulty: {report.dna.difficulty}")

model = regress(data=df, formula="sales ~ temperature + promotion")
print(model.summary())

DataFrame Workflow

from vectrix import forecast, analyze
import pandas as pd

df = pd.read_csv("data.csv")

report = analyze(df, date="date", value="sales")
print(report.summary())

result = forecast(df, date="date", value="sales", steps=30)
result.plot()
result.to_csv("forecast.csv")

Direct Engine Access

from vectrix.engine import AutoETS, AutoARIMA
from vectrix.adaptive import ForecastDNA

ets = AutoETS(period=7)
ets.fit(data)
pred, lower, upper = ets.predict(30)

dna = ForecastDNA()
profile = dna.analyze(data, period=7)
print(f"Difficulty: {profile.difficulty}")
print(f"Recommended: {profile.recommendedModels}")

Business Constraints

from vectrix.adaptive import ConstraintAwareForecaster, Constraint

caf = ConstraintAwareForecaster()
result = caf.apply(predictions, lower95, upper95, constraints=[
    Constraint('non_negative', {}),
    Constraint('range', {'min': 100, 'max': 5000}),
    Constraint('capacity', {'capacity': 10000}),
    Constraint('yoy_change', {'maxPct': 30, 'historicalData': past_year}),
])

◈ Benchmarks

Evaluated on M3 and M4 competition datasets (first 100 series per category). OWA < 1.0 means better than Naive2.

M3 Competition — 4/4 categories beat Naive2:

Category OWA
Yearly 0.848
Quarterly 0.825
Monthly 0.758
Other 0.819

M4 Competition — 4/6 frequencies beat Naive2:

Frequency OWA
Yearly 0.974
Quarterly 0.797
Monthly 0.987
Weekly 0.737
Daily 1.207
Hourly 1.006

Full results with sMAPE/MASE breakdown: benchmarks


◈ API Reference

Easy API (Recommended)

Function Description
forecast(data, steps=30) Auto model selection forecasting
analyze(data) DNA profiling, changepoints, anomalies
regress(y, X) / regress(data=df, formula="y ~ x") Regression with diagnostics
quick_report(data, steps=30) Combined analysis + forecast

Classic API

Method Description
Vectrix().forecast(df, dateCol, valueCol, steps) Full pipeline
Vectrix().analyze(df, dateCol, valueCol) Data analysis

Return Objects

Object Key Attributes
EasyForecastResult .predictions .dates .lower .upper .model .plot() .to_csv() .to_json()
EasyAnalysisResult .dna .changepoints .anomalies .features .summary()
EasyRegressionResult .coefficients .pvalues .r_squared .f_stat .summary() .diagnose()

◈ Architecture

vectrix/
├── easy.py               forecast(), analyze(), regress()
├── vectrix.py             Vectrix class — full pipeline
├── types.py               ForecastResult, DataCharacteristics
├── engine/                Forecasting models
│   ├── ets.py               AutoETS (30 combinations)
│   ├── arima.py             AutoARIMA (AICc stepwise)
│   ├── theta.py             Theta method
│   ├── dot.py               Dynamic Optimized Theta
│   ├── ces.py               Complex Exponential Smoothing
│   ├── tbats.py             TBATS / AutoTBATS
│   ├── mstl.py              Multi-Seasonal Decomposition
│   ├── garch.py             GARCH / EGARCH / GJR-GARCH
│   ├── croston.py           Croston Classic / SBA / TSB
│   ├── logistic.py          Logistic Growth
│   ├── hawkes.py            Hawkes Intermittent Demand
│   ├── lotkaVolterra.py     Lotka-Volterra Ensemble
│   ├── phaseTransition.py   Phase Transition Forecaster
│   ├── adversarial.py       Adversarial Stress Tester
│   ├── entropic.py          Entropic Confidence Scorer
│   └── turbo.py             Numba JIT acceleration
├── adaptive/              Regime, self-healing, constraints, DNA
├── regression/            OLS, Ridge, Lasso, Huber, Quantile
├── business/              Anomaly, backtest, what-if, metrics
├── flat_defense/          4-level flat prediction prevention
├── hierarchy/             Bottom-up, top-down, MinTrace
├── intervals/             Conformal + bootstrap intervals
├── ml/                    LightGBM, XGBoost wrappers
└── global_model/          Cross-series forecasting

◈ Contributing

git clone https://github.com/eddmpython/vectrix.git
cd vectrix
uv sync --extra dev
uv run pytest

◈ Support

If Vectrix is useful to you, consider supporting the project:

Buy Me a Coffee



◈ License

MIT — Use freely in personal and commercial projects.


Mapping the unknown dimensions of your data.

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

vectrix-0.0.2.tar.gz (321.9 kB view details)

Uploaded Source

Built Distribution

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

vectrix-0.0.2-py3-none-any.whl (311.7 kB view details)

Uploaded Python 3

File details

Details for the file vectrix-0.0.2.tar.gz.

File metadata

  • Download URL: vectrix-0.0.2.tar.gz
  • Upload date:
  • Size: 321.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vectrix-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b6eab555dea7859915ea87dbbeb914c508e37f529eb8d4a7659fda3d74990bf0
MD5 0148e0930ad4325dccd224beb8b74258
BLAKE2b-256 218cb394ac58a916b0f45570ee612fb5262ad8425f1569fffdc7b26936612a43

See more details on using hashes here.

Provenance

The following attestation bundles were made for vectrix-0.0.2.tar.gz:

Publisher: publish.yml on eddmpython/vectrix

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

File details

Details for the file vectrix-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: vectrix-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 311.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vectrix-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 32c91665f22226832d6e83fcb4e0faeae205d7008103c2bd24230c93bd6ebb37
MD5 f995a7e20d1435ac39c57274e3aaf538
BLAKE2b-256 ba67ca16c439264dfc52f62f6fcc8f13efa06b999e96c463ad08558a2874ad4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for vectrix-0.0.2-py3-none-any.whl:

Publisher: publish.yml on eddmpython/vectrix

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