Model: Stores a previously trained M.L. model.

ModelR Documentation

Stores a previously trained M.L. model.

Description

Encapsulates and handles all the information and operations associated with a M.L. model.

Methods

Public methods


Method new()

Method for initializing the object arguments during runtime.

Usage
Model$new(dir.path, model)
Arguments
dir.path

The location were the executed models will be saved.

model

A Model object.


Method isTrained()

The function is used to determine is the model has been already trained.

Usage
Model$isTrained()
Returns

A logical value. TRUE if the model has been trained and FALSE otherwise.


Method getDir()

The function returns the location path of the specific model.

Usage
Model$getDir()
Returns

A character vector specifying the location of the model.


Method getName()

The function is used to obtain the name of the model.

Usage
Model$getName()
Returns

A character vector with the name of the model.


Method getFamily()

The function gets the family of the model.

Usage
Model$getFamily()
Returns

A character vector representing the family of the ML model.


Method getDescription()

The function allows obtaining the description associated with an specific ML model.

Usage
Model$getDescription()
Returns

A character vector with the model description.


Method train()

The function is responsible of performing model training operation.

Usage
Model$train(train.set, fitting, trFunction, metric, logs)
Arguments
train.set

A data.frame with the data used for training the model.

fitting

The model fitting formula. Must inherit from GenericModelFit class.

trFunction

An object inherited from TrainFunction used to define how the training acts.

metric

A character vector containing the metrics used to optimized model parameters.

logs

A character vector containing the path to store the error logs.


Method getTrainedModel()

The function allows obtaining the trained model.

Usage
Model$getTrainedModel()
Returns

A train class.


Method getExecutionTime()

The function is used to compute the time taken to perform training operation.

Usage
Model$getExecutionTime()
Returns

A numeric vector with length 1.


Method getPerformance()

The function obtains the performance achieved by the model during training stage.

Usage
Model$getPerformance(metric = private$metric)
Arguments
metric

A character used to specify the measure used to compute the performance.

Returns

A numeric value with the performance achieved.


Method getConfiguration()

The function is used to get the configuration parameters achieved by the ML model after the training stage.

Usage
Model$getConfiguration()
Returns

A list object with the configuration parameters.


Method save()

The function is responsible of saving the model to disc into a RDS file.

Usage
Model$save(replace = TRUE)
Arguments
replace

A logical value used to determine if model should be resaved. TRUE forces to replace previous saved model while FALSE keeps unchanged the previous model.


Method remove()

The function is used to delete a model from disc.

Usage
Model$remove()

Method clone()

The objects of this class are cloneable with this method.

Usage
Model$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

D2MCS, TrainFunction


D2MCS documentation built on Aug. 23, 2022, 5:07 p.m.