SANDESH SAMAKA
SANDESH SAMAKA

Reputation: 35

Predicting regression tree using rpart (iris dataset)

IRIS DATSET

dt3 = rpart(Species ~., control = rpart.control( minsplit = 10, maxdepth = 5),data=iris , method = "poisson")  

dt3 [contents obtained from dt3][2]   

and the plot is as shown.

IRIS DATASET Regression Tree Plot

So my question is, what are the parameters in specific boxes what is 2 ; 300 / 150 and 100% in root node while using regression tree? Please help me with the solution.

Upvotes: 0

Views: 615

Answers (1)

akhil sood
akhil sood

Reputation: 97

I am not sure why you decided to use poisson distribution with the data, If you don't pass method parameter, it will generate this graph -

enter image description here

As per rpart.plot documentation (that you use and didn't mention!) -

Each node shows
- the predicted class
- the predicted probability of each class,
- the percentage of observations in the node.

So in first node, majority class in setosa, each class has 33% probability, and 100% of observations are used. Similarly in green node, majority class is virginica, 98% of data belongs to virginica, and 31% of observations are present in this node.

Please google before posting here and refer to documentation. Plus always give code you used with data.

Upvotes: 1

Related Questions