I used caret to train the rpart model below.
trainIndex <- createDataPartition(d$Happiness, p=.8, list=FALSE) dtrain <- d[trainIndex, ] dtest <- d[-trainIndex, ] fitControl <- trainControl(
dtest contains 1296 observations, so I expected testRpart create a testRpart vector. Instead, it lasts 1077, i.e. 219.
When I started the prediction in the first 220 lines of dtest , I got the predicted result 1, so it will be consistently short.
Any explanation why this is so, and what can I do to get a consistent output to the input?
Edit: d can be downloaded from here to reproduce above.
source share