as_prediction_regr(x,...)## S3 method for class 'PredictionRegr'as_prediction_regr(x,...)## S3 method for class 'data.frame'as_prediction_regr(x,...)
Arguments
x: (any)
Object to convert.
...: (any)
Additional arguments.
Returns
PredictionRegr .
Examples
# create a prediction objecttask = tsk("mtcars")learner = lrn("regr.rpart")learner$train(task)p = learner$predict(task)# convert to a data.tabletab = as.data.table(p)# convert back to a Predictionas_prediction_regr(tab)# split data.table into a list of data.tablestabs = split(tab, cut(tab$truth,3))# convert back to list of predictionspreds = lapply(tabs, as_prediction_regr)# calculate performance in each groupsapply(preds,function(p) p$score())