%% Score a New Dataset
% This example shows how to use score to obtain scores for a new dataset (for example, a validation or a test dataset) using the optional 'data' input in the score function.
% 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);

%
% For the purpose of illustration, suppose that a few rows from the original data are our "new" data. Use the optional data input argument in the score function to obtain the scores for the newdata.

newdata = data(10:20,:);
Scores = score(sc,newdata)

% Copyright 2015 The MathWorks, Inc.