これは簡単な質問です。私が愚かな方法でこれを行っていないことを確認するためだけです。auc
私は mlr の尺度として使用したいと考えています。また、サンプル サイズが小さいため、LOO も使用しています。もちろん、LOO クロス検証スキームでは、テスト サンプルは常に 1 つのインスタンスのみであるため、auc
計算することはできません。もちろん、後で予測を見て計算することもできますが、ネストされた交差検証の内部ループでそれを測定値として使用したい場合に問題が発生します。このようなもの (独自の を定義する必要がありますbinaryTask
):
require(mlr)
#for example purposes we will decide which one is better, vanilla LDA or
#vanilla SVM, in the task specified below
bls = list(makeLearner("classif.lda"),makeLearner("classif.svm"))
#modelMultiplexer allows us to search whole parameter spaces between models
#as if the models themselves were parameters
lrn = makeModelMultiplexer(bls)
#to calculate AUC we need some continuous output, so we set
#predictType to probabilities
lrn = setPredictType(lrn, "prob")
lrn = setId(lrn, "Model Multiplexer")
#here we could pass the parameters to be tested to both SVM and LDA,
#let's not pass anything so we test the vanilla classifiers instead
ps = makeModelMultiplexerParamSet(lrn)
#finally, the resample strategy, Leave-One-Out ("LOO") in our case
rdesc = makeResampleDesc("LOO")
#parameter space search strategy, in our case we only have one parameter:
#the model. So, a simple grid search will do the trick
ctrl = makeTuneControlGrid()
#The inner CV loop where we choose the best model in the validation data
tune = makeTuneWrapper(lrn, rdesc, par.set = ps, control = ctrl, measure = auc, show.info = FALSE)
#The outer CV loop where we obtain the performace of the selected model
#in the test data. mlR is a great interface, we could have passed a list
#of classifiers and tasks here instead and do it all in one go
#(beware your memory limitation!)
res = benchmark(tune, binaryTask, rdesc, measure = auc)
auc
両方のループで、そのように使用することはできません。mlr
毎回一意の再サンプルではなく、すべてのテスト サンプルでメジャーを評価するにはどうすればよいでしょうか?