A measure object encapsulates a function to evaluate the performance of a prediction. Information about already implemented measures can be obtained here: [measures].
A learner is trained on a training set d1, results in a model m and predicts another set d2 (which may be a different one or the training set) resulting in the prediction. The performance measure can now be defined using all of the information of the original task, the fitted model and the prediction.
Object slots:
See argument.
See argument.
See argument.
See argument.
See argument.
See argument.
See argument.
See argument.
See argument.
See argument.
makeMeasure(
id,
minimize,
properties = character(0L),
fun,
extra.args = list(),
aggr = test.mean,
best = NULL,
worst = NULL,
name = id,
note = ""
)
(`character(1)`) Name of measure.
(`logical(1)`) Should the measure be minimized? Default is `TRUE`.
([character]) Set of measure properties. Some standard property names include:
Is the measure applicable for classification?
Is the measure applicable for multi-class classification?
Is the measure applicable for multilabel classification?
Is the measure applicable for regression?
Is the measure applicable for survival?
Is the measure applicable for cluster?
Is the measure applicable for cost-sensitive learning?
Is prediction object required in calculation? Usually the case.
Is truth column required in calculation? Usually the case.
Is task object required in calculation? Usually not the case
Is model object required in calculation? Usually not the case.
Are feature values required in calculation? Usually not the case.
Are predicted probabilities required in calculation? Usually not the case, example would be AUC.
Default is `character(0)`.
(`function(task, model, pred, feats, extra.args)`) Calculates the performance value. Usually you will only need the prediction object `pred`.
The task.
The fitted model.
Prediction object.
The features.
See below.
([list]) List of extra arguments which will always be passed to `fun`. Can be changed after construction via [setMeasurePars]<`3`>. Default is empty list.
([Aggregation]) Aggregation funtion, which is used to aggregate the values measured on test / training sets of the measure to a single value. Default is [test.mean].
(`numeric(1)`) Best obtainable value for measure. Default is -`Inf` or `Inf`, depending on `minimize`.
(`numeric(1)`) Worst obtainable value for measure. Default is `Inf` or -`Inf`, depending on `minimize`.
([character]) Name of the measure. Default is `id`.
([character]) Description and additional notes for the measure. Default is “”.
Other performance:
ConfusionMatrix
,
calculateConfusionMatrix()
,
calculateROCMeasures()
,
estimateRelativeOverfitting()
,
makeCostMeasure()
,
makeCustomResampledMeasure()
,
measures
,
performance()
,
setAggregation()
,
setMeasurePars()
# NOT RUN {
f = function(task, model, pred, extra.args) {
sum((pred$data$response - pred$data$truth)^2)
}
makeMeasure(id = "my.sse", minimize = TRUE, properties = c("regr", "response"), fun = f)
# }
Run the code above in your browser using DataLab