Learn R Programming

PriceIndices (version 0.0.6)

data_classifying: Predicting product COICOP levels via the machine learning model

Description

This function predicts product COICOP levels via the selected machine learning model.

Usage

data_classifying(model = list(), data)

Arguments

model

A list of 8 elements which identify the previously built machine learning model (the list is obtained via the model_classification function).

data

A data set for the model (products with their characteristics). This data set must contain all the columns which were used in the built model.

Value

This function provides the indicated data set with an additional column, i.e. coicop_predicted, which is obtained by using the selected machine learning model.

Examples

Run this code
# NOT RUN {
#Building the model
# }
# NOT RUN {
my.grid=list(eta=c(0.01,0.02,0.05),subsample=c(0.5))
# }
# NOT RUN {
data_train<-dplyr::filter(dataCOICOP,dataCOICOP$time<=as.Date("2020-08-01"))
# }
# NOT RUN {
data_test<-dplyr::filter(dataCOICOP,dataCOICOP$time>as.Date("2020-08-01"))
# }
# NOT RUN {
ML<-model_classification(data_train,data_test,grid=my.grid,
indicators=c("prodID","unit","description"),key_words=c("milk"),rounds=50)
# }
# NOT RUN {
#Data classification
# }
# NOT RUN {
data_classifying(ML, data_test)
# }

Run the code above in your browser using DataLab