%% Modify Predictor Bins for Numeric Data
% Create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011).

load CreditCardData 
sc = creditscorecard(data);

%
% The predictor CustIncome is numeric. By default, each value of a predictor is placed in a separate bin.

bi = bininfo(sc,'CustIncome')

%
% Use modifybins to set a minimum value of 0, and cut points every 10000, from 20000 to 60000. Display updated bin information, including cut points.

sc = modifybins(sc,'CustIncome','MinValue',0,'CutPoints',20000:10000:60000);
[bi,cp] = bininfo(sc,'CustIncome')

%
% The first and last bins contain very few points. To merge the first bin into the second one, remove the first cut point. Similarly, to merge the last bin into the second-to-last one, remove the last cut point. Then use modifybins to update the scorecard, and display updated bin information.

cp(1)=[];
cp(end)=[];
sc = modifybins(sc,'CustIncome','CutPoints',cp);
bi = bininfo(sc,'CustIncome')

% Copyright 2015 The MathWorks, Inc.