This measure specializes Measure for classification problems:

  • task_type is set to "classif".

  • Possible values for predict_type are "response" and "prob".

Predefined measures can be found in the dictionary mlr_measures. The default measure for classification is classif.ce.

See also

Other Measure: MeasureRegr, Measure, mlr_measures_aic, mlr_measures_bic, mlr_measures_classif.costs, mlr_measures_debug, mlr_measures_elapsed_time, mlr_measures_oob_error, mlr_measures_selected_features, mlr_measures

Super class

mlr3::Measure -> MeasureClassif


Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.


  param_set = ps(),
  minimize = NA,
  average = "macro",
  aggregator = NULL,
  properties = character(),
  predict_type = "response",
  predict_sets = "test",
  task_properties = character(),
  packages = character(),
  man = NA_character_



Identifier for the new instance.


Set of hyperparameters.


Feasible range for this measure as c(lower_bound, upper_bound). Both bounds may be infinite.


Set to TRUE if good predictions correspond to small values, and to FALSE if good predictions correspond to large values. If set to NA (default), tuning this measure is not possible.


How to average multiple Predictions from a ResampleResult.The default, "macro", calculates the individual performances scores for each Prediction and then uses the function defined in $aggregator to average them to a single number.If set to "micro", the individual Prediction objects are first combined into a single new Prediction object which is then used to assess the performance. The function in $aggregator is not used in this case.


Function to aggregate individual performance scores x where x is a numeric vector. If NULL, defaults to mean().


Properties of the measure. Must be a subset of mlr_reflections$measure_properties. Supported by mlr3:

  • "requires_task" (requires the complete Task),

  • "requires_learner" (requires the trained Learner),

  • "requires_train_set" (requires the training indices from the Resampling), and

  • "na_score" (the measure is expected to occasionally return NA or NaN).


Required predict type of the Learner. Possible values are stored in mlr_reflections$learner_predict_types.


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".


Required task properties, see Task.


Set of required packages. A warning is signaled by the constructor if at least one of the packages is not installed, but loaded (not attached) later on-demand via requireNamespace().


String in the format [pkg]::[topic] pointing to a manual page for this object. The referenced help package can be opened via method $help().