Im new to decision trees and am trying some decision tree modelling now with titanic data.
I have the following dataset.
train <- read.csv(url("http://s3.amazonaws.com/assets.datacamp.com/course/Kaggle/train.csv"))
Now when I create a decision tree doing this:
my_tree_two <- rpart(Survived ~ Sex + Age, data=train, method="class")
my_tree_two
I get the following output.
n= 891 node), split, n, loss, yval, (yprob)
* denotes terminal node
1) root 891 342 0 (0.6161616 0.3838384)
2) Sex=male 577 109 0 (0.8110919 0.1889081)
4) Age>=6.5 553 93 0 (0.8318264 0.1681736) *
5) Age< 6.5 24 8 1 (0.3333333 0.6666667) *
3) Sex=female 314 81 1 (0.2579618 0.7420382) *
I understand most of it but what I do not understand is why age divided into age >= 6.5 and < 6.5? Could anybody elaborate on this?