train_tree: Train a classification tree

Description Usage Arguments Value Examples

Description

This function trains a classification decision tree using the rpart package.

Usage

1
train_tree(objective, data)

Arguments

objective

The objective function for training, of type formula.

data

Training dataset, a dataframe.

Value

tree.model A classification model.

Examples

1
2
3
4
5
6
 train.index <- split_data(iris.data, 0.7)
 training.data <- iris.data[train.index, ]
 test.data <- iris.data[-train.index, ]

 obj.func <- formula(Species ~ Sepal.Length + Sepal.Width)
 my.model <- train_tree(obj.func, training.data)

PACCAR/DataScience_PkgPattern documentation built on May 7, 2019, 11:48 p.m.