%% Round Points
% This example shows how to use formatpoints to round points. Rounding is usually applied after scaling, otherwise, if the points for a particular predictor are all in a small range, rounding could cause the rounded points for different bins to be the same. Also, rounding all the points may slightly change the minimum and maximum total points.
% Create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011). Use the 'IDVar' argument in creditscorecard to indicate that 'CustID' contains ID information and should not be included as a predictor variable.

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

%
% Perform automatic binning to bin for all predictors.

sc = autobinning(sc);

%
% Fit a linear regression model using default parameters.

sc = fitmodel(sc);

%
% Display unscaled points for predictors retained in the fitting model and display the minimum and maximum possible unscaled scores.

[PointsInfo,MinScore,MaxScore] = displaypoints(sc)

%
% Scale points, and display the points information. By default, no rounding is applied.

sc = formatpoints(sc,'WorstAndBestScores',[300 850]);
PointsInfo = displaypoints(sc)

%
% Use the name-value pair argument Round to apply rounding for all points and then display the points information again.

sc = formatpoints(sc,'Round','AllPoints');
PointsInfo = displaypoints(sc)

% Copyright 2015 The MathWorks, Inc.