0 purchases
tpk 0.0.1.dev0
tpk (Temporal Predictions Kit)
A collection of tools, models and functionalities for hanling timeseries datasets
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
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:
Links
Documentation
Documentation
Stay in touch
Please show your support and stay in touch by:
giving our GitHub repository{.external-link target="_blank"} a star, and
joining our Discord server{.external-link target="_blank"}
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!
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.