Learn R Programming

OptimClassifier (version 0.1.5)

Optim.CART: Tune CART for the optimal complexity parameter

Description

The complexity parameter aims to save computing time by pruning off splits that are obviously not worthwhile. This function starting with null value of cp and ranks the different possibles levels of pruning trees find best CART for different levels of cost complexity. The main role of this parameter is to save computing time by pruning off splits that are obviously not worthwhile.

Usage

Optim.CART(formula, data, p, includedata = FALSE, seed = NULL, ...)

Arguments

formula

A formula of the form y ~ x1 + x2 + …

data

Data frame from which variables specified in formula are preferentially to be taken.

p

A percentage of training elements

includedata

logicals. If TRUE the training and testing datasets are returned.

seed

a single value, interpreted as an integer, or NULL. The default value is NULL, but for future checks of the model or models generated it is advisable to set a random seed to be able to reproduce it.

...

arguments passed to rpart

Value

An object of class Optim. See Optim.object

Details

Classification And Regression Tree (CART) are a decision tree learning technique that produces either classification or regression trees, first introduced by Breiman et al.(1984). Trees used for regression and trees used for classification have some similarities - but also some differences, such as the procedure used to determine where to split.

References

Breiman L., Friedman J. H., Olshen R. A., and Stone, C. J. (1984) Classification and Regression Trees. Wadsworth.

Examples

Run this code
# NOT RUN {
if(interactive()){
## Load a Dataset
data(AustralianCredit)
## Generate a model
modelFit <- Optim.CART(Y~., AustralianCredit, p = 0.7, seed=2018)
modelFit
}

# }

Run the code above in your browser using DataLab