Skip to main content

The easiest way to run and scale time-series machine learning in the Cloud.

Project description

Time-series machine learning and embeddings at scale


functime Python PyPi Code style: black GitHub Publish to PyPI GitHub Build Docs GitHub Run Quickstart


functime is a powerful Python library for production-ready forecasting and temporal embeddings.

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.

Want to use functime for seamless time-series predictive analytics across your data team? Looking for production-grade time-series machine learning in a serverless Cloud deployment? Shoot Chris a message on LinkedIn to learn more about functime Cloud.

Highlights

  • Fast: Forecast 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
  • Censored forecaster: for zero-inflated and thresholding forecasts

Getting Started

Install functime via the pip package manager.

pip install functime

Forecasting

import polars as pl
from functime.cross_validation import train_test_split
from functime.forecasting import lightgbm
from functime.metrics import mase

# Load example data
y = pl.read_parquet("https://github.com/descendant-ai/functime/raw/main/data/commodities.parquet")
entity_col, time_col = y.columns[:2]

# Time series split
y_train, y_test = y.pipe(train_test_split(test_size=3))

# Fit-predict
forecaster = lightgbm(freq="1mo", lags=24, max_horizons=3, strategy="ensemble")
forecaster.fit(y=y_train)
y_pred = forecaster.predict(fh=3)

# functime ❤️ functional design
# fit-predict in a single line
y_pred = lightgbm(freq="1mo", lags=24)(y=y_train, fh=3)

# Score forecasts in parallel
scores = mase(y_true=y_test, y_pred=y_pred, y_train=y_train)

View the full walkthrough on forecasting with functime.

Embeddings

Currently in closed-beta for functime Cloud. Have an interesting use-case? Contact us at Calendly.

Temporal embeddings measure the relatedness of time-series. Embeddings are more accurate and efficient compared to statistical methods (e.g. Catch22) for characteristing time-series.[^1] Embeddings have applications across many domains from finance to IoT monitoring. They are commonly used for the following tasks:

  • Matching: Where time-series are ranked by similarity to a given time-series
  • Classification: Where time-series are grouped together by matching patterns
  • Clustering: Where time-series are assigned labels (e.g. normal vs irregular heart rate)
  • Anomaly detection: Where outliers with unexpected regime / trend changes are identified

View the full walkthrough on temporal embeddings with functime.

Serverless Deployment

Currently in closed-beta for functime Cloud. Contact us for a demo via Calendly.

Deploy and train forecasters the moment you call any .fit method. Run the functime list CLI command to list all deployed models. Finally, track data and forecasts usage using functime usage CLI command.

Example CLI usage

You can reuse a deployed model for predictions anywhere using the stub_id variable. Note: the .from_deployed model class must be the same as during .fit.

forecaster = LightGBM.from_deployed(stub_id)
y_pred = forecaster.predict(fh=3)

License

functime is distributed under AGPL-3.0-only. For Apache-2.0 exceptions, see LICENSING.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

functime-0.3.3-py3-none-any.whl (62.1 kB view details)

Uploaded Python 3

File details

Details for the file functime-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: functime-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 62.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for functime-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3d39827268a0f9d714b1de50aae4125c3d2dff6f4611f11e41e2e0eae075317b
MD5 ab74c83708e210cde858a93adb952464
BLAKE2b-256 569f3249bee0e1751842a049c755ed1b9e1705d2bae48d8fe668fc2828815728

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page