Package: deeprenewal
GluonTS Implementation of Deep Renewal ProcessesIntermittent Demand Forecasting with Deep Renewal Processes
Ali Caner Turkmen, Yuyang Wang, Tim JanuschowskiTable of ContentsInstallationDatasetDownloadDescriptionModelUsageTrainResultBlogReferencesInstallationRecommended Python Version: 3.6pip install deeprenewalIf you are working Windows and need to use your GPU(which I recommend), you need to first install MXNet==1.6.0 version which supports GPUMXNet Official Installation PageAnd if you are facing difficulties installing the GPU version, you can try(depending on the CUDA version you have)pip install mxnet-cu101==1.6.0 -f https://dist.mxnet.io/python/allRelevant Github IssueThe sources for DeepRenewal can be downloaded from theGithub repo_.You can either clone the public repository:git clone git://github.com/manujosephv/deeprenewalOnce you have a copy of the source, you can install it with:python setup.py installDatasetDownloadRetail DatasetDescriptionIt is a transactional data set which contains all the transactions occurring between 01/12/2010 and 09/12/2011 for a UK-based and registered non-store online retail. The company mainly sells unique all-occasion gifts. Many customers of the company are wholesalers.Columns:InvoiceNo: Invoice number. Nominal, a 6-digit integral number uniquely assigned to each transaction. If this code starts with letter ‘c’, it indicates a cancellation.StockCode: Product (item) code. Nominal, a 5-digit integral number uniquely assigned to each distinct product.Description: Product (item) name. Nominal.Quantity: The quantities of each product (item) per transaction. Numeric.InvoiceDate: Invice Date and time. Numeric, the day and time when each transaction was generated.UnitPrice: Unit price. Numeric, Product price per unit in sterling.CustomerID: Customer number. Nominal, a 5-digit integral number uniquely assigned to each customer.Country: Country name. Nominal, the name of the country where each customer resides.Preprocessing:Group by at StockCode, Country, InvoiceDate –> Sum of Quantity, and Mean of UnitPriceFilled in zeros to make timeseries continuousClip lower value of Quantity to 0(removing negatives)Took only Time series which had length greater than 52 days.Train Test Split Date: 2011-11-01Stats:No. of Timeseries: 3828. After filtering: 3671Quantity: Mean = 3.76, Max = 12540, Min = 0, Median = 0Heavily Skewed towards zeroTime Series SegmentationWe can see that almost 98% of the timeseries in the dataset are either Intermittent or Lumpy, which is perfect for our use case.ModelUsageTrain with CLIusage: deeprenewal [-h] [--use-cuda USE_CUDA] 
                   [--datasource {retail_dataset}]
                   [--regenerate-datasource REGENERATE_DATASOURCE]
                   [--model-save-dir MODEL_SAVE_DIR]
                   [--point-forecast {median,mean}]
                   [--calculate-spec CALCULATE_SPEC] 
                   [--batch_size BATCH_SIZE]
                   [--learning-rate LEARNING_RATE] 
                   [--max-epochs MAX_EPOCHS]
                   [--number-of-batches-per-epoch NUMBER_OF_BATCHES_PER_EPOCH]
                   [--clip-gradient CLIP_GRADIENT]
                   [--weight-decay WEIGHT_DECAY]
                   [--context-length-multiplier CONTEXT_LENGTH_MULTIPLIER]
                   [--num-layers NUM_LAYERS] 
                   [--num-cells NUM_CELLS]
                   [--cell-type CELL_TYPE] 
                   [--dropout-rate DROPOUT_RATE]
                   [--use-feat-dynamic-real USE_FEAT_DYNAMIC_REAL]
                   [--use-feat-static-cat USE_FEAT_STATIC_CAT]
                   [--use-feat-static-real USE_FEAT_STATIC_REAL]
                   [--scaling SCALING]
                   [--num-parallel-samples NUM_PARALLEL_SAMPLES]
                   [--num-lags NUM_LAGS] 
                   [--forecast-type FORECAST_TYPE]

GluonTS implementation of paper 'Intermittent Demand Forecasting with Deep
Renewal Processes'

optional arguments:
  -h, --help            show this help message and exit
  --use-cuda USE_CUDA
  --datasource {retail_dataset}
  --regenerate-datasource REGENERATE_DATASOURCE
                        Whether to discard locally saved dataset and
                        regenerate from source
  --model-save-dir MODEL_SAVE_DIR
                        Folder to save models
  --point-forecast {median,mean}
                        How to estimate point forecast? Mean or Median
  --calculate-spec CALCULATE_SPEC
                        Whether to calculate SPEC. It is computationally
                        expensive and therefore False by default
  --batch_size BATCH_SIZE
  --learning-rate LEARNING_RATE
  --max-epochs MAX_EPOCHS
  --number-of-batches-per-epoch NUMBER_OF_BATCHES_PER_EPOCH
  --clip-gradient CLIP_GRADIENT
  --weight-decay WEIGHT_DECAY
  --context-length-multiplier CONTEXT_LENGTH_MULTIPLIER
                        If context multipler is 2, context available to hte
                        RNN is 2*prediction length
  --num-layers NUM_LAYERS
  --num-cells NUM_CELLS
  --cell-type CELL_TYPE
  --dropout-rate DROPOUT_RATE
  --use-feat-dynamic-real USE_FEAT_DYNAMIC_REAL
  --use-feat-static-cat USE_FEAT_STATIC_CAT
  --use-feat-static-real USE_FEAT_STATIC_REAL
  --scaling SCALING     Whether to scale targets or not
  --num-parallel-samples NUM_PARALLEL_SAMPLES
  --num-lags NUM_LAGS   Number of lags to be included as feature
  --forecast-type FORECAST_TYPE
                        Defines how the forecast is decoded. For details look
                        at the documentationAn example of training process is as follows:python3 deeprenewal --datasource retail_dataset --lr 0.001 --epochs 50Train with Jupyter NotebookCheck out the examples folder for notebooksResultMethodQuantileLoss[0.25]QuantileLoss[0.5]QuantileLoss[0.75]mean_wQuantileLossCroston664896.9323791880.3858918863.83921.034257626SBA623338.1011776084.5519928831.00281.013627034SBJ627880.7754779758.6188931636.46221.018425652ARIMA598779.2977784662.7412957980.8141.019360367ETS622502.7789796128.4957808.40871.03460523DeepAR378217.1822679862.7643808336.34820.812561813NPTS380956725255935102.50.88870495DeepRenewal Flat383524.4007764167.86381047169.8940.955553796DeepRenewal Exact382825.57656401141210.50.99683189DeepRenewal Hybrid389981.2253761474.49661069187.0320.96677762BlogFor a more detailed account of the implementation and the experiments please visit the blog:References[1] Ali Caner Turkmen, Yuyang Wang, Tim Januschowski."Intermittent Demand Forecasting with Deep Renewal Processes". arXiv:1911.10416 [cs.LG] (2019)
[2] Alexander Alexandrov, Konstantinos Benidis, Michael Bohlke-Schneider, Valentin Flunkert, Jan Gasthaus, Tim Januschowski, Danielle C. Maddix, Syama Rangapuram, David Salinas, Jasper Schulz, Lorenzo Stella, Ali Caner Türkmen, Yuyang Wang;."GluonTS: Probabilistic and Neural Time Series Modeling in Python". (2020).History0.3.1 (2020-10-15)Dependencies were not getting included. Fixed that0.3.0 (2020-10-15)Fixed a build error0.2.0 (2020-10-15)Switched documentation to mkdocsRemoved support for python 3.5Fixed a build issue in docsRemoved dynamic real fom dataset. Was throwing error and was not using itWeird Error in build. Included python version in Travishttps://github.com/travis-ci/travis-ci/issues/10056#issuecomment-437667181Fixed error with long readmehttps://github.com/pypa/warehouse/issues/5890#issuecomment-4948681570.1.2 (2020-10-13)Minor changes in documentation.0.1.0 (2020-10-13)First release on PyPI.