- ข่าวด่วน : เราเปิด ตัว Chronos ซึ่งเป็นชุดของรุ่นที่ผ่านการฝึกอบรมสำหรับการพยากรณ์อนุกรมเวลาที่ไม่มีการยิง Chronos สามารถสร้างการทำนายความน่าจะเป็นที่แม่นยำสำหรับอนุกรมเวลาใหม่ที่ไม่เห็นในระหว่างการฝึกอบรม ตรวจสอบที่นี่!
Gluonts เป็นแพ็คเกจ Python สำหรับการสร้างแบบจำลองอนุกรมเวลาที่น่าจะเป็นโดยมุ่งเน้นไปที่โมเดลที่ใช้การเรียนรู้อย่างลึกซึ้งขึ้นอยู่กับ Pytorch และ MXNET
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 เราฝึกอบรมแบบจำลองลึกและทำการคาดการณ์โดยใช้ชุดข้อมูล AirPassengers ชุดข้อมูลประกอบด้วยชุดเวลาเดียวของจำนวนผู้โดยสารรายเดือนระหว่างปี 1949 และ 1960 เราฝึกอบรมแบบจำลองในช่วงเก้าปีแรกและทำการคาดการณ์สำหรับอีกสามปีที่เหลือ
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 }
}