gridSearchCV.rpart: gridSearchCV.rpart

Description Format Details Active bindings Methods Author(s) Examples

Description

A cross validation grid search for hyperparameters of the CART tree.

Format

[R6::R6Class] object.

Details

Some mor details will follow

Active bindings

data_df

Returns the instance variable data_df (tibble::tibble)

label

Returns the instance variable label (character)

seed

Returns the instance variable seed (integer)

k

Returns the instance variable k (integer)

repeats

Returns the instance variable repeats (integer)

grid

Returns the instance variable grid (tibble::tibble)

scores

Returns the instance variable scores (tbl_df)

verbose

Returns the instance variable verbose (logical)

Methods

Public methods


Method new()

Creates and returns a new gridSearchCV.rpart object.

Usage
gridSearchCV.rpart$new(
  obj = "tbl_df",
  label = "character",
  grid = "list",
  k = 10,
  repeats = 1,
  seed = 42,
  verbose = FALSE
)
Arguments
obj

The data to be analyzed. (tibble::tibble)

label

The column name of the labels within obj (character)

grid

A list comprising the hyperparameter variations. (list)

k

The corss validation parameter (integer)

repeats

The repeat parameter (integer)

seed

The seed for the cross validation (integer)

verbose

Makes the class print results (logical)

Returns

A new gridSearchCV.rpart object. (pguXAI::gridSearchCV.rpart)


Method finalize()

Clears the heap and indicates that instance of gridSearchCV.rpart is removed from heap.

Usage
gridSearchCV.rpart$finalize()

Method print()

Prints instance variables of a gridSearchCV.rpart object.

Usage
gridSearchCV.rpart$print()
Returns

string


Method calc_model_scores()

creates a crossVal.rpart model and returns its scores

Usage
gridSearchCV.rpart$calc_model_scores(...)
Arguments
...

The ctrl parameter of the model.


Method train()

runs the grid search

Usage
gridSearchCV.rpart$train()

Method best_model_parameter()

Returns the parameters of the best model

Usage
gridSearchCV.rpart$best_model_parameter(score = "character")
Arguments
score

The score parameter by which the optimum is defined (character)


Method clone()

The objects of this class are cloneable with this method.

Usage
gridSearchCV.rpart$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

Sebastian Malkusch, malkusch@med.uni-frankfurt.de

Examples

1
2
3
4
5
data("iris")
df_data = tibble::as_tibble(iris)
ctrl <- rpart::rpart.control(minsplit = 3, maxdepth = 3)
cv <- pguXAI::crossVal.cart$new(obj = df_data, label = "Species", ctrl = ctrl, k = 10)
plot(cv)

SMLMS/pguXAI documentation built on Aug. 15, 2020, 7:09 a.m.