Updating a model specification

# S3 method for C5_rules
update(
  object,
  parameters = NULL,
  trees = NULL,
  min_n = NULL,
  fresh = FALSE,
  ...
)

# S3 method for cubist_rules
update(
  object,
  parameters = NULL,
  committees = NULL,
  neighbors = NULL,
  max_rules = NULL,
  fresh = FALSE,
  ...
)

# S3 method for rule_fit
update(
  object,
  parameters = NULL,
  mtry = NULL,
  trees = NULL,
  min_n = NULL,
  tree_depth = NULL,
  learn_rate = NULL,
  loss_reduction = NULL,
  sample_size = NULL,
  penalty = NULL,
  fresh = FALSE,
  ...
)

Arguments

object

A rule_fit model specification.

parameters

A 1-row tibble or named list with main parameters to update. If the individual arguments are used, these will supersede the values in parameters. Also, using engine arguments in this object will result in an error.

trees

A non-negative integer (no greater than 100 for the number of members of the ensemble.

min_n

An integer greater than one zero and nine for the minimum number of data points in a node that are required for the node to be split further.

fresh

A logical for whether the arguments should be modified in-place or replaced wholesale.

...

Not used for update().

committees

A non-negative integer (no greater than 100 for the number of members of the ensemble.

neighbors

An integer between zero and nine for the number of training set instances that are used to adjust the model-based prediction.

max_rules

The largest number of rules.

mtry

An number for the number (or proportion) of predictors that will be randomly sampled at each split when creating the tree models.

tree_depth

An integer for the maximum depth of the tree (i.e. number of splits).

learn_rate

A number for the rate at which the boosting algorithm adapts from iteration-to-iteration.

loss_reduction

A number for the reduction in the loss function required to split further .

sample_size

An number for the number (or proportion) of data that is exposed to the fitting routine.

penalty

L1 regularization parameter.

Examples


# ------------------------------------------------------------------------------

model <- C5_rules(trees = 10, min_n = 2)
model
#> C5.0 Model Specification (classification)
#> 
#> Main Arguments:
#>   trees = 10
#>   min_n = 2
#> 
#> Computational engine: C5.0 
#> 
update(model, trees = 1)
#> C5.0 Model Specification (classification)
#> 
#> Main Arguments:
#>   trees = 1
#>   min_n = 2
#> 
#> Computational engine: C5.0 
#> 
update(model, trees = 1, fresh = TRUE)
#> C5.0 Model Specification (classification)
#> 
#> Main Arguments:
#>   trees = 1
#> 
#> Computational engine: C5.0 
#> 

# ------------------------------------------------------------------------------

model <- cubist_rules(committees = 10, neighbors = 2)
model
#> Cubist Model Specification (regression)
#> 
#> Main Arguments:
#>   committees = 10
#>   neighbors = 2
#> 
#> Computational engine: Cubist 
#> 
update(model, committees = 1)
#> Cubist Model Specification (regression)
#> 
#> Main Arguments:
#>   committees = 1
#>   neighbors = 2
#> 
#> Computational engine: Cubist 
#> 
update(model, committees = 1, fresh = TRUE)
#> Cubist Model Specification (regression)
#> 
#> Main Arguments:
#>   committees = 1
#> 
#> Computational engine: Cubist 
#> 
# ------------------------------------------------------------------------------

model <- rule_fit(trees = 10, min_n = 2)
model
#> RuleFit Model Specification (unknown)
#> 
#> Main Arguments:
#>   trees = 10
#>   min_n = 2
#> 
#> Computational engine: xrf 
#> 
update(model, trees = 1)
#> RuleFit Model Specification (unknown)
#> 
#> Main Arguments:
#>   trees = 1
#>   min_n = 2
#> 
#> Computational engine: xrf 
#> 
update(model, trees = 1, fresh = TRUE)
#> RuleFit Model Specification (unknown)
#> 
#> Main Arguments:
#>   trees = 1
#> 
#> Computational engine: xrf 
#>