Skip to main content

Lightweight validation framework for time series forecasting.

Project description

fur logo

Timeframes

A lightweight framework for time series validation and evaluation.
Timeframes provides simple and efficient tools for splitting, validating, and backtesting forecasting models — without unnecessary dependencies or boilerplate.



🧠 Need help?

Try TimeframesGPT — a specialized assistant trained on the full Timeframes codices.


Installation

pip install timeframes

Quick Example

import timeframes as ts
from sklearn.linear_model import LinearRegression

# Example data
X, y = ts.load_example("air_passengers")

# Split into train, validation, and test
train, val, test = ts.split(X, ratios=(0.7, 0.2, 0.1))

# Validate using walk-forward cross-validation
model = LinearRegression()
report = ts.validate(model, X, y, method="walkforward", mode="expanding", folds=5)

print(report)
# {'mae': 0.213, 'rmse': 0.322, 'smape': 3.9}

Features

  • Minimal — depends only on NumPy and pandas.
  • Consistent — unified API for all validation methods.
  • Flexible — works with any model exposing .fit() / .predict().
  • Transparent — every function returns clear, reproducible outputs.

Supported Methods

Function Description
ts.split() Single train/validation/test split
ts.validate() Cross-validation (walk-forward or temporal K-Fold)
ts.backtest() Out-of-sample testing
ts.evaluate() Metric evaluation (MAE, RMSE, sMAPE, rMAE)

📂 Examples

Hands-on demonstrations are included in the examples/ directory:

  • harmonic_forecast.py — walk-forward validation and backtesting demo.
  • kfold_demo.py — temporal K-Fold cross-validation example.
  • visualize_splits_demo.py — visualize how time series splits evolve.

Run any example directly:

python examples/harmonic_forecast.py

License

MIT License © 2025 Andrew R. Garcia

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

timeframes-1.1.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

timeframes-1.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file timeframes-1.1.0.tar.gz.

File metadata

  • Download URL: timeframes-1.1.0.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for timeframes-1.1.0.tar.gz
Algorithm Hash digest
SHA256 602066d406e56469615cbe23b0ad35dfaee9aa96024e84b3cfc72c06a3518e58
MD5 350c73c8c47eccd8d9204d78d8f47941
BLAKE2b-256 59dea790d3aa544517ee0c13c88e40addc82583adb1e69301b107bdd26f6ae85

See more details on using hashes here.

File details

Details for the file timeframes-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: timeframes-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for timeframes-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2bfeffd44f336528438392bdde66d4231a222c2a97ecb67f0443cef65c8cb56
MD5 359e296ece9e67be098c22feeb823181
BLAKE2b-256 3db8da2215c337fa991cd30122df2f589ae54646c2e027d6babd5e45ccf72d8d

See more details on using hashes here.

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