A library for forecasting compositional time series
Project description
compotime
compotime is a library for forecasting compositional time series in Python. 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.
Basic usage
This example uses adapted data on the global share of energy consumption by source (1965-2021).
import pandas as pd
from compotime import LocalTrendForecaster, preprocess
URL = "https://raw.githubusercontent.com/mateuja/compotime/main/examples/data/share_energy_source.csv"
date_parser = lambda x: pd.Period(x, "Y")
time_series = (
pd.read_csv(URL, parse_dates=["Year"], date_parser=date_parser)
.set_index("Year")
.pipe(preprocess.treat_small, 0.001)
)
model = LocalTrendForecaster()
model.fit(time_series)
model.predict(horizon=10)
For more details, see the Documentation.
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
Built Distribution
File details
Details for the file compotime-0.1.0.tar.gz
.
File metadata
- Download URL: compotime-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.17 Linux/5.15.0-1041-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4749e48bda0ba383020113686327667f04d3e01110607b241a7942dab68f967d |
|
MD5 | 9e83eceaabfd16df999609ef99662838 |
|
BLAKE2b-256 | 81ecdef1753db8ff2c56774580b04ef93c92c046f7d226d31b6555a6021eed11 |
File details
Details for the file compotime-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: compotime-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.17 Linux/5.15.0-1041-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2f1853f6eb8f4fd3e246a89130b947160a8df7160f111e06e1fb1624840a37a |
|
MD5 | 312be88072088f17778ed34b9425f789 |
|
BLAKE2b-256 | bd7bbc2098a5bff4d585b0468c3256097a745af97dfe2910b66939a42ef98276 |