Learn Before
Relation
Implemention of Regression Tree in R
Step 1: Split data into training data and test data set.seed(1) train = sample (1:nrow(data), nrow(data)/2) This code is to randomnize the dataset and get training data
Step 2: Build a model and get a summary of this model model=tree(output∼.,data ,subset=train) summary(model)
Step 3: Improve performance cv.tree(model) This is used to see whether pruning the tree will improve performance.
0
2
Updated 2020-04-25
Tags
Data Science