load_model {PriceIndices}R Documentation

Loading the machine learning model from the disk

Description

This function loads a list of machine learning model elements from the disk, i.e. the needed 8 files are read.

Usage

load_model(dir = "ML_model")

Arguments

dir

The name of the directory from which the machine learning model is to be loaded. The directory must be in the working directory.

Value

This function loads a list of ML model elements from the disk, i.e. the needed 8 files are read from the directory selected by dir. After loading the model it can be used for product classification by using data_classifying function.

Examples

#Setting a temporal directory as a working directory
## Not run: wd<-tempdir()
## Not run: setwd(wd)
#Building the model
my.grid=list(eta=c(0.01,0.02,0.05),subsample=c(0.5,0.8))
data_train<-dplyr::filter(dataCOICOP,dataCOICOP$time<=as.Date("2021-10-01"))
data_test<-dplyr::filter(dataCOICOP,dataCOICOP$time==as.Date("2021-11-01"))
ML<-model_classification(data_train,data_test,class="coicop6",grid=my.grid,
indicators=c("description","codeIN", "grammage"),key_words=c("uht"),rounds=60)
#Saving the model
## Not run: save_model(ML, dir="My_model")
#Loading the model
## Not run: ML_fromPC<-load_model("My_model")
#classes predicting
## Not run: data_classifying(ML_fromPC, data_test)

[Package PriceIndices version 0.1.9 Index]