create.eval.cart: Build & Evaluate Classificaion & Regression Trees (CART)

Description Usage Arguments Value Author(s) Examples

View source: R/create_evaluate_cart.R

Description

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.

Usage

1
2
create.eval.cart(x, response, seed = 42, splitRatio = 0.7,
  minbucket = 10, cp = 0, prune = FALSE, plot = TRUE)

Arguments

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

Value

A List with Model Attributes & Evaluation Results

Author(s)

Gupta, Deepak deepak@analyticsacedemy.ml

Examples

1

guptadeepak18/DTAME documentation built on Dec. 25, 2019, 9:14 a.m.