DeepCreditRisk TOC
DeepCreditRisk TOC
net/publication/342465760
CITATIONS READS
0 7,437
2 authors:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Daniel Rösch on 26 June 2020.
Daniel Rösch*
Harald Scheule†
* DANIEL RÖSCH is a professor of business and holds the chair of statistics and risk management at the Univer-
sity of Regensburg, Germany.
† HARALD SCHEULE is a professor of finance at the University of Technology Sydney, Australia.
Deep Credit Risk
Machine Learning in Python
1st edition, 2020
ISBN: 9798617590199
Impressum:
Copyright © 2020 Daniel Rösch, Harald Scheule
All rights reserved.
Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best effort in preparing this book,
they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specif-
ically disclaim any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or
extended by sales representatives or written sales materials. The advise and strategies contained herein may not be suitable for
your situation. You should consult with a professional where appropriate. Neither the publisher nor author shall be liable for any
loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages.
2
Contents
I Principles of Data Learning 11
1 Deep Dive 12
1.1 Boost Your Practical Machine Learning Skills . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.2 Credit Risk Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3 Hands-on Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4 Basel, CECL, IFRS 9, DFAST, CCAR and Stress Tests . . . . . . . . . . . . . . . . . . . . . 16
1.5 First Lessons from the COVID-19 Crisis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.5.1 Credit Risk Analytics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.5.2 Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2 Python Literacy 20
2.1 Synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2.1 Anaconda and IDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2.2 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.2.3 Coding Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.3 First Look . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.4 Describing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.5 Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.6 Generating New Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.7 Transforming Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.8 Subsetting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.9 Resetting Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.10 Combining Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.10.1 Concatenating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.10.2 Appending . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.10.3 Match Merging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.10.4 Joining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.11 Regression Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.12 numpy vs pandas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.13 Packages and Basic Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.14 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.14.1 versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.14.2 dataprep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.14.3 woe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.14.4 validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.14.5 resolutionbias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.15 Sandbox Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3 Risk-Based Learning 40
3.1 Synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.2 Maximum-Likelihood Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.2.1 Example for Default Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.2.2 Practical Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.3 Bayesian Approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3.1 Distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.3.2 Parameter Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3
Contents
4 Machine Learning 61
4.1 Synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4.2 Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.3 Cost Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.4 Information and Entropy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4.5 Optimization: Gradient Descent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.6 Learning and Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.6.1 Train vs Test Split . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.6.2 Bias-Variance Tradeoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.6.3 Crossvalidation and Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.7 Practical Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.8 P-Value and ML Hacking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4.9 Sandbox Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4
Contents
8 Validation 164
8.1 Synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
8.2 Qualitative Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
8.3 Quantitative Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
8.3.1 Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
8.3.2 Backtesting as Part of Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
8.3.3 Traffic Light Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
8.4 Metrics for Discriminatory Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
8.4.1 Confusion Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
8.4.2 Accuracy Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
8.4.3 Classification Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
5
Contents
6
Contents
7
Contents
8
Contents
9
Contents
20 Outlook 460
20.1 Where Do We Stand Today? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
20.2 Roles of Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
20.3 Where Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
20.4 Keep in Touch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Bibliography 464
10