data format - from pandas to gluonts data format for both uni-variate and multivariate data
See original GitHub issueHi @kashif
I hope your well! I am just trying to get familiar with the library and I generally work with the pandas data format. Could you help me format my data and create a basic uni-variate model for prediction into the future.
import numpy as np
import pandas as pd
import yfinance as yf
data = yf.download("SPY", start="2012-01-01", end="2017-04-30")['Adj Close']
data=pd.DataFrame(data)
data
from gluonts.dataset.common import ListDataset
training_data = ListDataset(
[{"start": data.index[0], "target": data.values[:1300]}],
freq = "1D"
)
from gluonts.dataset.common import ListDataset
test_data = ListDataset(
[{"start": data.index[1301], "target": data.values[1301:1339]}],
freq = "1D"
)
from gluonts.model.simple_feedforward import SimpleFeedForwardEstimator
from gluonts.mx.trainer import Trainer
estimator = SimpleFeedForwardEstimator(
num_hidden_dimensions=[10],
prediction_length=38,
context_length=100,
freq='1D',
trainer=Trainer(ctx="cpu",
epochs=5,
learning_rate=1e-3,
num_batches_per_epoch=100
)
)
predictor = estimator.train(training_data=training_data)
Issue Analytics
- State:
- Created 3 years ago
- Comments:12
Top Results From Across the Web
from pandas to gluonts data format for both uni-variate and ...
I am just trying to get familiar with the library and I generally work with the pandas data format. Could you help me...
Read more >pandas.DataFrame based dataset - GluonTS documentation
This tutorial covers how to use GluonTS's pandas DataFrame based dataset ... Here, we are given data in the wide format, where time...
Read more >Timeseries forecasting with gluonts and DeepAR - Kaggle
GluonTS is a Python package for time series forecasting, focusing on deep ... Model + Paper, Local/global, Data layout, Architecture/method, Implementation ...
Read more >Basic usage of GluonTS for probabilistic, deep learning-based ...
The data are originally in CSV format. ... Unlike traditional univariate forecasting models, recent deep learning-based models are capable ...
Read more >Guide To GluonTS and PytorchTS For Time-Series Forecasting
#importing gluonTS utilities and pandas from gluonts.dataset import ... prediction = next(predictor.predict(data)) print(prediction.mean) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@andrewcztrack you just make a list of dicts with
"target": [1, 4,2, ....]
and"start"
being the start date and this list you use to instantiate thetrain_ds = ListDataset(...)
So just loop over you pandas dataframe assuming it has multiple time series and for each time series just make the target and start dictonary…Hi @kashif ! my laptop is about to die. can I touch base in a few hours. Kind regards and thanks, Andrew