Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ResultData

ResultData


Description

Internal object to store results in list of data.tables, arranged in a star schema. It is advised to not directly work on this data structure as it may be changed in the future without further warnings.

The main motivation of this data structure is the necessity to avoid storing duplicated R6 objects. While this is usually no problem in a single R session, serialization via serialize() (which is used in save()/saveRDS() or during parallelization) leads to objects with unreasonable memory requirements.

Public fields

data

(list())
List of data.tables(), arranged in a star schema. Do not operate directly on this list.

Active bindings

task_type

(character(1))
Returns the task type of stored objects, e.g. "classif" or "regr". Returns NULL if the ResultData is empty.

Methods

Public methods


Method new()

Creates a new instance of this R6 class. An alternative construction method is provided by as_result_data().

Usage
ResultData$new(data = NULL, store_backends = TRUE)
Arguments
data

(data.table() | NULL)
Do not initialize this object yourself, use as_result_data() instead.

store_backends

(logical(1))
If set to FALSE, the backends of the Tasks provided in data are removed.


Method uhashes()

Returns all unique hashes (uhash values) of all included ResampleResults.

Usage
ResultData$uhashes(view = NULL)
Arguments
view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

Returns

character().


Method iterations()

Returns the number of recorded iterations / experiments.

Usage
ResultData$iterations(view = NULL)
Arguments
view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

Returns

integer(1).


Method tasks()

Returns a table of included Tasks.

Usage
ResultData$tasks(view = NULL)
Arguments
view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

Returns

data.table() with columns "task_hash" (character()) and "task" (Task).


Method learners()

Returns a table of included Learners.

Usage
ResultData$learners(view = NULL, states = TRUE, reassemble = TRUE)
Arguments
view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

states

(logical(1))
If TRUE, returns a learner for each iteration/experiment in the ResultData object. If FALSE, returns an exemplary learner (without state) for each ResampleResult.

reassemble

(logical(1))
Reassemble the learners, i.e. re-set the state and the hyperparameters which are stored separately before returning the learners.

Returns

data.table() with columns "learner_hash" (character()) and "learner" (Learner).


Method resamplings()

Returns a table of included Resamplings.

Usage
ResultData$resamplings(view = NULL)
Arguments
view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

Returns

data.table() with columns "resampling_hash" (character()) and "resampling" (Resampling).


Method predictions()

Returns a list of Prediction objects.

Usage
ResultData$predictions(view = NULL, predict_sets = "test")
Arguments
view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

predict_sets

(character())
Prediction sets to operate on, used in aggregate() to extract the matching predict_sets from the ResampleResult. Multiple predict sets are calculated by the respective Learner during resample()/benchmark(). Must be a non-empty subset of {"train", "test", "validation"}. If multiple sets are provided, these are first combined to a single prediction object. Default is "test".

predict_sets

(character())
Prediction sets to operate on, used in aggregate() to extract the matching predict_sets from the ResampleResult. Multiple predict sets are calculated by the respective Learner during resample()/benchmark(). Must be a non-empty subset of {"train", "test", "validation"}. If multiple sets are provided, these are first combined to a single prediction object. Default is "test".

predict_sets

(character())
Prediction sets to operate on, used in aggregate() to extract the matching predict_sets from the ResampleResult. Multiple predict sets are calculated by the respective Learner during resample()/benchmark(). Must be a non-empty subset of {"train", "test", "validation"}. If multiple sets are provided, these are first combined to a single prediction object. Default is "test".

Returns

list() of Prediction.


Method prediction()

Returns a combined Prediction objects.

Usage
ResultData$prediction(view = NULL, predict_sets = "test")
Arguments
view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

predict_sets

(character())
Prediction sets to operate on, used in aggregate() to extract the matching predict_sets from the ResampleResult. Multiple predict sets are calculated by the respective Learner during resample()/benchmark(). Must be a non-empty subset of {"train", "test", "validation"}. If multiple sets are provided, these are first combined to a single prediction object. Default is "test".

predict_sets

(character())
Prediction sets to operate on, used in aggregate() to extract the matching predict_sets from the ResampleResult. Multiple predict sets are calculated by the respective Learner during resample()/benchmark(). Must be a non-empty subset of {"train", "test", "validation"}. If multiple sets are provided, these are first combined to a single prediction object. Default is "test".

predict_sets

(character())
Prediction sets to operate on, used in aggregate() to extract the matching predict_sets from the ResampleResult. Multiple predict sets are calculated by the respective Learner during resample()/benchmark(). Must be a non-empty subset of {"train", "test", "validation"}. If multiple sets are provided, these are first combined to a single prediction object. Default is "test".

Returns

Method combine()

Combines multiple ResultData objects, modifying self in-place.

Usage
ResultData$combine(rdata)
Arguments
rdata

(ResultData).

Returns

self (invisibly).


Method sweep()

Updates the ResultData object, removing rows from all tables which are not referenced by the fact table anymore. E.g., can be called after filtering/subsetting the fact table.

Usage
ResultData$sweep()
Returns

self (invisibly).


Method as_data_table()

Combines internal tables into a single flat data.table().

Usage
ResultData$as_data_table(
  view = NULL,
  reassemble_learners = TRUE,
  convert_predictions = TRUE,
  predict_sets = "test"
)
Arguments
view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

reassemble_learners

(logical(1))
Reassemble the tasks?

convert_predictions

(logical(1))
Convert PredictionData to Prediction?

predict_sets

(character())
Prediction sets to operate on, used in aggregate() to extract the matching predict_sets from the ResampleResult. Multiple predict sets are calculated by the respective Learner during resample()/benchmark(). Must be a non-empty subset of {"train", "test", "validation"}. If multiple sets are provided, these are first combined to a single prediction object. Default is "test".

predict_sets

(character())
Prediction sets to operate on, used in aggregate() to extract the matching predict_sets from the ResampleResult. Multiple predict sets are calculated by the respective Learner during resample()/benchmark(). Must be a non-empty subset of {"train", "test", "validation"}. If multiple sets are provided, these are first combined to a single prediction object. Default is "test".

predict_sets

(character())
Prediction sets to operate on, used in aggregate() to extract the matching predict_sets from the ResampleResult. Multiple predict sets are calculated by the respective Learner during resample()/benchmark(). Must be a non-empty subset of {"train", "test", "validation"}. If multiple sets are provided, these are first combined to a single prediction object. Default is "test".


Method logs()

Get a table of recorded learner logs.

Usage
ResultData$logs(view = NULL, condition)
Arguments
view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

view

character(1)
Single uhash to restrict the results to.

condition

(character(1)) The condition to extract. One of "message", "warning" or "error".


Method clone()

The objects of this class are cloneable with this method.

Usage
ResultData$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

# table overview
print(ResultData$new()$data)

mlr3

Machine Learning in R - Next Generation

v0.11.0
LGPL-3
Authors
Michel Lang [cre, aut] (<https://orcid.org/0000-0001-9754-0393>), Bernd Bischl [aut] (<https://orcid.org/0000-0001-6002-6980>), Jakob Richter [aut] (<https://orcid.org/0000-0003-4481-5554>), Patrick Schratz [aut] (<https://orcid.org/0000-0003-0748-6624>), Giuseppe Casalicchio [ctb] (<https://orcid.org/0000-0001-5324-5966>), Stefan Coors [ctb] (<https://orcid.org/0000-0002-7465-2146>), Quay Au [ctb] (<https://orcid.org/0000-0002-5252-8902>), Martin Binder [aut], Marc Becker [ctb] (<https://orcid.org/0000-0002-8115-0400>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.