Decision tree and random forest in R

decisiontree
random_forest
decision_trees
randomforest

#1

while running decision tree in r I’m getting the following error:
Error in plot.tree(fit) : cannot plot single node tree

data sample is below:

1 35 0 0 65 0 0 67.5 0 0
1 47 0 0 65 0 0 67.5 0 0
2 32 0 0 65 0 0 67.5 0 0
2 24 0 0 65 0 0 67.5 0 0
3 56 0 0 65 0 0 67.5 0 0
2 38 0 0 65 0 0 67.5 0 0
4 31 0 0 65 0 0 67.5 2 4800
4 47 0 0 65 0 0 67.5 0 0
4 40 0 0 65 0 0 67.5 0 0
5 17 0 0 65 0 0 67.5 0 0
4 46 0 0 65 0 0 67.5 0 0
Target variable not included here -its 0,1 for each of the rows.

when I use ctree I get some kind of result with this data.

I want to try random forest on this too.but again I’m facing the same issue


#2

will be able to help if you share your code


#3

hello @nehak,

the plot is not being generated as your tree has only one node,which means there is not enough variance in your data for the splits.