%% Validate a Credit Scorecard Model
% Create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011).

load CreditCardData
sc = creditscorecard(data, 'IDVar','CustID')

%
% Perform automatic binning using the default options. By default, autobinning uses the Monotone algorithm.

sc = autobinning(sc);

%
% Fit the model.

sc = fitmodel(sc);

%
% Format the unscaled points.

sc = formatpoints(sc, 'PointsOddsAndPDO',[500,2,50]);

%
% Score the data.

scores = score(sc);

%
% Validate the credit scorecard model by generating the CAP, ROC, and KS plots.

[Stats,T] = validatemodel(sc,'Plot',{'CAP','ROC','KS'});
disp(Stats)
disp(T(1:15,:))

% Copyright 2012 The MathWorks, Inc.