https://github.com/alexhallam/tablespoon

🥄✨Time-series Benchmark methods that are Simple and Probabilistic

https://github.com/alexhallam/tablespoon

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

data-science forecasting mean naive probabilistic probabilistic-programming probability python scipy seasonal-naive simple simple-models time-series uncertainty-quantification
Last synced: 5 months ago · JSON representation

Repository

🥄✨Time-series Benchmark methods that are Simple and Probabilistic

Basic Info
Statistics
  • Stars: 41
  • Watchers: 2
  • Forks: 1
  • Open Issues: 1
  • Releases: 5
Topics
data-science forecasting mean naive probabilistic probabilistic-programming probability python scipy seasonal-naive simple simple-models time-series uncertainty-quantification
Created over 4 years ago · Last pushed over 2 years ago
Metadata Files
Readme Changelog License

README.md

Python application

tablespoon

Time-series Benchmark methods that are Simple and Probabilistic

Documentation and quick links

Introduction

Many methods exist for probabilistic forecasting. If you are looking for an impressive probabilistic forecasting package see the list of recommendation at the bottom of this README. This package is exceptionally ordinary. It is expected that this package may be used as a compliment to what is already out there.

Why Run Simple Methods

We have found, by experience, many good uses for the methods in this package. To often we see that forecast methods go in production without a naive method to accompany it. This is a missed opportunity.

  1. Naive May Be Good Enough: How good is good enough? I have almost never started a project where the firm receiving the forecast knew the answer to this question, but it is important to get to it early. I think all of us would agree that a forecast error of 0 is best, but in reality how much time should be spent spinning our wheels to get there. Further, many business applications can’t be improved upon even with significant forecast error reduction. I remember hearing a story of a firm which ordered units on pallets. The firm paid by the pallet, not the unit. The forecast team was able to reduce the forecast error, but in the end this did not change the outcome. This is the ‘pallet problem’. As data scientists it is easy to think of error reduction as a continuous function, but this need not map the same way to business value. In this example the continuous error reduction mapped to a discrete pallet. This is a long way of saying, “A naive forecast may be good enough”. What is a naive forecasting method? I typically think of two methods. The mean forecast and the naive forecast. I will go over these in more detail below. There are also some applications where naive methods have been shown to be hard to beat.
  2. Get A Denominator for Relative Metrics: Though naive methods can usually be beat it is good to know the relative improvement over the benchmark. This can allow a forecasting team to market their alternative forecast when the 'skill score' is impressive.
  3. Easy to productionize and get expectations: Get a sense for how good is good enough. In many applications a forecast team is asked to forecast, but stakeholders provide no line-in-the-sand for when the forecasting work needs to stop. One reasonable approach is to run the benchmarks found in this package then beat the best performing benchmark by a margin that is statistically significant.
  4. Resilience in Production - Why not have many models?: Sometimes, despite best efforts the production model does something unexpected. In this case it is nice to have a simple backup that is cheap to generate and good enough to fall back on. In this way a production forecast pipeline gains strength from a diversity of models.
  5. Easy Uncertainty Quantification: Recently we see that applications are not about forecast accuracy, but instead about forecasting uncertainty. Capturing the full distribution helps firms set "service levels" aka percentiles of the distribution for which they are prepared to serve. Even if you have the worlds most accurate unbiased forecast the median point is , by definition, an underforecast half the time. For this reason it is best to provide a distribution of simulated future values and the firm may decide for themselves what risks they are or are not willing to take.

Quick Example

We show a quick example below.

For more examples see Simple Example, Extended Example

There are also some Notebook examples 1. Intro 2. Time Series Cross Validation & Skill Score

Seasonal Example

```python import tablespoon as tbsp from tablespoon.data import SEAS

sn = tbsp.Snaive() dfsn = sn.predict( SEAS, horizon=7 * 4, frequency="D", lag=7, uncertaintysamples=8000 ).assign(model="snaive")

print(df_sn.head(10)) ```

Stock Prediction

```python import tablespoon as tbsp from tablespoon.data import APPL

n = tbsp.Naive() dfn = n.predict( APPL, horizon=7 * 4, frequency="D", lag=1, uncertaintysamples=8000 ).assign(model="naive")

print(df_n.head(10)) ```

sh ds rep y_sim model 0 2022-01-02 0 5.20006 naive 1 2022-01-02 1 5.16789 naive 2 2022-01-02 2 5.17641 naive 3 2022-01-02 3 5.19340 naive 4 2022-01-02 4 5.20075 naive 5 2022-01-02 5 5.17681 naive 6 2022-01-02 6 5.20302 naive 7 2022-01-02 7 5.18896 naive 8 2022-01-02 8 5.19622 naive 9 2022-01-02 9 5.17469 naive

Goals of this package

  1. Simple: Not just in the forecasts themselves, but also from the users perspective.
  2. Documented: It should be very clear exactly how forecasts are getting generated. We document the parameterization of the models to make this as obvious and uninteresting as possible. See Forecast Method Math Documentation
  3. Stable: We want this package to feel rock solid. For this to happen we keep the feature set relatively small. We believe that after the initial development of this package we should spend out time maintaining the code as oppose to thinking of new features.
  4. Distributional: Quantification of uncertainty is the name of the game.

Non-Goals

  1. 🔥Circut Melting Focus on Speed: Not to say this is a slow package. In fact, it is very fast! We just don't put any extra effort to make it faster than numpy.
  2. 🤖New/Complex Forecast Models: Again, this is out of scope. If you are looking for recommendations please see the bottom of the page.

Installation

Python

pip3 install tablespoon

Citation

If you would like to cite tablespoon, please cite it as follows:

Alex Hallam. tablespoon: Time-series Benchmark methods that are Simple and Probabilistic https://github.com/alexhallam/tablespoon, 2022. Version 0.4.6.

@misc{tablespoon, author={Alex Hallam}, title={{tablespoon}: {Time-series Benchmark methods that are Simple and Probabilistic}, howpublished={https://github.com/alexhallam/tablespoon}, note={Version 0.4.6, year={2022} }

References

  1. Hyndman, R.J., & Athanasopoulos, G. (2021) Forecasting: principles and practice, 3rd edition, OTexts: Melbourne, Australia. OTexts.com/fpp3. Accessed on 2021-09-26.

Recommended probabilistic forecasting packages

There are many packages that can compliment tablespoon

forecast: The king of forecasting packages. Rob Hyndman is a professor of forecasting and has served as editor of the journal "International Journal of Forecasting". If you are new to forecasting please read his free ebook fpp3.

prophet: A very capable and reliable forecasting package. I have never seen a bad forecast come out of prophet.

gluonts. If you are itching to use neural nets for forecasting this is a good one to pick.

Learn more about forecasting

  1. Read fpp3
  2. Join the International Institute of Forecasting and read their publications.

Built with poetry and pushed to pypi

sh poetry publish -u <username> -p <password> --build

Owner

  • Name: Alex Hallam
  • Login: alexhallam
  • Kind: user
  • Location: Atlanta Georgia
  • Company: Chick-fil-A

Senior Data Scientist "Life is uncertain; always eat your dessert first."

GitHub Events

Total
Last Year

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 123
  • Total Committers: 1
  • Avg Commits per committer: 123.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Alex Hallam a****8@g****m 123

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 7
  • Total pull requests: 56
  • Average time to close issues: 30 days
  • Average time to close pull requests: 1 day
  • Total issue authors: 2
  • Total pull request authors: 1
  • Average comments per issue: 0.71
  • Average comments per pull request: 0.02
  • Merged pull requests: 52
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • alexhallam (6)
  • sal-randazzo (1)
Pull Request Authors
  • alexhallam (54)
Top Labels
Issue Labels
good first issue (1)
Pull Request Labels
bug (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 749 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 31
  • Total maintainers: 1
pypi.org: tablespoon

Simple probabilistic time series benchmark models

  • Versions: 31
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 749 Last month
Rankings
Downloads: 5.9%
Dependent packages count: 10.0%
Stargazers count: 10.4%
Average: 14.1%
Dependent repos count: 21.7%
Forks count: 22.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

poetry.lock pypi
  • atomicwrites 1.4.0
  • attrs 21.4.0
  • colorama 0.4.4
  • importlib-metadata 4.11.4
  • iniconfig 1.1.1
  • numpy 1.21.6
  • packaging 21.3
  • pandas 1.3.5
  • patsy 0.5.2
  • pluggy 1.0.0
  • py 1.11.0
  • pyparsing 3.0.9
  • pytest 6.2.5
  • python-dateutil 2.8.2
  • pytz 2022.1
  • scipy 1.7.3
  • six 1.16.0
  • statsmodels 0.13.2
  • toml 0.10.2
  • typing-extensions 4.2.0
  • zipp 3.8.0
pyproject.toml pypi
  • numpy ^1.21.2 develop
  • pandas ^1.3.2 develop
  • numpy ^1.21.2
  • pandas ^1.3.2
  • pytest ^6.2.5
  • python >=3.7.1,<3.11
  • scipy ^1.7.3
  • statsmodels ^0.13.2
.github/workflows/python-app.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite