Skip to main content

A library for forecasting compositional time series

Project description

compotime

Build codecov

compotime is a library for forecasting compositional time series. At the moment, it provides an implementation of the models described in the paper "Forecasting compositional time series: A state space approach" (Snyder, R.D. et al, 2017). It is constantly tested to be compatible with the major machine learning and statistics libraries within the Python ecosystem.

Quick install

compotime is currently available for python 3.9, 3.10 and 3.11. It can be installed from PyPI:

pip install compotime

Basic usage

This example uses adapted data on the popularity of programming languages (PYPL).

import pandas as pd

from compotime import LocalTrendForecaster, preprocess

URL = "https://raw.githubusercontent.com/mateuja/compotime/main/examples/data/proglangpop_sample.csv"

time_series = pd.read_csv(URL, converters={"Date": pd.Period}, index_col="Date").pipe(
    preprocess.treat_small, 1e-3
)

model = LocalTrendForecaster().fit(time_series)
model.predict(horizon=10)

For more details, see the Documentation.

Project details


Download files

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

Source Distribution

compotime-0.3.0.tar.gz (9.8 kB view hashes)

Uploaded Source

Built Distribution

compotime-0.3.0-py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 3

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