Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

tpk (Temporal Predictions Kit)

A collection of tools, models and functionalities for hanling timeseries datasets

Test Passing Coverage Downloads Package version Supported Python versions
CodeQL Dependency Review License Code of Conduct Discord

Installation

tpk requires Python 3.7 or newer, and the easiest way to install it is via pip:

pip install tpk"

Simple Example

To illustrate how to use tpk, we train a model and make predictions using the airpassengers dataset. The dataset consists of a single time series of monthly passenger numbers between 1949 and 1960. We train the model on the first nine years and make predictions for the remaining three years.

import pandas as pd
import matplotlib.pyplot as plt

from gluonts.dataset.pandas import PandasDataset
from gluonts.dataset.split import split
from gluonts.torch import DeepAREstimator
from tpk.torch import TPKEstimator

# Load data from a CSV file into a PandasDataset
df = pd.read_csv(
    "https://raw.githubusercontent.com/AileenNielsen/"
    "TimeSeriesAnalysisWithPython/master/data/AirPassengers.csv",
    index_col=0,
    parse_dates=True,
)
dataset = PandasDataset(df, target="#Passengers")

# Split the data for training and testing
training_data, test_gen = split(dataset, offset=-36)
test_data = test_gen.generate_instances(prediction_length=12, windows=3)

# Train the model and make predictions
model = TPKEstimator(
    prediction_length=12, freq="M", trainer_kwargs={"max_epochs": 5}
).train(training_data)

forecasts = list(model.predict(test_data.input))

# Plot predictions
plt.plot(df["1954":], color="black")
for forecast in forecasts:
  forecast.plot()
plt.legend(["True values"], loc="upper left", fontsize="xx-large")
plt.show()
todo: replace me

[train-test]

Note, the forecasts are displayed in terms of a probability distribution and the shaded areas represent the 50% and 90% prediction intervals.

Contributing

If you wish to contribute to the project, please refer to our contribution guidelines.

Citing

If you use tpk in a scientific publication, we encourage you to add the following references to the related papers, in addition to any model-specific references that are relevant for your work:

Documentation

Stay in touch

Please show your support and stay in touch by:

Your support helps us to stay in touch with you and encourages us to continue developing and improving the framework. Thank you for your support!


Contributors

Thanks to all of these amazing people who made the project better!

Metadata

Release files for tpk 0.0.1.dev0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tpk 0.0.1.dev0
File Size Uploaded
tpk-0.0.1.dev0.tar.gz 32.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tpk 0.0.1.dev0
File Interpreter ABI Platform
tpk-0.0.1.dev0-py3-none-any.whl Python 3 none any Details

Total release size: 63.3 kB

Release files / tpk-0.0.1.dev0.tar.gz

Download URL tpk-0.0.1.dev0.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e764a5621aec0119ce87b4c451cc05472da07ad3802873c35e677459047cba29
BLAKE2b-256 checksum
How to use checksums
53130fcc4375f72eb4292439fdf3a919deedb5f3797079e9ec8c7a9747991b4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / tpk-0.0.1.dev0-py3-none-any.whl

Download URL tpk-0.0.1.dev0-py3-none-any.whl
Size 30.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41d7965c5be40b3b6a7c09459f4fc73aa40c2352bb28d291a64e2deabf88e72f
BLAKE2b-256 checksum
How to use checksums
f1dcce61a77b4349109e1c5235204462bc1efab20f38d169e412f198c24e6725
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.0.1.dev0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page