lazyprophet

Time Series Forecasting with LightGBM

https://github.com/tblume1992/lazyprophet

Science Score: 44.0%

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

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.4%) to scientific vocabulary
Last synced: 7 months ago · JSON representation ·

Repository

Time Series Forecasting with LightGBM

Basic Info
  • Host: GitHub
  • Owner: tblume1992
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 200 KB
Statistics
  • Stars: 85
  • Watchers: 1
  • Forks: 13
  • Open Issues: 0
  • Releases: 0
Created about 4 years ago · Last pushed over 3 years ago
Metadata Files
Readme License Citation

README.md

LazyProphet v0.3.8

alt text

Recent Changes

With v0.3.8 comes a fully fledged Optuna Optimizer for simple (no exogenous) regression problems. Classification is ToDo.

A Quick example of the new functionality:

``` from LazyProphet import LazyProphet as lp from sklearn.datasets import fetch_openml import matplotlib.pyplot as plt

bikesharing = fetchopenml("BikeSharingDemand", version=2, asframe=True) y = bikesharing.frame['count'] y = y[-400:].values

lpmodel = lp.LazyProphet.Optimize(y, seasonalperiod=[24, 168], nfolds=2, # must be greater than 1 ntrials=20, # number of optimization runs, default is 100 testsize=48 # size of the holdout set to test against ) fitted = lpmodel.fit(y) predicted = lp_model.predict(100)

plt.plot(y) plt.plot(np.append(fitted, predicted)) plt.axvline(400) plt.show() ```

Introduction

A decent intro can be found here.

LazyProphet is a time series forecasting model built for LightGBM forecasting of single time series.

Many nice-ities have been added such as recursive forecasting when using lagged target variable such as the last 4 values to predict the 5th.

Additionally, fourier basis functions and penalized weighted piecewise linear basis functions are options as well!

Don't ever use in-sample fit for these types of models as they fit the data quite snuggly.

Quickstart

pip install LazyProphet

Simple example from Sklearn, just give it the hyperparameters and an array:

``` from LazyProphet import LazyProphet as lp from sklearn.datasets import fetch_openml import matplotlib.pyplot as plt

bikesharing = fetchopenml("BikeSharingDemand", version=2, asframe=True) y = bikesharing.frame['count'] y = y[-400:].values

lpmodel = lp.LazyProphet(seasonalperiod=[24, 168], #list means we use both seasonal periods nbasis=4, #weighted piecewise basis functions fourierorder=10, ar=list(range(1,25)), decay=.99 #the 'penalized' in penalized weighted piecewise linear basis functions ) fitted = lpmodel.fit(y) predicted = lpmodel.predict(100)

plt.plot(y) plt.plot(np.append(fitted, predicted)) plt.axvline(400) plt.show() ``` alt text

If you are working with less data or then you will probably want to pass custom LightGBM params via boosting_params when creating the LazyProphet obj.

The default params are:

boosting_params = { "objective": "regression", "metric": "rmse", "verbosity": -1, "boosting_type": "gbdt", "seed": 42, 'linear_tree': False, 'learning_rate': .15, 'min_child_samples': 5, 'num_leaves': 31, 'num_iterations': 50 } WARNING Passing lineartree=True can be extremely unstable, especially with ar and nbasis arguments. We do tests for linearity and will de-trend if necessary. **

Most importantly for controlling the complexity by using numleaves/learningrate for complexity with less data.

Alternatively, you could try out the method:

tree_optimize(y, exogenous=None, cv_splits=3, test_size=None) In-place of the fit method. This will do 'cv_splits' number of Time-Series Cross-Validation steps to optimize the tree using Optuna. This method has some degraded performance in testing but may be better for autoforecasting various types of data sizes.

Owner

  • Name: Tyler Blume
  • Login: tblume1992
  • Kind: user
  • Company: Newell Brands

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: LazyProphet
message: >-
  If you want to cite the work, please use this
  information.
type: software
authors:
  - given-names: Tyler
    family-names: Blume
    email: tyler.blume@mail.usf.edu

GitHub Events

Total
  • Watch event: 6
  • Fork event: 1
Last Year
  • Watch event: 6
  • Fork event: 1

Committers

Last synced: about 3 years ago

All Time
  • Total Commits: 28
  • Total Committers: 1
  • Avg Commits per committer: 28.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Tyler Blume t****e@h****m 28

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 3
  • Total pull requests: 0
  • Average time to close issues: 7 days
  • Average time to close pull requests: N/A
  • Total issue authors: 3
  • Total pull request authors: 0
  • Average comments per issue: 2.33
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • 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
  • yuanjie-ai (1)
  • robertmcleod2 (1)
  • Cyue0316 (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 193 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 11
  • Total maintainers: 1
pypi.org: lazyprophet

Time series forecasting with LightGBM

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 193 Last month
Rankings
Stargazers count: 8.1%
Dependent packages count: 10.0%
Forks count: 10.9%
Downloads: 12.6%
Average: 12.7%
Dependent repos count: 21.8%
Maintainers (1)
Last synced: 7 months ago

Dependencies

LazyProphet.egg-info/requires.txt pypi
  • lightgbm *
  • matplotlib *
  • numpy *
  • optuna *
  • pandas *
  • scikit-learn *
  • scipy *
  • statsmodels *
setup.py pypi
  • lightgbm *
  • matplotlib *
  • numpy *
  • optuna *
  • pandas *
  • scikit-learn *
  • scipy *
  • statsmodels *