A deeper insight into random forest regression

Let’s try out a little toy example to see how all the regression methods integrated in mlr behave on a schoolbook example. Luckily this can be done with just a few lines of code - but let’s narrow it done to those which support uncertainty estimation. Let’s generate a list with all mlr-learners fitting the criteria.

library(mlr)
learners = listLearners("regr", properties = "se", create = TRUE)

Let’s generate some easy data:

set.seed(123)
n = 50
x = rchisq(n, df = 2, ncp = 3)
y = rnorm(n, mean = (x-2)^2, sd = seq(1, 3, length.out = n)^2)
y[1:5] = -20 # generate some measuring error
toy.task = makeRegrTask(id = "toy", data = data.frame(x,y), target = "y")

Now we can already create all the graphs:

for(lrn in learners) {
  print(plotLearnerPrediction(lrn, toy.task, cv = 0))
}

plot of chunk regression visualizationplot of chunk regression visualizationplot of chunk regression visualizationplot of chunk regression visualizationplot of chunk regression visualizationplot of chunk regression visualizationplot of chunk regression visualizationplot of chunk regression visualizationplot of chunk regression visualization

## Error in apply(d$data[, not.const], 2, function(x) x = (x - min(x))/(max(x) - : dim(X) must have a positive length

plot of chunk regression visualization

Hu? It looks like we shamelessly copied the code from the last blog-post. How easy!

Written on September 28, 2015 by Jakob Richter