https://github.com/functime-org/functime

Time-series machine learning at scale. Built with Polars for embarrassingly parallel feature extraction and forecasts on panel data.

https://github.com/functime-org/functime

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.7%) to scientific vocabulary

Keywords

feature-engineering forecasting machine-learning panel-data polars python time-series

Keywords from Contributors

dag dataflow developer-tools notebooks web-app
Last synced: 6 months ago · JSON representation

Repository

Time-series machine learning at scale. Built with Polars for embarrassingly parallel feature extraction and forecasts on panel data.

Basic Info
  • Host: GitHub
  • Owner: functime-org
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage: https://docs.functime.ai
  • Size: 278 MB
Statistics
  • Stars: 1,133
  • Watchers: 14
  • Forks: 62
  • Open Issues: 58
  • Releases: 8
Topics
feature-engineering forecasting machine-learning panel-data polars python time-series
Created over 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License Code of conduct

README.md

Time-series machine learning at scale


![functime](https://github.com/functime-org/functime/raw/main/docs/img/banner_dark_bg.png) [![Python](https://img.shields.io/pypi/pyversions/functime)](https://pypi.org/project/functime/) [![PyPi](https://img.shields.io/pypi/v/functime?color=blue)](https://pypi.org/project/functime/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![GitHub Run Quickstart](https://github.com/functime-org/functime/actions/workflows/quickstart.yml/badge.svg)](https://github.com/functime-org/functime/actions/workflows/quickstart.yml) [![Discord](https://img.shields.io/discord/1145819725276917782)](https://discord.com/invite/JKMrZKjEwN)

functime is a powerful Python library for production-ready global forecasting and time-series feature extraction on large panel datasets.

functime also comes with time-series preprocessing (box-cox, differencing etc), cross-validation splitters (expanding and sliding window), and forecast metrics (MASE, SMAPE etc). All optimized as lazy Polars transforms.

Join us on Discord!

Highlights

  • Fast: Forecast and extract features (e.g. tsfresh, Catch22) across 100,000 time series in seconds on your laptop
  • Efficient: Embarrassingly parallel feature engineering for time-series using Polars
  • Battle-tested: Machine learning algorithms that deliver real business impact and win competitions
  • Exogenous features: supported by every forecaster
  • Backtesting with expanding window and sliding window splitters
  • Automated lags and hyperparameter tuning using FLAML

Additional Highlights

functime comes with a specialized LLM agent to analyze, describe, and compare your forecasts. Check out the walkthrough here.

Getting Started

Install functime via the pip package manager. bash pip install functime

functime comes with extra options. For example, to install functime with large-language model (LLM) and lightgbm features:

bash pip install "functime[llm,lgb]"

  • cat: To use catboost forecaster
  • xgb: To use xgboost forecaster
  • lgb: To use lightgbm forecaster
  • llm: To use the LLM-powered forecast analyst

Forecasting

```python import polars as pl from functime.crossvalidation import traintestsplit from functime.seasonality import addfourierterms from functime.forecasting import linearmodel from functime.preprocessing import scale from functime.metrics import mase

Load commodities price data

y = pl.readparquet("https://github.com/functime-org/functime/raw/main/data/commodities.parquet") entitycol, time_col = y.columns[:2]

Time series split

ytrain, ytest = y.pipe(traintestsplit(test_size=3))

Fit-predict

forecaster = linearmodel(freq="1mo", lags=24) forecaster.fit(y=ytrain) y_pred = forecaster.predict(fh=3)

functime functional design

fit-predict in a single line

ypred = linearmodel(freq="1mo", lags=24)(y=y_train, fh=3)

Score forecasts in parallel

scores = mase(ytrue=ytest, ypred=ypred, ytrain=ytrain)

Forecast with target transforms and feature transforms

forecaster = linearmodel( freq="1mo", lags=24, targettransform=scale(), featuretransform=addfourier_terms(sp=12, K=6) )

Forecast with exogenous regressors!

Just pass them into X

X = ( y.select([entitycol, timecol]) .pipe(addfourierterms(sp=12, K=6)).collect() ) Xtrain, Xfuture = y.pipe(traintestsplit(testsize=3)) forecaster = linearmodel(freq="1mo", lags=24) forecaster.fit(y=ytrain, X=Xtrain) ypred = forecaster.predict(fh=3, X=Xfuture) ```

View the full walkthrough on forecasting here.

Feature Extraction

functime comes with over 100+ time-series feature extractors. Every feature is easily accessible via functime's custom ts (time-series) namespace, which works with any Polars Series or expression. To register the custom ts Polars namespace, you must first import functime in your module.

To register the custom ts Polars namespace, you must first import functime!

```python import polars as pl import numpy as np from functime.featureextractors import FeatureExtractor, binnedentropy

Load commodities price data

y = pl.read_parquet("https://github.com/functime-org/functime/raw/main/data/commodities.parquet")

Get column names ("commodity_type", "time", "price")

entitycol, timecol, value_col = y.columns

Extract a single feature from a single time-series

binnedentropy = binnedentropy( pl.Series(np.random.normal(0, 1, size=10)), bin_count=10 )

Also works on LazyFrames with query optimization

features = ( pl.LazyFrame({ "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "value": np.random.normal(0, 1, size=10) }) .select( binnedentropy=pl.col("value").ts.binnedentropy(bincount=10), lempelzivcomplexity=pl.col("value").ts.lempelzivcomplexity(threshold=3), longeststreakabovemean=pl.col("value").ts.longeststreakabove_mean(), ) .collect() )

Extract features blazingly fast on many

stacked time-series using group_by

features = ( y.groupby(entitycol) .agg( binnedentropy=pl.col(valuecol).ts.binnedentropy(bincount=10), lempelzivcomplexity=pl.col(valuecol).ts.lempelzivcomplexity(threshold=3), longeststreakabovemean=pl.col(valuecol).ts.longeststreakabovemean(), ) )

Extract features blazingly fast on windows

of many time-series using group_by_dynamic

features = ( # Compute rolling features at yearly intervals y.groupbydynamic( timecol, every="12mo", by=entitycol, ) .agg( binnedentropy=pl.col(valuecol).ts.binnedentropy(bincount=10), lempelzivcomplexity=pl.col(valuecol).ts.lempelzivcomplexity(threshold=3), longeststreakabovemean=pl.col(valuecol).ts.longeststreakabovemean(), ) )

```

Related Projects

If you are interested in general data-science related plugins for Polars, you must check out polars-ds. polars-ds is a project created by one of functime's core maintainers and is the easiest way to extend your Polars pipelines with commonly used data-science operations made blazing fast with Rust!

License

functime is distributed under Apache-2.0.

Owner

  • Name: functime
  • Login: functime-org
  • Kind: organization

Open-source time-series machine learning at scale.

GitHub Events

Total
  • Issues event: 1
  • Watch event: 98
  • Issue comment event: 10
  • Pull request event: 2
  • Fork event: 12
Last Year
  • Issues event: 1
  • Watch event: 98
  • Issue comment event: 10
  • Pull request event: 2
  • Fork event: 12

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 581
  • Total Committers: 14
  • Avg Commits per committer: 41.5
  • Development Distribution Score (DDS): 0.301
Past Year
  • Commits: 581
  • Committers: 14
  • Avg Commits per committer: 41.5
  • Development Distribution Score (DDS): 0.301
Top Committers
Name Email Commits
Christopher Lo 4****o 406
Chris Lo l****y@g****m 60
Daryl Lim d****t@g****m 53
baggiponte 5****e 18
TQQQ 7****q 14
Mathieu Cayssol 4****l 12
Nelson Griffiths 4****3 5
TomBurdge 1****e 4
vienneraphael 1****l 3
Mathieu Cayssol m****l@g****m 2
RowanBlake e****4@g****m 1
abstractqqq t****5@g****m 1
Francesco Bruzzesi 4****i 1
claysmyth 3****h 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 99
  • Total pull requests: 122
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 7 days
  • Total issue authors: 28
  • Total pull request authors: 20
  • Average comments per issue: 1.87
  • Average comments per pull request: 1.85
  • Merged pull requests: 94
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 21
  • Pull requests: 21
  • Average time to close issues: 14 days
  • Average time to close pull requests: about 2 hours
  • Issue authors: 11
  • Pull request authors: 7
  • Average comments per issue: 0.95
  • Average comments per pull request: 1.67
  • Merged pull requests: 12
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • baggiponte (20)
  • ngriffiths13 (4)
  • jhug12 (4)
  • khrapovs (3)
  • montanarograziano (3)
  • FBruzzesi (3)
  • miroslaavi (2)
  • david-waterworth (2)
  • firmai (2)
  • FangyangJz (1)
  • jmoralez (1)
  • fingoldo (1)
  • linjing-lab (1)
  • pcgm-team (1)
  • ion-elgreco (1)
Pull Request Authors
  • baggiponte (56)
  • khrapovs (8)
  • miroslaavi (6)
  • abstractqqq (5)
  • jhug12 (5)
  • FBruzzesi (5)
  • ngriffiths13 (3)
  • devastator99 (2)
  • andreasoprani (2)
  • fabianbergermann (2)
  • domenicocinque (2)
  • tjader (2)
  • akmalsoliev (2)
  • montanarograziano (2)
Top Labels
Issue Labels
enhancement (7) good first issue (6) documentation (4) bug (4) cicd (3) refactor (3) priority: high (3) help wanted (2) build (2) plotting (2) Priority: Moderate (1) Priority: High (1) priority: low (1) forecasting (1) tests (1) polars-plugins (1)
Pull Request Labels
documentation (6) refactor (5) build (4) enhancement (4) forecasting (4) plotting (3) cicd (2) bug (2) Priority: Moderate (1) help wanted (1) test (1)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 920 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 48
  • Total maintainers: 1
proxy.golang.org: github.com/functime-org/functime
  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
pypi.org: functime

Time-series machine learning at scale.

  • Versions: 40
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 920 Last month
Rankings
Downloads: 3.9%
Dependent packages count: 10.1%
Average: 11.9%
Dependent repos count: 21.6%
Maintainers (1)
Last synced: 6 months ago