gluonts
0.16.0
?ニュース速報:ゼロショット時系列予測のための一連の前提型モデルであるChronosをリリースしました。クロノスは、トレーニング中に見られない新しい時系列の正確な確率的予測を生成できます。ここでチェックしてください!
Gluontsは、PytorchとMXNetに基づいた深い学習ベースのモデルに焦点を当てた、確率的時系列モデリングのPythonパッケージです。
GluontsにはPython 3.7以降が必要であり、それをインストールする最も簡単な方法はpip経由です。
# install with support for torch models
pip install " gluonts[torch] "
# install with support for mxnet models
pip install " gluonts[mxnet] "Gluontsのインストール方法の詳細については、ドキュメントを参照してください。
Gluontsの使用方法を説明するために、Deeparモデルをトレーニングし、Airpassengers Datasetを使用して予測を行います。データセットは、1949年から1960年の間に毎月の乗客数の単一の時系列で構成されています。最初の9年間でモデルを訓練し、残りの3年間は予測を行います。
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
# 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 = DeepAREstimator (
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 ()注、予測は確率分布の観点から表示され、網掛け領域は50%と90%の予測間隔を表しています。
プロジェクトに貢献したい場合は、貢献ガイドラインを参照してください。
科学的出版物でGluontsを使用する場合は、作業に関連するモデル固有の参照に加えて、関連する論文に次の参照を追加することをお勧めします。
@article { gluonts_jmlr ,
author = { Alexander Alexandrov and Konstantinos Benidis and Michael Bohlke-Schneider
and Valentin Flunkert and Jan Gasthaus and Tim Januschowski and Danielle C. Maddix
and Syama Rangapuram and David Salinas and Jasper Schulz and Lorenzo Stella and
Ali Caner Türkmen and Yuyang Wang } ,
title = { {GluonTS: Probabilistic and Neural Time Series Modeling in Python} } ,
journal = { Journal of Machine Learning Research } ,
year = { 2020 } ,
volume = { 21 } ,
number = { 116 } ,
pages = { 1-6 } ,
url = { http://jmlr.org/papers/v21/19-820.html }
} @article { gluonts_arxiv ,
author = { Alexandrov, A. and Benidis, K. and Bohlke-Schneider, M. and
Flunkert, V. and Gasthaus, J. and Januschowski, T. and Maddix, D. C.
and Rangapuram, S. and Salinas, D. and Schulz, J. and Stella, L. and
Türkmen, A. C. and Wang, Y. } ,
title = { {GluonTS: Probabilistic Time Series Modeling in Python} } ,
journal = { arXiv preprint arXiv:1906.05264 } ,
year = { 2019 }
}