我们的团队运行以下代码来创建随机森林模型并对其进行训练:
# Define a cross validation strategy
rdesc <- makeResampleDesc("CV", iters = cv_fold, predict = "both")
# Define a (regression) task
task_01 = makeRegrTask(data = data.model, target = "target_actual")
# Make a learner
lrn_rf = makeLearner("regr.randomForestSRC", predict.type = "response",
fix.factors.prediction = TRUE,
par.vals = list(nodesize = 50, mtry = 36, ntree = 500))
set.seed(7)
model_rf = mlr::resample(lrn_rf, task_01, rdesc, models = TRUE,
extract = function(x) getLearnerModel(x),
measures = list(rmse, rsq), show.info = FALSE)
model_rf
大多数情况下,该模型预测了有意义的连贯结果。然而,当我在我的两个同事的计算机上运行完全相同的代码(没有任何变化)时,该模型预测了这些奇怪的结果:
Resample Result
Task: data.model
Learner: regr.randomForestSRC
Aggr perf: rmse.test.rmse=361.1464455,rsq.test.mean=-588.1729057
Runtime: 4.0032
仅在两台计算机上而在其他计算机上没有这种奇怪行为的原因可能是什么?