Skip to main content

SmurphCast 📈 1.0.1

PyPI Python Docs License

SmurphCast is the first open-source forecasting library designed explicitly for percentages: churn, click-through, conversion, retention & rate-based KPIs. Lightweight ✅, explainable ✅, production-ready ✅—and it runs on a laptop CPU.

Why another forecasting library?

Modern teams track hundreds of tiny percentages—they spike on Black Friday, dip during outages, and never exceed 100%. Classic tools (ARIMA, Prophet, deep nets) either ignore those hard bounds or explode with gradient issues.

SmurphCast was born inside a growth-marketing team frustrated with:

  • Unbounded predictions (> 100% CTR 😩)
  • Brittle seasonality when data is bi-weekly, quarterly, or irregular
  • Needing to babysit half a dozen libraries for every experiment

So we distilled the playbook that actually worked into one cohesive package.

✨ Key reasons you'll love SmurphCast

Feature SmurphCast advantage What it means for you
🔒 Bound-aware losses Bounded MSE / quantile pinball keep forecasts in [0, 1] no more negative churn or > 100% conversion
📅 Multiple seasonalities Automatically detects weekly, monthly, yearly or n-period cycles accurate retail & campaign spikes without manual fiddling
🤝 Hybrid architecture Additive (Fourier + dummies) • GBM • Quantile GBM • ES-RNN pick the weapon that fits your data size + CPU budget
🔄 AutoSelector Back-tests every model, inverse-MAE blends, non-negative stacking get "good enough" forecasts out-of-the-box—then fine-tune
💬 Explainability SHAP-ready importances, residual diagnostics, coverage metrics show the C-suite why the forecast moved
🚀 Zero-GPU Pure NumPy / LightGBM / PyTorch-CPU run in CI, serverless, or a Docker side-car

A brief history of the internal models

Year Model Inspiration What we kept / improved
2017 Prophet Facebook's decomposable trend/seasonality Fourier features & Laplace trend regularisation
2018 ES-RNN (M4 winner) Uber's hybrid Holt-Winters + RNN Our HybridESRNN shrinks to CPU-size & enforces bounds
2020 LightGBM CTR models Ad-tech uses trees on lagged features Wrapped as GBMModel, turnkey lags & rolling stats
2022 Quantile GBM pinball-loss for PIs Adds automatic 80% & 95% intervals
2025 AutoSelector meta-learning & stacking competitions Rolling CV, inverse-MAE weight blend, non-negative OLS stack

The result: four specialised forecasters + one meta-model that systematically outperforms any single approach on marketing KPI datasets.

Installation

pip install smurphcast      # PyPI release

# Dev install
git clone https://github.com/yourhandle/smurphcast.git
cd smurphcast
pip install -e .[dev]       # tests, ruff, black, hatch

SmurphCast requires Python ≥ 3.9 and no GPU.

0-minute quick-start

import pandas as pd
from smurphcast.pipeline import ForecastPipeline

df = pd.read_csv("examples/churn_example.csv", parse_dates=["ds"])

# Auto picks the best model & stacking weights
pipe = ForecastPipeline(model_name="auto").fit(df, horizon=3)

print(pipe.predict())         # point forecast
print(pipe.predict_interval(.9))  # 90% PI if supported
pipe.save("smurf.pkl")        # deploy anywhere (dill)

CLI:

smurphcast fit examples/churn_example.csv --horizon 3 --model auto --save best.pkl

Architecture 🔧

Raw CSV  --> validator / outlier scrub
   |
   v      --> logit / log / Box-Cox transforms
Features  
   |
   v      --> Fourier + calendar dummies + lags + rolls
Base models     additive | gbm | qgbm | esrnn  (all CPU)
   |
   v      inverse-MAE blend  +   NNLS stacking
AutoSelect

Everything communicates via the ForecastPipeline interface, so you can slot in custom models or swap the feature generator without touching the rest.

Documentation & API

Sample data

The wheel ships with tiny toy CSVs (smurphcast.data.*) so you can run the docs offline. Larger examples stay in examples/ to keep installs lean.

Roadmap 🗺️

  • Optuna integration for AutoSelector hyper-tuning
  • Holiday / event regressor interface
  • Group-by support for many related series (panel KPIs)
  • Prophet-style component plots on every model

Contributing

  • Fork & create a feature branch
  • Hatch run pytest - all tests must pass
  • Follow ruff & black (pre-commit hooks included)
  • Open a PR – descriptive title, before/after numbers if performance related

We happily accept new feature generators, models, and docs!

License

Code released under the MIT License. Sample data are synthetic and MIT-licensed as well.

© 2025 SmurphCast Contributors – built with 💻, 📊 and a bit of 💙 for tiny percentages.

Metadata

Release files for smurphcast 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smurphcast 1.0.7
File Size Uploaded Provenance
smurphcast-1.0.7.tar.gz 21.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for smurphcast 1.0.7
File Interpreter ABI Platform
smurphcast-1.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 52.4 kB

Release files / smurphcast-1.0.7.tar.gz

Download URL smurphcast-1.0.7.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6301a656f78b595cf62d46e5f6e7bdfa2012a722b6417ec7ab159295a5072ae0
BLAKE2b-256 checksum
How to use checksums
b68131740019b80c4bde192dc0dfce5563e69895f9db3036304582215003e6b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.17

Release files / smurphcast-1.0.7-py3-none-any.whl

Download URL smurphcast-1.0.7-py3-none-any.whl
Size 30.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51e7dafeb9f575193924a0e9d3e9a2b619ec3dbeefed5b9f5ce72c42bf28f9ec
BLAKE2b-256 checksum
How to use checksums
81acfa320c6c92e5915c9cadaa63ef8aa1ca19e6009fc685e0172cf3ceaec138
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.17

Security for smurphcast 1.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page