Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

modifypredictor

Set properties of credit scorecard predictors

Syntax

sc = modifypredictor(sc,PredictorName)
sc = modifypredictor(___,Name,Value)

Description

example

sc = modifypredictor(sc,PredictorName) sets the properties of the credit scorecard predictors.

example

sc = modifypredictor(___,Name,Value) sets the properties of the credit scorecard predictors using optional name-value pair arguments.

Examples

collapse all

Create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011). In practice, categorical data many times is represented with numeric values. To show the case where categorical data is given as numeric data, the data for the variable 'ResStatus' is intentionally converted to numeric values.

load CreditCardData
data.ResStatus = double(data.ResStatus);
sc = creditscorecard(data,'IDVar','CustID')
sc = 
  creditscorecard with properties:

                GoodLabel: 0
              ResponseVar: 'status'
               WeightsVar: ''
                 VarNames: {1x11 cell}
        NumericPredictors: {1x7 cell}
    CategoricalPredictors: {'EmpStatus'  'OtherCC'}
                    IDVar: 'CustID'
            PredictorVars: {1x9 cell}
                     Data: [1200x11 table]

[T,Stats] = predictorinfo(sc,'ResStatus')
T=1x2 table
                 PredictorType     LatestBinning 
                 _____________    _______________

    ResStatus    'Numeric'        'Original Data'

Stats=4x1 table
             Value 
            _______

    Min           1
    Max           3
    Mean     1.7017
    Std     0.71863

Note that 'ResStatus' appears as part of the NumericPredictors property. Assume that you want 'ResStatus' to be treated as categorical data. For example, you may want to allow automatic binning algorithms to reorder the categories. Use modifypredictor to change the 'PredictorType' of the PredictorName 'ResStatus' from numeric to categorical.

sc = modifypredictor(sc,'ResStatus','PredictorType','Categorical')
sc = 
  creditscorecard with properties:

                GoodLabel: 0
              ResponseVar: 'status'
               WeightsVar: ''
                 VarNames: {1x11 cell}
        NumericPredictors: {1x6 cell}
    CategoricalPredictors: {'ResStatus'  'EmpStatus'  'OtherCC'}
                    IDVar: 'CustID'
            PredictorVars: {1x9 cell}
                     Data: [1200x11 table]

[T,Stats] = predictorinfo(sc,'ResStatus')
T=1x3 table
                 PredictorType    Ordinal     LatestBinning 
                 _____________    _______    _______________

    ResStatus    'Categorical'    false      'Original Data'

Stats=3x1 table
          Count
          _____

    C1    542  
    C2    474  
    C3    184  

Notice that 'ResStatus' now appears as part of the 'Categorical' predictors.

Input Arguments

collapse all

Credit scorecard model, specified as a creditscorecard object. Use creditscorecard to create a creditscorecard object.

Predictor name, specified using a character vector or cell array of character vectors containing the names of the credit scorecard predictors. PredictorName is case-sensitive.

Data Types: char | cell

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: sc = modifypredictor(sc,{'CustAge','CustIncome'},'PredictorType','Categorical','Ordinal',true)

collapse all

Predictor type that one or more predictors are converted to, specified as a character vector. Possible values are:

  • '' — No conversion occurs.

  • 'Numeric' — The predictor data specified by PredictorName is converted to numeric.

  • 'Categorical' — The predictor data specified by PredictorName is converted to categorical.

Data Types: char

Indicator for whether predictors being converted to categorical or existing categorical predictors are treated as ordinal data, specified as a logical with values true or false.

Note

This optional input parameter is only used for predictors of type 'Categorical'.

Data Types: logical

Output Arguments

collapse all

Credit scorecard model, returned as an updated creditscorecard object.

Introduced in R2015b

Was this topic helpful?