我运行以下命令来训练某些任务的包装模型。我想从包装器获取超参数。我尝试了以下
library(mlr)
lrn = makeLearner("classif.ksvm")
lrn = makeRemoveConstantFeaturesWrapper(lrn)
df = getTaskData(sonar.task)
df$constant = 1
task = makeClassifTask(data = df, target = "Class")
model = train(learner = lrn, task = sonar.task)
model
getHyperPars(model)
我收到以下消息。
Error in UseMethod("getHyperPars") :
no applicable method for 'getHyperPars' applied to an object of class "c('PreprocModel', 'BaseWrapperModel', 'WrappedModel')"
如何获取和设置包装模型的超参数? 谢谢!
答案 0 :(得分:0)
您必须将其应用于学习者:
getHyperPars(lrn)
这只会提供明确设置的超参数。