February 2020
Intermediate to advanced
328 pages
8h 19m
English
In this recipe, we will use the shampoo sales dataset that contains the monthly sales of shampoo over a 3-year period. The original dataset is credited to Makridakis, Wheelwright, and Hyndman (1998). It is also available in the GitHub repository of this chapter in the folder named data. Download the shampoo_sales.txt file and copy it to a folder named data in your working directory.
Let's load the required library and read the dataset:
library("mxnet")sales_data <- read.table("data/shampoo_sales.txt",sep = ",",header = TRUE)# We require only one column from the datasetsales_data <- as.data.frame(sales_data[,2])
Next, we normalize the data within a range of 0 to 1 using min-max normalization:
min_max_scaler <- function(x) {Read now
Unlock full access