modifypredictor
Set properties of credit scorecard predictors
Description
sets the properties of the credit scorecard predictors.sc
= modifypredictor(sc
,PredictorName
)
sets the properties of the credit scorecard predictors using optional name-value pair arguments.sc
= modifypredictor(___,Name,Value
)
Examples
Modify a Predictor to Change the Predictor Type from Numeric to Categorical
Create acreditscorecard
object using theCreditCardData.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.
loadCreditCardDatadata.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'} BinMissingData: 0 IDVar: 'CustID' PredictorVars: {1x9 cell} Data: [1200x11 table]
[T,Stats] = predictorinfo(sc,'ResStatus')
T=1×4 tablePredictorType LatestBinning LatestFillMissingType LatestFillMissingValue _____________ _________________ _____________________ ______________________ ResStatus {'Numeric'} {'Original Data'} {'Original'} {0x0 double}
Stats=4×1 tableValue _______ Min 1 Max 3 Mean 1.7017 Std 0.71833
Note that'ResStatus'
appears as part of theNumericPredictors
property. Assume that you want'ResStatus'
被视为直言data. For example, you may want to allow automatic binning algorithms to reorder the categories. Usemodifypredictor
to change the'PredictorType'
of thePredictorName
'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'} BinMissingData: 0 IDVar: 'CustID' PredictorVars: {1x9 cell} Data: [1200x11 table]
[T,Stats] = predictorinfo(sc,'ResStatus')
T=1×5 tablePredictorType Ordinal LatestBinning LatestFillMissingType LatestFillMissingValue _______________ _______ _________________ _____________________ ______________________ ResStatus {'Categorical'} false {'Original Data'} {'Original'} {0x0 double}
Stats=3×1 tableCount _____ C1 542 C2 474 C3 184
Notice that'ResStatus'
now appears as part of the'Categorical'
predictors.
Input Arguments
sc
—Credit scorecard model
creditscorecard
object
Credit scorecard model, specified as acreditscorecard
object. Usecreditscorecard
to create acreditscorecard
object.
PredictorName
—Predictor name
character vector|cell array of character vectors
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 Arguments
Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN
, whereName
is the argument name andValue
相应的价值。名称-值参数must appear after other arguments, but the order of the pairs does not matter.
Before R2021a, use commas to separate each name and value, and encloseName
in quotes.
Example:sc = modifypredictor(sc,{'CustAge','CustIncome'},'PredictorType','Categorical','Ordinal',true)
PredictorType
—Predictor type that one or more predictors are converted to
''
no conversion occurs(default) |character vector with values'Numeric'
,'Categorical'
Predictor type that one or more predictors are converted to, specified as the comma-separated pair consisting of'PredictorType'
and a character vector. Possible values are:
''
— No conversion occurs.'Numeric'
— The predictor data specified byPredictorName
is converted to numeric.'Categorical'
— The predictor data specified byPredictorName
is converted to categorical.
Data Types:char
Ordinal
—Indicator for whether predictors being converted to categorical are ordinal
false
(default) |logical with valuestrue
,false
Indicator for whether predictors being converted to categorical or existing categorical predictors are treated as ordinal data, specified as the comma-separated pair consisting of'Ordinal'
and a logical with valuestrue
orfalse
.
Note
This optional input parameter is only used for predictors of type'Categorical'
.
Data Types:logical
Output Arguments
sc
— Credit scorecard model
creditscorecard
object
Credit scorecard model, returned as an updatedcreditscorecard
object.
Version History
See Also
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina(Español)
- Canada(English)
- United States(English)
Europe
- Belgium(English)
- Denmark(English)
- Deutschland(Deutsch)
- España(Español)
- Finland(English)
- France(Français)
- Ireland(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- Norway(English)
- Österreich(Deutsch)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)