Skip to main content

Advanced time-series analytics and forecasting toolkit for commodity and power trading

Project description

Analysis3054 – Advanced Forecasting & Analytics

Analysis3054 is a full‑featured time‑series analytics and forecasting package designed for commodity, energy, and demand‑planning practitioners. It combines plotting, statistics, machine learning, and deep learning (Chronos‑2, AutoGluon, gradient boosting, SARIMAX, and more) under a single, unified API.

Installation

Install the latest release (Chronos‑2 and AutoGluon are installed by default):

pip install analysis3054

Optional extras let you control footprint per environment:

pip install "analysis3054[stats]"    # pmdarima + arch
pip install "analysis3054[ml]"       # scikit-learn + boosted trees
pip install "analysis3054[dl]"       # tensorflow
pip install "analysis3054[prophet]"  # prophet + neuralprophet
pip install "analysis3054[tbats]"    # tbats
pip install "analysis3054[all]"      # everything (same as base but explicit)

Building for PyPI

From a clean checkout:

python -m build

This produces wheel and sdist artifacts under dist/ ready for upload via twine upload dist/*.

Quickstart

Create a small demo DataFrame (weekly power prices with a covariate):

import numpy as np
import pandas as pd
from analysis3054 import (
    five_year_plot,
    ForecastEngine,
    forecast_distillate_burn,
    ml_forecast,
    chronos2_forecast,
    bayesian_ridge_forecast,
    huber_forecast,
    pls_forecast,
    fourier_ridge_forecast,
    histgb_direct_forecast,
)

rng = pd.date_range("2020-01-05", periods=120, freq="W")
df = pd.DataFrame({
    "date": rng,
    "price": 50 + np.sin(np.arange(120) / 6) * 5 + np.random.randn(120),
    "temp": 30 + np.random.randn(120),
})

Plotting

Five‑Year Band Plot

fig = five_year_plot(date="date", df=df, smooth=True)
fig.show()

Forecasting APIs

Unified engine

engine = ForecastEngine.default()
forecast = engine.run(
    df=df,
    date_col="date",
    target_cols=["price"],
    horizon=8,
    covariate_cols=["temp"],
)
print(forecast.forecasts.head())

High‑level helper: distillate burn

res = forecast_distillate_burn(
    df=df,
    date_col="date",
    target_col="price",
    covariate_cols=["temp"],
    prediction_length=6,
    method="chronos2",
)

Chronos‑2 direct use

chronos_out = chronos2_forecast(
    df=df,
    date_col="date",
    target_col="price",
    covariate_cols=["temp"],
    prediction_length=12,
    model_name="amazon/chronos-2",
)

ML & Robust Forecasters

All ML helpers infer frequency, propagate covariates, apply exponential error correction, and handle missing sklearn gracefully.

ridge = bayesian_ridge_forecast(df, date_col="date", target_col="price", covariate_cols=["temp"], prediction_length=10)
huber = huber_forecast(df, date_col="date", target_col="price", covariate_cols=["temp"], prediction_length=10)
pls = pls_forecast(df, date_col="date", target_col="price", covariate_cols=["temp"], prediction_length=10)
fourier = fourier_ridge_forecast(df, date_col="date", target_col="price", covariate_cols=["temp"], prediction_length=10, seasonal_periods=[52])
histgb = histgb_direct_forecast(df, date_col="date", target_col="price", covariate_cols=["temp"], prediction_length=10, max_depth=4)

Auto ML family (10+ helpers)

from analysis3054 import (
    chronos2_auto_covariate_forecast,
    boosted_tree_forecast,
    random_forest_forecast,
    elastic_net_forecast,
    xgboost_forecast,
    catboost_forecast,
    lightgbm_forecast,
    svr_forecast,
    mlp_forecast,
    harmonic_regression_forecast,
    intraday_sarimax_forecast,
)

auto = chronos2_auto_covariate_forecast(df, "date", "price", covariate_cols=["temp"], prediction_length=6)
boosted = boosted_tree_forecast(df, "date", "price", covariate_cols=["temp"], prediction_length=6)

Leaderboards & Ensembles

from analysis3054 import model_leaderboard, simple_ensemble

leaderboard = model_leaderboard(df, "date", "price", covariate_cols=["temp"], prediction_length=8, models=["chronos2", "sarimax", "harmonic"])
ensemble = simple_ensemble(df, "date", "price", covariate_cols=["temp"], prediction_length=8, models=["chronos2", "harmonic"], weights=[0.7, 0.3])

Additional Utilities

  • ml_forecast: AutoGluon multiseries forecaster with optional quantiles.
  • forecast_engine: Registry for plugging in custom model handlers.
  • forecast_distillate_burn: Sector‑specific helper with automatic Chronos‑2 routing.
  • statistics.py / stats.py: stationarity tests, autocorrelation utilities.
  • plot.py / visualization.py: distribution, correlation, and seasonal plots.
  • finance.py: Sharpe ratio, drawdown analytics, and return attribution.

Refer to USER_GUIDE.md for end‑to‑end walkthroughs, troubleshooting tips, and extended examples spanning every public function.

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

analysis3054-0.3.0.tar.gz (136.4 kB view details)

Uploaded Source

Built Distribution

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

analysis3054-0.3.0-py3-none-any.whl (145.3 kB view details)

Uploaded Python 3

File details

Details for the file analysis3054-0.3.0.tar.gz.

File metadata

  • Download URL: analysis3054-0.3.0.tar.gz
  • Upload date:
  • Size: 136.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for analysis3054-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2cb74f9b65e41cf9fbc3a79b09d702fde7639d06aec9f6cbfbe9fd45fbc98093
MD5 15136722dfcf15a9317805a9708dc317
BLAKE2b-256 6bf4002b33e0976b350672d1e0eb336e41932cd7a0a74724a09ba3b10ea1a993

See more details on using hashes here.

File details

Details for the file analysis3054-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: analysis3054-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 145.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for analysis3054-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6df15e1010be6c444ae589fdaa6b9fd80d7d54ea8b7c281a70b9bc1f6b2a0da7
MD5 7d9ff2e925fa2e421580272c3402d331
BLAKE2b-256 0fe21e44e559484b37028adcf237c17e2c89f5cc9c0350dd4691ce8f9f529b7d

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