Credit Risk Modeling in R
Lore Dirick
Manager of Data Science Curriculum at Flatiron School
test_set$loan_status model_prediction
... ...
[8066,] 1 1
[8067,] 0 0
[8068,] 0 0
[8069,] 0 0
[8070,] 0 0
[8071,] 0 1
[8072,] 1 0
[8073,] 1 1
[8074,] 0 0
[8075,] 0 0
[8076,] 0 0
[8077,] 1 1
[8078,] 0 0
[8079,] 0 1
... ...
No default (0) | Default (1) | |
---|---|---|
No default (0) | 8 | 2 |
Default (1) | 1 | 3 |
test_set$loan_status model_prediction
... ....
[8066,] 1 0.09881492
[8067,] 0 0.09497852
[8068,] 0 0.21071984
[8069,] 0 0.04252119
[8070,] 0 0.21110838
[8071,] 0 0.08668856
[8072,] 1 0.11319341
[8073,] 1 0.16662207
[8074,] 0 0.15299176
[8075,] 0 0.08558058
[8076,] 0 0.08280463
[8077,] 1 0.11271048
[8078,] 0 0.08987446
[8079,] 0 0.08561631
.... ....
No default (0) | Default (1) | |
---|---|---|
No default (0) | ? | ? |
Default (1) | ? | ? |
test_set$loan_status model_prediction
.... ....
[8066,] 1 0.09881492
[8067,] 0 0.09497852
[8068,] 0 0.21071984
[8069,] 0 0.04252119
[8070,] 0 0.21110838
[8071,] 0 0.08668856
[8072,] 1 0.11319341
[8073,] 1 0.16662207
[8074,] 0 0.15299176
[8075,] 0 0.08558058
[8076,] 0 0.08280463
[8077,] 1 0.11271048
[8078,] 0 0.08987446
[8079,] 0 0.08561631
.... ....
test_set$loan_status model_prediction
... ...
[8066,] 1 0
[8067,] 0 0
[8068,] 0 0
[8069,] 0 0
[8070,] 0 0
[8071,] 0 0
[8072,] 1 0
[8073,] 1 0
[8074,] 0 0
[8075,] 0 0
[8076,] 0 0
[8077,] 1 0
[8078,] 0 0
[8079,] 0 0
... ...
test_set$loan_status model_prediction
... ...
[8066,] 1 0
[8067,] 0 0
[8068,] 0 0
[8069,] 0 0
[8070,] 0 0
[8071,] 0 0
[8072,] 1 0
[8073,] 1 0
[8074,] 0 0
[8075,] 0 0
[8076,] 0 0
[8077,] 1 0
[8078,] 0 0
[8079,] 0 0
... ...
No default (0) | Default (1) | |
---|---|---|
No default (0) | 10 | 0 |
Default (1) | 4 | 0 |
$$
$\text{Sensitivity} = 0/(4+0) = 0\%$
$\text{Accuracy} = 10/(10+4+0+0) = 71.4\%$
test_set$loan_status model_prediction
... ...
[8066,] 1 0
[8067,] 0 0
[8068,] 0 0
[8069,] 0 0
[8070,] 0 0
[8071,] 0 0
[8072,] 1 0
[8073,] 1 0
[8074,] 0 0
[8075,] 0 0
[8076,] 0 0
[8077,] 1 0
[8078,] 0 0
[8079,] 0 0
... ...
No default (0) | Default (1) | |
---|---|---|
No default (0) | 7 | 3 |
Default (1) | 1 | 3 |
$$
$\text{Sensitivity} = 3/(3+1) = 75\%$
$\text{Accuracy} = 10/(10+4+0+0) = 71.4\%$
Credit Risk Modeling in R