View source: R/as_result_data.R
as_result_data | R Documentation |
This function allows to construct or convert to a ResultData object, the
result container used by ResampleResult and BenchmarkResult.
A ResampleResult or BenchmarkResult can be initialized with the returned object.
Note that ResampleResults can be converted to a BenchmarkResult with as_benchmark_result()
and multiple BenchmarkResults can be combined to a larger BenchmarkResult with the
$combine()
method of BenchmarkResult.
as_result_data(
task,
learners,
resampling,
iterations,
predictions,
learner_states = NULL,
store_backends = TRUE
)
task |
(Task). |
learners |
(list of trained Learners). |
resampling |
(Resampling). |
iterations |
( |
predictions |
(list of list of Predictions). |
learner_states |
( |
store_backends |
( |
ResultData
object which can be passed to the constructor of ResampleResult.
task = tsk("penguins")
learner = lrn("classif.rpart")
resampling = rsmp("cv", folds = 2)$instantiate(task)
iterations = seq_len(resampling$iters)
# manually train two learners.
# store learners and predictions
learners = list()
predictions = list()
for (i in iterations) {
l = learner$clone(deep = TRUE)
learners[[i]] = l$train(task, row_ids = resampling$train_set(i))
predictions[[i]] = list(test = l$predict(task, row_ids = resampling$test_set(i)))
}
rdata = as_result_data(task, learners, resampling, iterations, predictions)
ResampleResult$new(rdata)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.