reliabilityPlot {CORElearn}R Documentation

Plots reliability plot of probabilities


Given probability scores probScore and true probabilities trueProb the methods plots one against the other using a selected boxing method which groups scores and probabilities to show calibration of probabilities in given probability bands.


reliabilityPlot(probScore, trueProb, titleText="", boxing="equipotent", 
                noBins=10, classValue = 1, printWeight=FALSE) 



A vector of predicted probabilities for a given class classValue.


A vector of true probabilities for a given classValue, should be of the same length as probScore.


The text of the graph title.


One of "unique", "equidistant" or "equipotent", determines the grouping of probabilities. See details below.


The value of parameter depends on the parameter boxing and specifies the number of bins. See details below.


A class value (factor) or an index of the class value (integer) for which reliability plot is made.


A boolean specifying if box weights are to be printed.


Depending on the specified boxing the probability scores are grouped in one of three possible ways

The parameter trueProb can represent either probabilities (in [0, 1] range, in most cases these will be 0s or 1s), or the true class values from which the method will form 0 and 1 values corresponding to probabilities for class value classValue.


A function returns a graph containing reliability plot on a current graphical device.


Marko Robnik-Sikonja

See Also

CORElearn, calibrate.


# generate data consisting from 3 parts:
#  one part for training, one part for calibration, one part for testing
train <-classDataGen(noInst=200)
cal <-classDataGen(noInst=200)
test <- classDataGen(noInst=200)

# build random forests model with default parameters
modelRF <- CoreModel(class~., train, model="rf")
# prediction of calibration and test set
predCal <- predict(modelRF, cal, rfPredictClass=FALSE)
predTest <- predict(modelRF, test, rfPredictClass=FALSE)
destroyModels(modelRF) # no longer needed, clean up

# show reliability plot of uncalibrated test set
reliabilityPlot(predTest$prob[,class1], test$class, 
                titleText="Uncalibrated probabilities", classValue=class1) 

# calibrate for a chosen class1 and method using calibration set
calibration <- calibrate(cal$class, predCal$prob[,class1], class1=1, 
                         method="isoReg", assumeProbabilities=TRUE)
calTestProbs <- applyCalibration(predTest$prob[,class1], calibration)
# display calibrated probabilities
reliabilityPlot(calTestProbs, test$class, 
                titleText="Calibrated probabilities", classValue=class1) 

[Package CORElearn version 1.56.0 Index]