compactCreditScorecard
Рабочий процесс объектаВ этом примере показан рабочий процесс создания compactCreditScorecard
объект из creditscorecard
объект.
creditscorecard
объектКак создать compactCreditScorecard
объект, вы должны сначала создать creditscorecard
объект. Создайте creditscorecard
объект со CreditCardData.mat
Файлу и установите аргумент пары "имя-значение" 'BinMissingData'
на true
потому что dataMissing
набор данных содержит отсутствующие данные.
load CreditCardData.mat sc = creditscorecard(dataMissing,'IDVar','CustID','BinMissingData',true); sc = autobinning(sc); sc = modifybins(sc,'CustAge','MinValue',0); sc = modifybins(sc,'CustIncome','MinValue',0);
creditscorecard
объектИспользование fitmodel
для подбора логистической регрессионной модели с использованием данных о весе доказательств (WOE).
[sc, mdl] = fitmodel(sc);
1. Adding CustIncome, Deviance = 1490.8527, Chi2Stat = 32.588614, PValue = 1.1387992e-08 2. Adding TmWBank, Deviance = 1467.1415, Chi2Stat = 23.711203, PValue = 1.1192909e-06 3. Adding AMBalance, Deviance = 1455.5715, Chi2Stat = 11.569967, PValue = 0.00067025601 4. Adding EmpStatus, Deviance = 1447.3451, Chi2Stat = 8.2264038, PValue = 0.0041285257 5. Adding CustAge, Deviance = 1442.8477, Chi2Stat = 4.4974731, PValue = 0.033944979 6. Adding ResStatus, Deviance = 1438.9783, Chi2Stat = 3.86941, PValue = 0.049173805 7. Adding OtherCC, Deviance = 1434.9751, Chi2Stat = 4.0031966, PValue = 0.045414057 Generalized linear regression model: status ~ [Linear formula with 8 terms in 7 predictors] Distribution = Binomial Estimated Coefficients: Estimate SE tStat pValue ________ ________ ______ __________ (Intercept) 0.70229 0.063959 10.98 4.7498e-28 CustAge 0.57421 0.25708 2.2335 0.025513 ResStatus 1.3629 0.66952 2.0356 0.04179 EmpStatus 0.88373 0.2929 3.0172 0.002551 CustIncome 0.73535 0.2159 3.406 0.00065929 TmWBank 1.1065 0.23267 4.7556 1.9783e-06 OtherCC 1.0648 0.52826 2.0156 0.043841 AMBalance 1.0446 0.32197 3.2443 0.0011775 1200 observations, 1192 error degrees of freedom Dispersion: 1 Chi^2-statistic vs. constant model: 88.5, p-value = 2.55e-16
creditscorecard
объектСоздайте новый набор данных, который используется для подсчета очков на основе ранее созданных creditscorecard
объект.
tdata = data(1:10, mdl.PredictorNames); tdata.CustAge(2) = NaN; tdata.CustAge(5) = -5; tdata.ResStatus(1) = '<undefined>'; tdata.ResStatus(3) = 'Landlord'; tdata.EmpStatus(3) = '<undefined>'; tdata.CustIncome(4) = NaN; tdata.EmpStatus(7) = 'Freelancer'; tdata.CustIncome(8) = -1; tdata.CustIncome(4) = NaN; disp(tdata);
CustAge ResStatus EmpStatus CustIncome TmWBank OtherCC AMBalance _______ ___________ ___________ __________ _______ _______ _________ 53 <undefined> Unknown 50000 55 Yes 1055.9 NaN Home Owner Employed 52000 25 Yes 1161.6 47 Landlord <undefined> 37000 61 No 877.23 50 Home Owner Employed NaN 20 Yes 157.37 -5 Home Owner Employed 53000 14 Yes 561.84 65 Home Owner Employed 48000 59 Yes 968.18 34 Home Owner Freelancer 32000 26 Yes 717.82 50 Other Employed -1 33 No 3041.2 50 Tenant Unknown 52000 25 Yes 115.56 49 Home Owner Unknown 53000 23 Yes 718.5
Использование displaypoints
для отображения точек на предиктор. Использование score
для вычисления кредитных счетов с помощью новых данных (tdata
). Затем используйте probdefault
с новыми данными (tdata
) для вычисления вероятности дефолта. При использовании formatpoints
, а 'Missing'
для аргумента пары "имя-значение" задано значение 'minpoints'
потому что tdata
содержит отсутствующие данные.
PointsInfo = displaypoints(sc)
PointsInfo=38×3 table
Predictors Bin Points
_____________ ______________ _________
{'CustAge' } {'[0,33)' } -0.14173
{'CustAge' } {'[33,37)' } -0.11095
{'CustAge' } {'[37,40)' } -0.059244
{'CustAge' } {'[40,46)' } 0.074167
{'CustAge' } {'[46,48)' } 0.1889
{'CustAge' } {'[48,51)' } 0.20204
{'CustAge' } {'[51,58)' } 0.22935
{'CustAge' } {'[58,Inf]' } 0.45019
{'CustAge' } {'<missing>' } 0.0096749
{'ResStatus'} {'Tenant' } -0.029778
{'ResStatus'} {'Home Owner'} 0.12425
{'ResStatus'} {'Other' } 0.36796
{'ResStatus'} {'<missing>' } 0.1364
{'EmpStatus'} {'Unknown' } -0.075948
{'EmpStatus'} {'Employed' } 0.31401
{'EmpStatus'} {'<missing>' } NaN
⋮
[Scores, Points] = score(sc, tdata)
Scores = 10×1
1.2784
1.0071
NaN
NaN
0.9960
1.8771
NaN
NaN
1.0283
0.8095
Points=10×7 table
CustAge ResStatus EmpStatus CustIncome TmWBank OtherCC AMBalance
_________ _________ _________ __________ _________ ________ _________
0.22935 0.1364 -0.075948 0.45309 0.3958 0.15715 -0.017438
0.0096749 0.12425 0.31401 0.45309 -0.033652 0.15715 -0.017438
0.1889 0.1364 NaN 0.080697 0.3958 -0.18537 -0.017438
0.20204 0.12425 0.31401 NaN -0.044701 0.15715 0.35539
0.0096749 0.12425 0.31401 0.45309 -0.044701 0.15715 -0.017438
0.45019 0.12425 0.31401 0.45309 0.3958 0.15715 -0.017438
-0.11095 0.12425 NaN -0.11452 -0.033652 0.15715 -0.017438
0.20204 0.36796 0.31401 NaN -0.033652 -0.18537 -0.21195
0.20204 -0.029778 -0.075948 0.45309 -0.033652 0.15715 0.35539
0.20204 0.12425 -0.075948 0.45309 -0.033652 0.15715 -0.017438
pd = probdefault(sc, tdata)
pd = 10×1
0.2178
0.2676
NaN
NaN
0.2697
0.1327
NaN
NaN
0.2634
0.3080
sc = formatpoints(sc,'BasePoints',true,'Missing','minpoints','Round','finalscore','PointsOddsAndPDO',[500, 2, 50]); PointsInfo1 = displaypoints(sc)
PointsInfo1=39×3 table
Predictors Bin Points
______________ ______________ _______
{'BasePoints'} {'BasePoints'} 500.66
{'CustAge' } {'[0,33)' } -17.461
{'CustAge' } {'[33,37)' } -15.24
{'CustAge' } {'[37,40)' } -11.511
{'CustAge' } {'[40,46)' } -1.8871
{'CustAge' } {'[46,48)' } 6.3888
{'CustAge' } {'[48,51)' } 7.3367
{'CustAge' } {'[51,58)' } 9.3068
{'CustAge' } {'[58,Inf]' } 25.238
{'CustAge' } {'<missing>' } -6.5392
{'ResStatus' } {'Tenant' } -9.3852
{'ResStatus' } {'Home Owner'} 1.7253
{'ResStatus' } {'Other' } 19.305
{'ResStatus' } {'<missing>' } 2.6022
{'EmpStatus' } {'Unknown' } -12.716
{'EmpStatus' } {'Employed' } 15.414
⋮
[Scores1, Points1] = score(sc, tdata)
Scores1 = 10×1
542
523
488
495
522
585
445
448
524
508
Points1=10×8 table
BasePoints CustAge ResStatus EmpStatus CustIncome TmWBank OtherCC AMBalance
__________ _______ _________ _________ __________ _______ _______ _________
500.66 9.3068 2.6022 -12.716 25.446 21.314 4.0988 -8.495
500.66 -6.5392 1.7253 15.414 25.446 -9.6646 4.0988 -8.495
500.66 6.3888 2.6022 -12.716 -1.4161 21.314 -20.609 -8.495
500.66 7.3367 1.7253 15.414 -42.148 -10.462 4.0988 18.399
500.66 -6.5392 1.7253 15.414 25.446 -10.462 4.0988 -8.495
500.66 25.238 1.7253 15.414 25.446 21.314 4.0988 -8.495
500.66 -15.24 1.7253 -12.716 -15.498 -9.6646 4.0988 -8.495
500.66 7.3367 19.305 15.414 -42.148 -9.6646 -20.609 -22.526
500.66 7.3367 -9.3852 -12.716 25.446 -9.6646 4.0988 18.399
500.66 7.3367 1.7253 -12.716 25.446 -9.6646 4.0988 -8.495
pd1 = probdefault(sc, tdata)
pd1 = 10×1
0.2178
0.2676
0.3721
0.3488
0.2697
0.1327
0.5178
0.5077
0.2634
0.3080
compactCreditScorecard
объект из creditscorecard
объектСоздайте compactCreditScorecard
объект с использованием creditscorecard
объект как вход. Также можно создать compactCreditScorecard
объект с использованием compact
функция в Financial Toolbox™.
csc = compactCreditScorecard(sc)
csc = compactCreditScorecard with properties: Description: '' GoodLabel: 0 ResponseVar: 'status' WeightsVar: '' NumericPredictors: {'CustAge' 'CustIncome' 'TmWBank' 'AMBalance'} CategoricalPredictors: {'ResStatus' 'EmpStatus' 'OtherCC'} PredictorVars: {1x7 cell}
compactCreditScorecard
объектМожно анализировать объект compactCreditScorecard с помощью displaypoints
, score
, и probdefault
из Risk Management Toolbox™.
PointsInfo2 = displaypoints(csc)
PointsInfo2=39×3 table
Predictors Bin Points
______________ ______________ _______
{'BasePoints'} {'BasePoints'} 500.66
{'CustAge' } {'[0,33)' } -17.461
{'CustAge' } {'[33,37)' } -15.24
{'CustAge' } {'[37,40)' } -11.511
{'CustAge' } {'[40,46)' } -1.8871
{'CustAge' } {'[46,48)' } 6.3888
{'CustAge' } {'[48,51)' } 7.3367
{'CustAge' } {'[51,58)' } 9.3068
{'CustAge' } {'[58,Inf]' } 25.238
{'CustAge' } {'<missing>' } -6.5392
{'ResStatus' } {'Tenant' } -9.3852
{'ResStatus' } {'Home Owner'} 1.7253
{'ResStatus' } {'Other' } 19.305
{'ResStatus' } {'<missing>' } 2.6022
{'EmpStatus' } {'Unknown' } -12.716
{'EmpStatus' } {'Employed' } 15.414
⋮
[Scores2, Points2] = score(csc, tdata)
Scores2 = 10×1
542
523
488
495
522
585
445
448
524
508
Points2=10×8 table
BasePoints CustAge ResStatus EmpStatus CustIncome TmWBank OtherCC AMBalance
__________ _______ _________ _________ __________ _______ _______ _________
500.66 9.3068 2.6022 -12.716 25.446 21.314 4.0988 -8.495
500.66 -6.5392 1.7253 15.414 25.446 -9.6646 4.0988 -8.495
500.66 6.3888 2.6022 -12.716 -1.4161 21.314 -20.609 -8.495
500.66 7.3367 1.7253 15.414 -42.148 -10.462 4.0988 18.399
500.66 -6.5392 1.7253 15.414 25.446 -10.462 4.0988 -8.495
500.66 25.238 1.7253 15.414 25.446 21.314 4.0988 -8.495
500.66 -15.24 1.7253 -12.716 -15.498 -9.6646 4.0988 -8.495
500.66 7.3367 19.305 15.414 -42.148 -9.6646 -20.609 -22.526
500.66 7.3367 -9.3852 -12.716 25.446 -9.6646 4.0988 18.399
500.66 7.3367 1.7253 -12.716 25.446 -9.6646 4.0988 -8.495
pd2 = probdefault(csc, tdata)
pd2 = 10×1
0.2178
0.2676
0.3721
0.3488
0.2697
0.1327
0.5178
0.5077
0.2634
0.3080
Сравните размер creditscorecard
и compactCreditScorecard
объекты.
whos('dataMissing','sc','csc')
Name Size Bytes Class Attributes csc 1x1 39598 compactCreditScorecard dataMissing 1200x11 84603 table sc 1x1 166575 creditscorecard
Размер compactCreditScorecard
объект легкий по сравнению с creditscorecard
объект. Однако compactCreditScorecard
объект не может быть непосредственно изменен. Если вам нужно изменить compactCreditScorecard
объект, необходимо изменить начальное creditscorecard
объект, а затем повторно онвертируйте этот объект, чтобы создать compactCreditScorecard
снова объект.
autobinning
| bindata
| bininfo
| creditscorecard
| displaypoints
| fitmodel
| formatpoints
| modifybins
| modifypredictor
| plotbins
| predictorinfo
| probdefault
| score
| screenpredictors
| setmodel
| validatemodel