修改预测器的垃圾箱
使用可选的名称-值对参数手动修改数值预测器或分类预测器的预测器容器。对于数值预测器,可以指定最小值、最大值和切割点。对于类别预测器,可以指定类别分组。可以为这两种类型的预测器指定Bin标签。sc
= modifybins (sc
,PredictorName
,名称,价值
)
创建一个creditscorecard
对象使用CreditCardData.mat
文件来加载数据
(使用来自Refaat 2011的数据集)。
负载CreditCardDatasc = creditscorecard(数据);
预测指标CustIncome
是数字。默认情况下,每个预测器的值都放在一个单独的容器中。
bi = bininfo (sc,“CustIncome”)
bi =46×6表本好不好悲哀InfoValue几率 _________ ____ ___ _______ _________ __________ {' 18000年}2 3 0.66667 -1.1099 0.0056227{19000”}1 2 0.5 -1.3976 0.0053002{20000”}4 2 2 -0.011271 - 6.3641 e-07{21000”}6 3 2 -0.011271 - 9.5462 e-07{22000”}4 2 2 -0.011271 - 6.3641 e-07{23000”}4 4 1 -0.70442 0.0035885{24000”}5 5 1 -0.70442 0.0044856{25000”}4 90.44444 -1.5153 0.026805 {'26000'} 4 11 0.36364 -1.716 0.038999 {'27000'} 6 6 1 -0.70442 0.0053827 {'28000'} 13 11 1.1818 -0.53736 0.0061896 {'29000'} 11 10 1.1 -0.60911 0.0069988 {'30000'} 18 16 1.125 -0.58664 0.010493 {'31000'} 24 8 3 0.39419 0.0038382 {'32000'} 21 15 1.4 -0.36795 0.0042797 {'33000'} 35 19 1.8421 -0.093509 0.00039951 ⋮
用modifybins
设置最小值为0,每10000切割点,从20000到60000。显示更新的bin信息,包括切割点。
sc = modifybins (sc,“CustIncome”,“MinValue”0,“割点”, 20000:10000:60000);(bi, cp) = bininfo (sc,“CustIncome”)
bi =7×6表本好不好悲哀InfoValue几率 _________________ ____ ___ _______ _________ _________ {'[ 0, 20000)的}3 5 0.6 -1.2152 0.010765{(20000、30000)}61 63 0.96825 -0.73668 0.060942{[30000、40000)的}324 173 1.8728 -0.076967 0.0024846{[40000、50000)的}304 123 2.4715 0.20042 0.013781{[50000、60000)}103年32 3.2188 0.46457 0.022144{”(60000年,正)}8 18 1.375 0.010235 {' total '} 803 397 2.0227 NaN 0.12035
CP =5×120000 30000 40000 50000 60000
第一个和最后一个箱子只包含很少的点。要将第一个容器合并到第二个容器中,请删除第一个切割点。类似地,要将最后一个容器合并到倒数第二个容器中,请删除最后一个切割点。然后使用modifybins
更新记分卡,并显示更新后的bin信息。
cp (1) = [];cp(结束)= [];sc = modifybins (sc,“CustIncome”,“割点”, cp);bi = bininfo (sc,“CustIncome”)
bi =5×6表本好不好悲哀InfoValue几率 _________________ ____ ___ _______ _________ _________ {'[ 0, 30000)} 64 68 0.94118 -0.76504 0.070065{[30000、40000)的}324 173 1.8728 -0.076967 0.0024846{[40000、50000)的}304 123 2.4715 0.20042 0.013781{”(50000年,正)}33 111 3.3636 0.5086 0.028028{“总数”}803 397 0.11436 2.0227南
创建一个creditscorecard
对象使用CreditCardData.mat
文件来加载数据
(使用来自Refaat 2011的数据集)。
负载CreditCardDatasc = creditscorecard(数据);
分类数据或分类数据的规则总结在“类别分组”表中,作为可选输出返回。默认情况下,每个类别都放在一个单独的容器中。以下是预测器的信息resstatus
.
[bi,cg] = bininfo(sc,“ResStatus”)
bi =4×6表垃圾好赔率越来越好哇哇哇_______________________________ __________397 2.0227 NAN 0.0097738
cg =3×2表类别BinNumber ______________ _________ {' 房主'}1{“租户”}2{‘其他’}3
组类别“租户”
和“其他”
,修改类别分组表cg
,则为“其他”
与bin号码相同“租户”
.然后使用modifybins
更新记分卡。
cg.BinNumber (3) = 2;sc = modifybins (sc,“ResStatus”,“CatGrouping”、cg);
显示更新后的bin信息。请注意,已更新了bin标签,类别分组中包含了bin成员资格信息cg
.
[bi,cg] = bininfo(sc,“ResStatus”)
bi =3×6表垃圾箱好赔率悲伤_______________ _______________________________________10.0137729010
cg =3×2表类别BinNumber ______________ _________ {' 房主'}1{“租户”}2{‘其他’}2
创建一个creditscorecard
对象(使用来自Refaat 2011的数据集)。
负载CreditCardDatasc = creditscorecard(数据,“IDVar”,“CustID”,“GoodLabel”,0);
对于数值预测器CustAge
,可以使用modifybins
功能设置以下切点:
Cp = [25 37 49 65];sc = modifybins (sc,“CustAge”,“割点”,cp,“MinValue”0,“执行”,75);Bininfo(SC,“CustAge”)
ans =6×6表本好不好悲哀InfoValue几率 ___________ ____ ___ ______ _________ _________ {'[ 0、25)}9 8 1.125 -0.58664 0.0052464{'[25日37)}125 92 1.3587 -0.39789 0.030268{'[37岁49)}340 183 1.8579 -0.084959 0.0031898{'[65)}298 108 2.7593 0.31054 0.030765{'(65、75)}31 6 5.1667 0.93781 0.022031{“总数”}803 397 0.0915 2.0227南
使用modifybins
函数合并第2和第3个箱子。
sc = modifybins (sc,“CustAge”,“割点”cp ([1 3 4]));Bininfo(SC,“CustAge”)
ans =5×6表本好不好悲哀InfoValue几率 ___________ ____ ___ ______ ________ _________ {'[ 0、25)}9 8 1.125 -0.58664 0.0052464{[25岁49)的}465 275 1.6909 -0.17915 0.020355{'[65)}298 108 2.7593 0.31054 0.030765{'(65、75)}31 6 5.1667 0.93781 0.022031{“总数”}803 397 0.078397 2.0227南
显示分类预测器的垃圾箱信息resstatus
.
[bi,cg] = bininfo(sc,“ResStatus”);DISP(BI)
垃圾好赔率越来越好哇哇哇_______________________________ __________397 2.0227 NAN 0.0097738
使用modifybins
函数合并类别2和3。
cg.BinNumber (3) = 2;sc = modifybins (sc,“ResStatus”,“CatGrouping”、cg);Bininfo(SC,“ResStatus”)
ans =3×6表垃圾箱好赔率悲伤_______________ _______________________________________10.0137729010
创建一个creditscorecard
对象(使用来自Refaat 2011的数据集)。
负载CreditCardDatasc = creditscorecard(数据,“IDVar”,“CustID”,“GoodLabel”, 0)
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]
对于数值预测器tmataddress.
,可以使用modifybins
功能设置以下切点:
Cp = [30 80 120];sc = modifybins (sc,“TmAtAddress”,“割点”,cp,“MinValue”0,“执行”,210);Bininfo(SC,“TmAtAddress”)
ans =5×6表Bin Good Bad Odds WOE InfoValue _____________ _____________ _________ __________ {'[0,30)'} 330 154 2.1429 0.057722 0.0013305 {'[30,80)'} 379 201 1.8856 -0.070187 0.0024086 {'[80,120)'} 78 36 2.1667 0.068771 0.00044396 {'[120,210]'} 166 2.6667 0.27641 0.0013301 {' total '} 803 397 2.0227 NaN 0.0055131
使用modifybins
函数分割第二个箱子。
sc = modifybins (sc,“TmAtAddress”,“割点”, (cp (1) 50 cp(2:结束)]);Bininfo(SC,“TmAtAddress”)
ans =6×6表本好不好悲哀InfoValue几率 _____________ ____ ___ ______ _________ __________ {'[ 0, 30)} 330 154 2.1429 0.057722 0.0013305{[30、50)的}211 104 2.0288 0.0030488 2.4387 e-06{'[80)} 168 97 1.732 -0.15517 0.005449{”(80120)“36}78 2.1667 0.068771 0.00044396{”[120210]}16 6 2.6667 0.27641 0.0013301{“总数”}803 397 2.0227南0.0085559
显示分类预测器的垃圾箱信息resstatus
.
[bi,cg] = bininfo(sc,“ResStatus”)
bi =4×6表垃圾好赔率越来越好哇哇哇_______________________________ __________397 2.0227 NAN 0.0097738
cg =3×2表类别BinNumber ______________ _________ {' 房主'}1{“租户”}2{‘其他’}3
使用modifybins
函数合并类别2和3。
cg.BinNumber (3) = 2;sc = modifybins (sc,“ResStatus”,“CatGrouping”、cg);Bininfo(SC,“ResStatus”)
ans =3×6表垃圾箱好赔率悲伤_______________ _______________________________________10.0137729010
使用modifybins
功能拆分箱2并放置其他
在本3。
cg.binnumber(3)= 3;sc = modifybins (sc,“ResStatus”,“CatGrouping”、cg);[bi,cg] = bininfo(sc,“ResStatus”)
bi =4×6表垃圾好赔率越来越好哇哇哇_______________________________ __________397 2.0227 NAN 0.0097738
cg =3×2表类别BinNumber ______________ _________ {' 房主'}1{“租户”}2{‘其他’}3
创建一个creditscorecard
对象使用CreditCardData.mat
文件来加载数据
(使用来自Refaat 2011的数据集)。
负载CreditCardDatasc = creditscorecard(数据);
用modifybins
重置最小值并为预测器创建三个容器CustIncome
并显示更新后的bin信息。
sc = modifybins (sc,“CustIncome”,“MinValue”0,“割点”50000年[30000]);bi = bininfo (sc,“CustIncome”)
bi =4×6表本好不好悲哀InfoValue几率 _________________ ____ ___ _______ ________ _________ {'[ 0, 30000)} 64 68 0.94118 -0.76504 0.070065{[30000、50000)的}628 296 2.1216 0.047762 0.0017421{”(50000年,正)}33 111 3.3636 0.5086 0.028028{“总数”}803 397 0.099836 2.0227南
修改bin标签,并显示更新后的bin信息。
NewLabels = {“最多30k”,“30 k - 50 k”,50 k和更多};sc = modifybins (sc,“CustIncome”,“BinLabels”, NewLabels);bi = bininfo (sc,“CustIncome”)
bi =4×6表Bin Good Bad Odds WOE InfoValue ________________ ______________ ________ _________ {'Up to 30k'} 64 68 0.94118 -0.76504 0.070065 {'30k to 50k'} 628 296 2.1216 0.047762 0.0017421 {'50k and more'} 111 33 3.3636 0.5086 0.028028 {' total '} 803 397 2.0227 NaN 0.099836
垃圾桶标签应该是最后一个垃圾桶修改步骤。与本例中一样,用户定义的bin标签通常包含关于数字数据的切点、最小值或最大值的信息,或关于类别数据的类别分组的信息。为了防止用户定义的标签和切点不一致(以及标签具有误导性)的情况creditscorecard
对象在每次修改容器时重写用户定义的标签modifybins
.
为了显示modifybins
每次修改容器时重写用户定义的标签,将第一个切割点重置为31000,并显示更新的容器信息。请注意,bin标签被重置为它们的默认格式,并准确地反映切割点的变化。
sc = modifybins (sc,“CustIncome”,“割点”50000年[31000]);bi = bininfo (sc,“CustIncome”)
bi =4×6表垃圾箱好赔率越来越好悲伤________________ _____________________________ {'[0,31000)'} 82 84 0.079751 {'[31000,50000)'} 610 280 2.1780 2.1780 2.1780 2.1786 0.079751 {[31000,50000)'} 610 280 22.079751 0.17860 0.079751 {111 33 3.3636 0.5086 0.028028 {'总计'} 803 397 2.0227 NaN 0.11182
创建一个creditscorecard
对象使用CreditCardData.mat
文件来加载Datamissing.
用缺失值。
负载CreditCardData.mat头(dataMissing, 5)
ans =5×11表CustID CustAge TmAtAddress ResStatus EmpStatus CustIncome TmWBank OtherCC AMBalance UtilRate地位 ______ _______ ___________ ___________ _________ __________ _______ _______ _________ ________ ______ 53 62 <定义>未知50000 55是的1055.9 - 0.22 0 2 61 22业主雇佣52000 25是的1161.6 - 0.24 0 3 47 30租户雇佣了37000 61877.23 0.29 0 4 NaN 75自雇业主53000 20是157.37 0.08 0 5 68 56自雇业主53000 14是561.84 0.11 0
流('行数:%d\n'、高度(dataMissing))
行数:1200行
流('缺少的值的数量CustAge: %d\n',总和(ismissing(DataMissing.Custage)))
CustAge: 30
流(restatus: %d\n总和(ismissing (dataMissing.ResStatus)))
缺失值次数Resstatus:40
用creditscorecard
使用name-value参数“BinMissingData”
设置真的
将丢失的数据装入单独的容器中。
sc = creditscorecard(Datamissing,“IDVar”,“CustID”,“BinMissingData”,真的);sc = autobinning(sc);DISP(SC)
creditscorecard with properties: GoodLabel: 0 ResponseVar: 'status' WeightsVar: " VarNames: {1x11 cell} NumericPredictors: {1x6 cell} CategoricalPredictors: {'ResStatus' 'EmpStatus' 'OtherCC'} BinMissingData: 1 IDVar: 'CustID' PredictorVars: {1x9 cell} Data: [1200x11 table]
显示bin信息的数字数据“CustAge”
这包括标记为单独的垃圾箱中的缺失数据< >失踪
.
(bi, cp) = bininfo (sc,“CustAge”);DISP(BI)
本好不好悲哀InfoValue几率 _____________ ____ ___ ______ ________ __________ {'[- 正无穷,33)52}69 1.3269 -0.42156 0.018993{[33岁,37)}63年45 1.4 -0.36795 0.012839{[37、40)}72年47 1.5319 -0.2779 0.0079824{'[40岁,46)}172 89 1.9326 -0.04556 0.0004549{'[46岁,48)}59 25 2.36 0.15424 0.0016199{[48,51)}99年41 2.4146 0.17713 0.0035449{'[51,58)'} 157 62 2.5323 0.22469 0.0088407 {'[58,Inf]'} 93 25 3.72 0.60931 0.032198 {''} 19 11 1.7273 -0.15787 0.00063885 {' total '} 803 397 2.0227 NaN 0.087112
PlotBins(SC,“CustAge”)
对于数值预测器CustAge
,去除切割点48
和51
然后使用modifybins
定义A.“MinValue”
的0
要手动更改装箱,请注意这不会影响< >失踪
本和< >失踪
垃圾箱留在最后。
cp (cp = = 48) = [];cp (cp = = 51) = [];sc = modifybins (sc,“CustAge”,“割点”,cp,“MinValue”,0);bi = bininfo (sc,“CustAge”);DISP(BI)
本好不好悲哀InfoValue几率 _____________ ____ ___ ______ ________ __________ {'[ 0, 33) 52} 69 1.3269 -0.42156 0.018993{[33岁,37)}63年45 1.4 -0.36795 0.012839{[37、40)}72年47 1.5319 -0.2779 0.0079824{'[40岁,46)}172 89 1.9326 -0.04556 0.0004549{'[46岁,58)}315 128 2.4609 0.19612 0.013701{的[58岁的Inf]} 93年25 3.72 0.60931 0.032198{''} 19 11 1.7273 -0.15787 0.00063885{'合计'}803 397 2.0227 NaN 0.086808
PlotBins(SC,“CustAge”)
显示的分类数据的bin信息“ResStatus”
这包括标记为单独的垃圾箱中的缺失数据< >失踪
.
[bi,cg] = bininfo(sc,“ResStatus”);DISP(BI)
Bin Good Bad Odds WOE InfoValue ______________ _____________ _________ __________ {'Tenant'} 296 161 1.8385 -0.095463 0.0035249 {'Home Owner'} 352 171 2.0585 0.017549 0.00013382 {'Other'} 128 52 2.4615 0.19637 0.0055808 {''} 27 13 2.0769 0.026469 2.3248e-05 {' total '} 803 397 2.0227 NaN 0.0092627
PlotBins(SC,“ResStatus”)
对于绝对预测器resstatus
, 用modifybins
手动合并'房主'
和“其他”
通过将相同的容器号分配给这些类别,将其划分为单个组。注意,这不会影响< >失踪
本和< >失踪
垃圾箱留在最后。
cg.BinNumber (3) = 2;sc = modifybins (sc,“ResStatus”,“CatGrouping”、cg);[bi,cg] = bininfo(sc,“ResStatus”);DISP(BI)
宾好差赔率WOE INFOVALUE _____________ ____ ___ ______ _________ __________ { '组别1'} 296 161 1.8385 -0.095463 0.0035249 { '组2'} 480 223 2.1525 0.062196 0.0022419 { '<缺失>'} 27 13 2.0769 0.026469 2.3248e-05 {”总计'} 803 397 2.0227 NAN 0.00579
disp (cg)
类别binnumber ______________ _________ {'租户'} 1 {'归属主'} 2 {'其他'} 2
sc
- - - - - -信用计分卡模型creditscorecard
对象信用记分卡模型,指定为acreditscorecard
对象。用creditscorecard
创建一个creditscorecard
对象。
PredictorName
- - - - - -预测器的名称预测器的名称,指定为包含预测器名称的字符向量。PredictorName
区分大小写。
数据类型:字符
指定可选的逗号分隔的对名称,价值
参数。的名字
参数名和价值
是相应的价值。的名字
必须出现在引号内。您可以以任何顺序指定多个名称和值对参数Name1, Value1,…,的家
.
sc = modifybins(sc,PredictorName,'MinValue',10,'CutPoints',[23,44,66,88])
MinValue
- - - - - -最小可接受值(仅限数字预测器)负
(默认)|数字最小可接受值,指定为逗号分隔对,由“MinValue”
和一个数值(仅用于数值预测器)。低于这个数字的值被认为超出了范围。
数据类型:双
maxvalue.
- - - - - -最大可接受值(仅限数值预测器)正
(默认)|数字最大可接受值,指定为逗号分隔对,由“执行”
和一个数值(仅用于数值预测器)。上方的值被认为超出范围。
数据类型:双
割点
- - - - - -仓间分割点CatGrouping
- - - - - -具有两列的表类别
和BinNumber
类别
和BinNumber
具有两列的表类别
和BinNumber
,指定为逗号分隔的配对组成“CatGrouping”
以及一个表,其中第一列包含预测器的类别的详尽列表,第二列包含每个类别所属的bin编号。
默认情况下,每个类别都放在一个单独的容器中。如果观察到的类别是'
Cat1'
...,'
猫米'
,默认的分类分组如下。
类别 | BinNumber |
---|---|
' Cat1' |
1 |
' Cat2' |
2 |
... | ... |
' 猫M'' |
米 |
数据类型:双
BinLabels
- - - - - -每个垃圾箱的垃圾箱标签每个垃圾箱的箱标签,指定为逗号分隔的配对“BinLabels”
和带有箱标签名称的字符向量的单元格数组。
请注意
“BinLabels”
不支持值万博1manbetx< >失踪
.
容器标签用于标记不同对象函数中的容器,例如bininfo
,plotbins
, 和displaypoints.
.一个creditscorecard
对象在容器被修改时自动设置默认容器。bin标签的默认格式取决于预测器的类型。
的格式BinLabels
是:
数字数据 - 在任何手动或自动修改预测器箱之前,默认情况下,每个观察到的预测值值都有一个垃圾箱。在这种情况下,箱标签简单地显示了预测值值。一旦被修改了预测器箱,就有非遗料值MinValue
或者maxvalue.
,或非默认的切点C1, C2,…Cn.在这种情况下,bin标签是:
本1标签:'[
MinValue
,C1
)'
本2标签:“[C1
,C2
)'
最后一个bin标签:“[Cn
,maxvalue.
]“
例如,如果有三个箱子,MinValue
是0,maxvalue.
是40,切割点1是20并且切割点2是30,然后相应的三个箱标签是:
“[0,20)“(20、30)' '(30、40)'
分类数据 - 对于任何修改预测器箱的分类数据,每类别有一个箱。在这种情况下,箱标签只是显示了预测的类别。一旦垃圾箱进行了修改,标签将设置为“Group1”
,“Group2”
等等,分别为Bin 1,Bin 2等。例如,假设我们有以下类别分组
类别 | BinNumber |
---|---|
' Cat1' |
1 |
' Cat2' |
2 |
' Cat3' |
2 |
本1包含“Cat1”
并且它的bin标签被设置为“Group1”
.本2包含“Cat2”
和“Cat3”
它的bin标签被设置为“Group2”
.
提示
使用BinLabels
应该是修改容器的最后一步(如果需要的话)。BinLabels
属性在每次修改容器时都会重写定义modifybins
或者autobinning
功能。
数据类型:细胞
sc
- 信用记分卡模型creditscorecard
对象信用记分卡模型,作为更新返回creditscorecard
对象。有关使用的更多信息creditscorecard
对象,看到creditscorecard
.
[1]安德森,R。信用评分工具包。牛津大学出版社,2007。
[2] Refaat,M。信用风险记分卡:使用SAS开发和实施。Lulu.com,2011年。
creditscorecard
|autobinning
|bininfo
|predictorinfo
|modifypredictor
|bindata
|plotbins
|fitmodel
|displaypoints.
|formatpoints
|分数
|setmodel.
|probdefault
|vigwateModel.
你点击一个链接对应于这个MATLAB命令:
通过在MATLAB命令窗口中输入命令来运行命令。Web浏览器不支持MATLAB命令。万博1manbetx
您还可以从以下列表中选择一个网站:
选择中国网站(中文或英文)以获得最佳网站性能。其他MathWorks国家站点没有针对您所在位置的访问进行优化。