Description Usage Arguments Value Author(s) Examples
View source: R/create_evaluate_cart.R
This function takes a dataframe as an input along with the name of the response variable. It then sets the seed as per user or default value and split the data into training and testing sets. After the split it builds a CART model on training data and evaluates the performance of the model on different Evaluation methods. It can also optimize the CART tree by pruning it as per the least Cross Validation error, user has to define if they want the model to be pruned or not.
1 2 | create.eval.cart(x, response, seed = 42, splitRatio = 0.7,
minbucket = 10, cp = 0, prune = FALSE, plot = TRUE)
|
x |
Data Frame that you want to work with |
response |
Dependent(Target) Variable |
seed |
Seed Value, default = 42 |
splitRatio |
Ratio to split the dataframe into Train and Test |
minbucket |
Minimum number of observations that should be present in each leaf/terminal node |
cp |
Cost Complexity Paramter Value |
prune |
Pruning Tree on the basis of minimum Cross Validation Error (xerror), default = FALSE |
plot |
Plot the model Tree and CP Table |
A List with Model Attributes & Evaluation Results
Gupta, Deepak deepak@analyticsacedemy.ml
1 | create.eval.cart(sleep, group, plot = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.