performance(mlr)R Documentation

performance

Description

performance measures the quality of predictions w.r.t. some loss function.

Usage

performance(true.y, pred.y, weights, measure)

Arguments

true.y [ANY]
The data sets true labels.
pred.y [ANY]
The predicted labels.
weights [numeric]
An optional vector of weights to be used. Default is a weight of 1 for every case.
measure [list/ character]
A list or a character which defines the loss function. Default is the mean misclassification error ("mmce") for classification tasks and the mean squared error ("mse") for regression tasks. See details for other loss functions.

Details

There are some more loss functions which you can use as performance measure, they are as follows: For classification:

smce
Summed misclassification error

For regression:

sae
Sum of absolute errors
mae
Median of absolute errors
sse
Squared sum of errors
mse
Mean squared error

Value

The performance.

Examples

data(iris) 
# define a classification task for a decision tree (rpart) for the data set iris
ct <- make.classif.task("rpart.classif", data=iris, formula=Species~.)
# specify train and test set indices
train.set <- seq(from=1L, to=150L, by=2L)
test.set <- seq(from=2L, to=150L, by=2L)
# train a model with the train set
m <- train(ct, subset=train.set) 
# predict the class of the test set measures 
preds <- predict(m, newdata=iris[test.set,])
# evaluate the predictions, first with mean misclassification error as loss function (default)
performance(true.y = iris[test.set, "Species"], pred.y = preds)         
# and with summed misclassification error
performance(true.y = iris[test.set, "Species"], pred.y = preds, measure="smce")

[Package mlr version 0.3.180 Index]