Be the first to rate this file! 37 downloads (last 30 days) File Size: 2.19 KB File ID: #25704

Reliability Diagram for calibration of two-class predictor.

by Skynet

 

01 Nov 2009 (Updated 04 Nov 2009)

Code covered by BSD License  

Plot reliability diagram for calibration purposes using predictions and targets vectors.

Download Now | Watch this File

File Information
Description

PLOTRELIABILITY(TARGETS, PREDICTIONS) uses TARGETS and PREDICTIONS vectors to compute TARGETS_MEANS and PREDICTIONS_MEANS. FIG is a rudimentary reliability diagram plotted using these means.

Values of TARGETS are either 0 or 1, representing the two classes. Values of PREDICTIONS are probabilities of the positive class (1), previously obtained using a probabilistic predictive model. TARGETS and PREDICTIONS are row or column vectors of the same size.

The predictions are discretized into ten bins. Cases with predicted value between 0 and 0.1 fall in the first bin, between 0.1 and 0.2 in the second bin, etc. For each bin, the mean predicted value (PREDICTIONS_MEANS) and the true fraction of positive cases (TARGETS_MEANS) are computed. These points are then plotted on the X and Y axes respectively. If the model is well calibrated, the points will fall near the diagonal line.

SHOW_FIG is an optional logical input argument. Its default value is true. Setting it to false prevents the automatic display of the reliability diagram.

Syntax:
plotreliability(targets, predictions);
[fig, targets_means, predictions_means] = plotreliability(targets, predictions, false);

Remarks:
This function does not allow the number of bins or the width of each bin to be changed.

References:
Alexandru Niculescu-Mizil and Rich Caruana (2005) Predicting Good Probabilities With Supervised Learning, in Proceedings of the 22nd International Conference on Machine Learning. See section 4 (Qualitative Analysis of Predictions).

MATLAB release MATLAB 7.9 (2009b)
Zip File Content  
Other Files license.txt,
plotreliability.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
02 Nov 2009

(1) Added SHOW_FIG, an optional logical input argument. Its default value is false. Setting it to true displays the reliability diagram.
(2) Swapped the inputs.

03 Nov 2009

(1) Changed function name to plotreliability.
(2) Changed the default value of the optional input argument show_fig to true.

04 Nov 2009

Fixed error in Description.

Tag Activity for this File
Tag Applied By Date/Time
reliability Skynet 02 Nov 2009 10:17:13
reliability diagram Skynet 02 Nov 2009 10:17:13
reliability plot Skynet 02 Nov 2009 10:17:13
machine learning Skynet 02 Nov 2009 10:17:13
calibration Skynet 02 Nov 2009 10:17:13
mean predicted value Skynet 02 Nov 2009 22:26:47
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com