In this section, we will fit DeepAR to the weekly sales. Let's start by preparing training and test datasets in JSON format.
Let's have a look at the following code, which demonstrates the creation of json lines:
import deepar as datrain_key = 'deepar_sales_training.json'test_key = 'deepar_sales_test.json'#Prediction and context length for training the DeepAR modelprediction_length = 9salesfn = 'data/store20_sales.csv'salesdf = da.retailsales.prepareSalesData(salesfn)testSet = da.retailsales.getTestSales(salesdf, test_key)trainingSet = da.retailsales.getTrainSales(salesdf, train_key, prediction_length)
In the preceding code block, we have created JSON lines for training and testing the datasets:
- The prepareSalesData() function ...