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

Prediction

Abstract Prediction Object


Description

This is the abstract base class for task objects like PredictionClassif or PredictionRegr.

Prediction objects store the following information:

  1. The row ids of the test set

  2. The corresponding true (observed) response.

  3. The corresponding predicted response.

  4. Additional predictions based on the class and predict_type. E.g., the class probabilities for classification or the estimated standard error for regression.

Note that this object is usually constructed via a derived classes, e.g. PredictionClassif or PredictionRegr.

S3 Methods

Public fields

data

(named list())
Internal data structure.

task_type

(character(1))
Required type of the Task.

task_properties

(character())
Required properties of the Task.

predict_types

(character())
Set of predict types this object stores.

man

(character(1))
String in the format [pkg]::[topic] pointing to a manual page for this object. Defaults to NA, but can be set by child classes.

Active bindings

row_ids

(integer())
Vector of row ids for which predictions are stored.

truth

(any)
True (observed) outcome.

missing

(integer())
Returns row_ids for which the predictions are missing or incomplete.

Methods

Public methods


Method format()

Helper for print outputs.

Usage
Prediction$format()

Method print()

Printer.

Usage
Prediction$print(...)
Arguments
...

(ignored).


Method help()

Opens the corresponding help page referenced by field $man.

Usage
Prediction$help()

Method score()

Calculates the performance for all provided measures Task and Learner may be NULL for most measures, but some measures need to extract information from these objects. Note that the predict_sets of the measures are ignored by this method, instead all predictions are used.

Usage
Prediction$score(
  measures = NULL,
  task = NULL,
  learner = NULL,
  train_set = NULL
)
Arguments
measures

(Measure | list of Measure)
Measure(s) to calculate.

task

(Task).

learner

(Learner).

train_set

(integer()).

Returns

Method clone()

The objects of this class are cloneable with this method.

Usage
Prediction$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other Prediction: PredictionClassif, PredictionRegr


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.