Time-series machine learning at scale.
Project description
functime is a powerful Python library for production-ready global forecasting and time-series feature engineering.
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.
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.feature_extraction import add_fourier_terms
from functime.forecasting import linear_model
from functime.preprocessing import scale
from functime.metrics import mase
# Load commodities price 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 = linear_model(freq="1mo", lags=24)
forecaster.fit(y=y_train)
y_pred = forecaster.predict(fh=3)
# functime ❤️ functional design
# fit-predict in a single line
y_pred = linear_model(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)
# Forecast with target transforms and feature transforms
forecaster = linear_model(
freq="1mo",
lags=24,
target_transform=scale(),
feature_transform=add_fourier_terms(sp=12, K=6)
)
View the full walkthrough on forecasting with functime
.
License
functime
is distributed under Apache-2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
functime-0.6.1.tar.gz
(59.0 kB
view details)
Built Distribution
functime-0.6.1-py3-none-any.whl
(65.9 kB
view details)
File details
Details for the file functime-0.6.1.tar.gz
.
File metadata
- Download URL: functime-0.6.1.tar.gz
- Upload date:
- Size: 59.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7d00335712bfd7d0983ba760c7e9f6b5867f3053bccf5997f3fe50b80c0dfcf |
|
MD5 | 5eb3610f3d7cbe9414dd0013fb7ed2f5 |
|
BLAKE2b-256 | 5df8f73f30ce0b38bcffc8cf66e16fb901b8e07041d51e3a18593d492f73c0b8 |
File details
Details for the file functime-0.6.1-py3-none-any.whl
.
File metadata
- Download URL: functime-0.6.1-py3-none-any.whl
- Upload date:
- Size: 65.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6740e127b73e9a678c07f1158adcdb6179ec39ae7baed5a18d6da1af21add06b |
|
MD5 | 4d481c8d10c569f8db8ec67a24b0fa1e |
|
BLAKE2b-256 | c3ccc36f96f1d4cc050494f28bc0217698c29e0abe0e6dacf1fcda6131867c65 |