Solved – Plot only OOB Error from RandomForest

I am using random Forest in R and only want to Plot the OOB Error.

When I do plot(myModel, log = "y") I get a diagram where each of my class is a line. On the x-axis are the ntree while on the x-Axis there is the Error rate.

enter image description here

When I try plot(myModel$err.rate, log = "y") I get this:

enter image description here

Why is there no line like the ones above?

The err.rate is stored in a matrix where the first column is the OOB Error. Each class gets its own column.

To access the err.rate do this myModel $err.rate[,1], for plotting simply plot(myModel $err.rate[,1]).

Similar Posts:

Rate this post

Leave a Comment

Solved – Plot only OOB Error from RandomForest

I am using random Forest in R and only want to Plot the OOB Error.

When I do plot(myModel, log = "y") I get a diagram where each of my class is a line. On the x-axis are the ntree while on the x-Axis there is the Error rate.

enter image description here

When I try plot(myModel$err.rate, log = "y") I get this:

enter image description here

Why is there no line like the ones above?

Best Answer

The err.rate is stored in a matrix where the first column is the OOB Error. Each class gets its own column.

To access the err.rate do this myModel $err.rate[,1], for plotting simply plot(myModel $err.rate[,1]).

Similar Posts:

Rate this post

Leave a Comment