crossVal.rpart: crossVal.rpart

Description Format Details Active bindings Methods Author(s) Examples

Description

A Cross Validation for the CART tree.

Format

[R6::R6Class] object.

Details

Some mor details will follow

Active bindings

df_data

Returns the instance variable df_data (tibble::tibble)

label

Returns the instance variable label (character)

seed

Returns the instance variable seed (integer)

lvls

Returns the instance variable lvls (character)

k

Returns the instance variable k (integer)

ctrl

Returns the instance variable ctrl (rpart::rpart.control)

auc_roc

Returns the instance variable auc_roc (numeric)

confusion_matrix

Returns the instance variable confucion_matrix

scores

Returns the cross validation scores (tibble::tibble)

accuracy

Returns the corss validation accuracy (numeric)

verbose

Returns the corss validation verbose (logical)

Methods

Public methods


Method new()

Creates and returns a new crossVal.rpart object.

Usage
crossVal.rpart$new(
  obj = "tbl_df",
  label = "character",
  ctrl = "rpart::rpart.control",
  k = 10,
  seed = 42,
  verbose = FALSE
)
Arguments
obj

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

label

The column name of the labels within obj (character)

ctrl

The control sequence for the CART tree (rpart::rpart.control)

k

The corss validation parameter (integer)

seed

The seed for the cross validation (integer)

verbose

Makes the class print results (logical)

Returns

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


Method train()

trains the model

Usage
crossVal.rpart$train(repeats = 1)
Arguments
repeats

The repeat parameter (integer)


Method finalize()

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

Usage
crossVal.rpart$finalize()

Method print()

Prints instance variables of a crossVal.rpart object.

Usage
crossVal.rpart$print()
Returns

string


Method plot()

Plots the confusion matrix of the cross validation

Usage
crossVal.rpart$plot()

Method clone()

The objects of this class are cloneable with this method.

Usage
crossVal.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.rpart$new(obj = df_data, label = "Species", ctrl = ctrl, k = 10)
plot(cv)

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