Previous Next

Machine Learning for Financial Risk Management with Python Algorithms for Modeling Risk (Abdullah Karasan) (z-library.sk, 1lib.sk, z-lib.sk)

Author: Abdullah Karasan

移动

Financial risk management is quickly evolving with the help of artificial intelligence. With this practical book, developers, programmers, engineers, financial analysts, and risk analysts will explore Python-based machine learning and deep learning models for assessing financial risk. You'll learn how to compare results from ML models with results obtained by traditional financial risk models. Author Abdullah Karasan helps you explore the theory behind financial risk assessment before diving into the differences between traditional and ML models. With this book, you'll learn • Review classical time series applications and compare them with deep learning models • Explore volatility modeling to measure degrees of risk, using support vector regression, neural networks, and deep learning • Revisit and improve market risk models (VaR and expected shortfall) using machine learning techniques • Develop a credit risk based on a clustering technique for risk bucketing, then apply Bayesian estimation, Markov chain, and other ML models • Capture different aspects of liquidity with a Gaussian mixture model • Use machine learning models for fraud detection • Identify corporate risk using the stock price crash metric • Explore a synthetic data generation process to employ in financial risk

📄 File Format: PDF
💾 File Size: 25.0 MB
7
Views
0
Downloads
0.00
Total Donations

📄 Text Preview (First 20 pages)

ℹ️

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

📄 Page 1
Abdullah Karasan Machine Learning for Financial Risk Management with Python Algorithms for Modeling Risk Ka ra sa n
📄 Page 2
MACHINE LE ARNING / DATA “Abdullah Karasan does a great job in showing the capabilities of machine learning with Python in the context of financial risk management—a function vital to any financial institution.” —Dr. Yves J. Hilpisch Founder and CEO of The Python Quants and The AI Machine “If you need a go-to guide about the application of statistical and machine learning methods to analysis of financial risk, this is a great place to start.” —Graham L. Giller Author of Adventures in Financial Data Science Machine Learning for Financial Risk Management with Python ISBN: 978-1-492-08525-6 US $79.99 CAN $105.99 Twitter: @oreillymedia linkedin.com/company/oreilly-media youtube.com/oreillymedia Financial risk management is quickly evolving with the help of artificial intelligence. With this practical book, developers, programmers, engineers, financial analysts, risk analysts, and quantitative and algorithmic analysts will examine Python-based machine learning and deep learning models for assessing financial risk. Building hands-on AI-based financial modeling skills, you’ll learn how to replace traditional financial risk models with ML models. Author Abdullah Karasan helps you explore the theory behind financial risk modeling before diving into practical ways of employing ML models in modeling financial risk using Python. With this book, you will: • Review classical time series applications and compare them with deep learning models • Explore volatility modeling to measure degrees of risk, using support vector regression, neural networks, and deep learning • Improve market risk models (VaR and ES) using ML techniques and including liquidity dimension • Develop a credit risk analysis using clustering and Bayesian approaches • Capture different aspects of liquidity risk with a Gaussian mixture model and Copula model • Use machine learning models for fraud detection • Predict stock price crash and identify its determinants using machine learning models Abdullah Karasan works as a principal data scientist at Magnimind and lecturer at the University of Maryland, Baltimore. Ka ra sa n
📄 Page 3
Praise for Machine Learning for Financial Risk Management with Python Nowadays, Python is undoubtedly the number one programming language in the financial industry. At the same time, machine learning has become a key technology for the industry. The book by Abdullah Karasan does a great job in showing the capabilities of machine learning with Python in the context of financial risk management—a function vital to any financial institution. —Dr. Yves J. Hilpisch, Founder and CEO of The Python Quants and The AI Machine This book is a comprehensive and practical presentation of a wide variety of methods— drawn from both the statistical and machine learning traditions—for the analysis of financial risk. If you need a go-to guide to the application of these methods to data, this is a great place to start. —Graham L. Giller, author of Adventures in Financial Data Science Abdullah Karasan has made the topic of risk management for finance exciting by applying modern and advanced applications of machine learning. This book is a must for any financial econometrician, hedge fund manager, or quantitative risk management department. —McKlayne Marshall, Analytics Engagement Leader
📄 Page 4
(This page has no text content)
📄 Page 5
Abdullah Karasan Machine Learning for Financial Risk Management with Python Algorithms for Modeling Risk Boston Farnham Sebastopol TokyoBeijing
📄 Page 6
978-1-492-08525-6 [LSI] Machine Learning for Financial Risk Management with Python by Abdullah Karasan Copyright © 2022 Abdullah Karasan. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com. Acquisitions Editor: Michelle Smith Development Editor: Michele Cronin Production Editor: Daniel Elfanbaum Copyeditor: Shannon Turlington Proofreader: Stephanie English Indexer: Potomac Indexing, LLC Interior Designer: David Futato Cover Designer: Karen Montgomery Illustrator: Kate Dullea December 2021: First Edition Revision History for the First Edition 2021-12-07: First Release See http://oreilly.com/catalog/errata.csp?isbn=9781492085256 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Machine Learning for Financial Risk Management with Python, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. The views expressed in this work are those of the author, and do not represent the publisher’s views. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. This book is not intended as financial advice. Please consult a qualified professional if you require financial advice.
📄 Page 7
Table of Contents Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix Part I. Risk Management Foundations 1. Fundamentals of Risk Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Risk 4 Return 4 Risk Management 7 Main Financial Risks 8 Big Financial Collapse 9 Information Asymmetry in Financial Risk Management 11 Adverse Selection 11 Moral Hazard 14 Conclusion 15 References 15 2. Introduction to Time Series Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Time Series Components 20 Trend 21 Seasonality 25 Cyclicality 27 Residual 28 Time Series Models 34 White Noise 35 Moving Average Model 37 Autoregressive Model 42 Autoregressive Integrated Moving Average Model 48 v
📄 Page 8
Conclusion 54 References 55 3. Deep Learning for Time Series Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Recurrent Neural Networks 58 Long-Short Term Memory 65 Conclusion 71 References 72 Part II. Machine Learning for Market, Credit, Liquidity, and Operational Risks 4. Machine Learning-Based Volatility Prediction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 ARCH Model 78 GARCH Model 84 GJR-GARCH 90 EGARCH 92 Support Vector Regression: GARCH 95 Neural Networks 101 The Bayesian Approach 106 Markov Chain Monte Carlo 108 Metropolis–Hastings 110 Conclusion 115 References 116 5. Modeling Market Risk. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Value at Risk (VaR) 121 Variance-Covariance Method 122 The Historical Simulation Method 128 The Monte Carlo Simulation VaR 129 Denoising 133 Expected Shortfall 141 Liquidity-Augmented Expected Shortfall 143 Effective Cost 145 Conclusion 153 References 154 6. Credit Risk Estimation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Estimating the Credit Risk 156 Risk Bucketing 158 Probability of Default Estimation with Logistic Regression 170 vi | Table of Contents
📄 Page 9
Probability of Default Estimation with the Bayesian Model 179 Probability of Default Estimation with Support Vector Machines 185 Probability of Default Estimation with Random Forest 187 Probability of Default Estimation with Neural Network 188 Probability of Default Estimation with Deep Learning 189 Conclusion 192 References 192 7. Liquidity Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 Liquidity Measures 195 Volume-Based Liquidity Measures 195 Transaction Cost–Based Liquidity Measures 199 Price Impact–Based Liquidity Measures 203 Market Impact-Based Liquidity Measures 206 Gaussian Mixture Model 210 Gaussian Mixture Copula Model 216 Conclusion 219 References 219 8. Modeling Operational Risk. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 Getting Familiar with Fraud Data 224 Supervised Learning Modeling for Fraud Examination 229 Cost-Based Fraud Examination 234 Saving Score 236 Cost-Sensitive Modeling 238 Bayesian Minimum Risk 240 Unsupervised Learning Modeling for Fraud Examination 243 Self-Organizing Map 244 Autoencoders 247 Conclusion 251 References 252 Part III. Modeling Other Financial Risk Sources 9. A Corporate Governance Risk Measure: Stock Price Crash. . . . . . . . . . . . . . . . . . . . . . . 255 Stock Price Crash Measures 257 Minimum Covariance Determinant 258 Application of Minimum Covariance Determinant 260 Logistic Panel Application 270 Conclusion 278 References 279 Table of Contents | vii
📄 Page 10
10. Synthetic Data Generation and The Hidden Markov Model in Finance. . . . . . . . . . . . 281 Synthetic Data Generation 281 Evaluation of the Synthetic Data 283 Generating Synthetic Data 284 A Brief Introduction to the Hidden Markov Model 292 Fama-French Three-Factor Model Versus HMM 293 Conclusion 304 References 304 Afterword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 viii | Table of Contents
📄 Page 11
Preface AI and ML reflect the natural evolution of technology as increased computing power enables computers to sort through large data sets and crunch numbers to identify pat‐ terns and outliers. —BlackRock (2019) Financial modeling has a long history with many successfully accomplished tasks, but at the same time it has been fiercely criticized due mainly to lack of flexibility and non-inclusiveness of the models. The 2007–2008 financial crisis fueled this debate as well as paved the way for innovations and different approaches in the field of finan‐ cial modeling. Of course, the financial crisis was not the only thing precipitating the growth of AI applications in finance. Two other drivers, data availability and increased computing power, have spurred the adoption of AI in finance and have intensified research in this area starting in the 1990s. The Financial Stability Board (2017) stresses the validity of this fact: Many applications, or use “cases,” of AI and machine learning already exist. The adop‐ tion of these use cases has been driven by both supply factors, such as technological advances and the availability of financial sector data and infrastructure, and by demand factors, such as profitability needs, competition with other firms, and the demands of financial regulation. As a subbranch of financial modeling, financial risk management has been evolving with the adoption of AI in parallel with its ever-growing role in the financial decision-making process. In his celebrated book, Bostrom (2014) denotes that there are two important revolutions in the history of mankind: the Agricultural Revolution and the Industrial Revolution. These two revolutions have had such a profound impact that any third revolution of similar magnitude would double the size of the world economy in two weeks. Even more strikingly, if the third revolution were accomplished by AI, the impact would be way more profound. ix
📄 Page 12
So expectations are sky-high for AI applications shaping financial risk management at an unprecedented scale by making use of big data and understanding the complex structure of risk processes. With this study, I aim to fill the void about machine learning-based applications in finance so that predictive and measurement performance of financial models can be improved. Parametric models suffer from issues of low variance and high bias; machine learning models, with their flexibility, can address this problem. Moreover, a common problem in finance is that changing distribution of the data always poses a threat to the reliability of the model result, but machine learning models can adapt themselves to changing patterns in a way that models fit better. So there is a huge need and demand for applicable machine learning models in finance, and what mainly distinguish this book is the inclusion of brand-new machine learning-based modeling approaches in financial risk management. In a nutshell, this book aims to shift the current landscape of financial risk manage‐ ment, which is heavily based on the parametric models. The main motivation for this shift is recent developments in highly accurate financial models based on machine learning models. Thus, this book is intended for those who have some initial knowl‐ edge of about finance and machine learning in the sense that I just provide brief explanations on these topics. Consequently, the targeted audience of the book includes, but is not limited to, finan‐ cial risk analysts, financial engineers, risk associates, risk modelers, model validators, quant risk analysts, portfolio analysis, and those who are interested in finance and data science. In light of the background of the targeted audience, having an introductory level of finance and data science knowledge will enable you to benefit most from the book. It does not, however, mean that people from different backgrounds cannot follow the book topics. Rather, readers from different backgrounds can grasp the concepts as long as they spend enough time and refer to some other finance and data science books along with this one. The book consists of 10 chapters: Chapter 1, “Fundamentals of Risk Management” This chapter introduces the main concepts of risk management. After defining what risk is, types of risks (such as market, credit, operational, and liquidity) are discussed. Risk management is explained, including why it is important and how it can be used to mitigate losses. Asymmetric information, which can address the market failures, is also discussed, focusing on information asymmetry and adverse selection. x | Preface
📄 Page 13
Chapter 2, “Introduction to Time Series Modeling” This chapter shows the time-series applications using traditional models, namely the moving average model, the autoregressive model, and the autoregressive inte‐ grated moving average model. We learn how to use an API to access financial data and how to employ it. This chapter mainly aims to provide a benchmark for comparing the traditional time-series approach with recent developments in time-series modeling, which is the main focus of the next chapter. Chapter 3, “Deep Learning for Time Series Modeling” This chapter introduces the deep learning tools for time-series modeling. Recur‐ rent neural network and long short-term memory are two approaches by which we are able to model the data with time dimension. This chapter also gives an impression of the applicability of deep learning models to time-series modeling. Chapter 4, “Machine Learning-Based Volatility Prediction” Increased integration of financial markets has led to a prolonged uncertainty in financial markets, which in turn stresses the importance of volatility. Volatility is used to measure the degree of risk, which is one of the main engagements of the area of finance. This chapter deals with the novel volatility modeling based on support vector regression, neural network, deep learning, and the Bayesian approach. For the sake of comparison of the performances, traditional ARCH- and GARCH-type models are also employed. Chapter 5, “Modeling Market Risk” Here, machine learning-based models are employed to boost estimation perfor‐ mance of the traditional market risk models, namely value at risk (VaR) and expected shortfall (ES). VaR is a quantitative approach for the potential loss of fair value due to market movements that will not be exceeded in a defined period of time and with a defined confidence level. ES, on the other hand, focuses on the tail of the distribution, referring to big and unexpected losses. A VaR model is developed using a denoised covariance matrix, and ES is developed by incorpo‐ rating a liquidity dimension of the data. Chapter 6, “Credit Risk Estimation” This chapter introduces a comprehensive machine learning–based approach to estimating credit risk. Machine learning models are applied based on past credit information along with other data. The approach starts with risk bucketing, which is suggested by the Basel Accord, and continues with different models: Bayesian estimation, the Markov chain model, support vector classification, ran‐ dom forests, neural networks, and deep learning. In the last part of the chapter, the performance of these models will be compared. Preface | xi
📄 Page 14
Chapter 7, “Liquidity Modeling” In this chapter, Gaussian mixture model is used to model the liquidity, which is thought to be a neglected dimension in risk management. This model allows us to incorporate different aspects of the liquidity proxies so that we can capture the effect of liquidity on financial risk in a more robust way. Chapter 8, “Modeling Operational Risk” This chapter covers the operational risk that may result in a failure, mostly due to a company’s internal weakness. There are several sources of operational risks, but fraud risk is one of the most time-consuming and detrimental to the company’s operations. Here, fraud will be our main focus, and new approaches will be devel‐ oped to have better-performing fraud applications based on machine learning models. Chapter 9, “A Corporate Governance Risk Measure: Stock Price Crash” This chapter introduces a brand-new approach to modeling corporate gover‐ nance risk: stock price crash. Many studies find an empirical link between stock price crash and corporate governance. Using the minimum covariance determi‐ nant model, this chapter attempts to unveil the relationship between the compo‐ nents of corporate governance risk and stock price crash. Chapter 10, “Synthetic Data Generation and The Hidden Markov Model in Finance” Here we use synthetic data to estimate different financial risks. The aim of this chapter is to highlight the emergence of synthetic data, which helps us to mini‐ mize the impact of limited historical data. Synthetic data allows us to have data that is large enough and of high quality, which then improves the quality of the model. Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions. Constant width Used for program listings, as well as within paragraphs to refer to program ele‐ ments such as variable or function names, databases, data types, environment variables, statements, and keywords. xii | Preface
📄 Page 15
Constant width bold Shows commands or other text that should be typed literally by the user. Constant width italic Shows text that should be replaced with user-supplied values or by values deter‐ mined by context. This element signifies a general note. This element signifies a warning or caution. Using Code Examples Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/abdullahkarasan/mlfrm. If you have a technical question or a problem using the code examples, please send email to bookquestions@oreilly.com. This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission. We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: "Machine Learning for Financial Risk Management with Python by Abdullah Karasan (O’Reilly). Copyright 2022 Abdullah Karasan, 978-1-492-08525-6.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com. Preface | xiii
📄 Page 16
O’Reilly Online Learning For more than 40 years, O’Reilly Media has provided technol‐ ogy and business training, knowledge, and insight to help companies succeed. Our unique network of experts and innovators share their knowledge and expertise through books, articles, and our online learning platform. O’Reilly’s online learning platform gives you on-demand access to live training courses, in-depth learning paths, interactive coding environments, and a vast collection of text and video from O’Reilly and 200+ other publishers. For more information, visit http://oreilly.com. How to Contact Us Please address comments and questions concerning this book to the publisher: O’Reilly Media, Inc. 1005 Gravenstein Highway North Sebastopol, CA 95472 800-998-9938 (in the United States or Canada) 707-829-0515 (international or local) 707-829-0104 (fax) We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at https://oreil.ly/ml-for-fin-risk-mgmt. Email bookquestions@oreilly.com to comment or ask technical questions about this book. For news and information about our books and courses, visit http://oreilly.com. Find us on Facebook: http://facebook.com/oreilly. Follow us on Twitter: http://twitter.com/oreillymedia. Watch us on YouTube: http://www.youtube.com/oreillymedia. xiv | Preface
📄 Page 17
Acknowledgements The decision to write this book did not come out of the blue. I felt that there was a lack of source material covering the main financial risk management model with machine learning models. This book is an effort to apply the machine learning mod‐ els to financial risk management issues. I came to the conclusion that this book should be different from various angles, such as providing both theoretical and empirical approaches to the models as well as all the code that makes it possible to replicate them. When I shared this idea with Michelle Smith from O’Reilly, I got a green light and constant encouragement. Michelle put faith in this project and sup‐ ported me all the way, for which I am very grateful. As soon as new chapters of the book came in, the informative and fun weekly meet‐ ings with Michele Cronin, my editor, kept me on track and helped me to gain an edi‐ torial perspective. As I progressed, each chapter presented new challenges that required relentless days and nights to deal with. Well, the more time I spent, the harder it became to detect the inaccuracies, typos, and other types of mistakes. This is exactly the point where the invaluable feedback of the technical reviewers came in. I am grateful to Mehmet Benturk, Hariom Tatsat, Isaac Rhea, Dimitri Bianco, McKlayne Marshall, and Michael Shearer for their efforts in making the book what it is today. Additionally, I would like to thank Danny Elfanbaum and Randy Balaban for their quick and helpful comments on the consistency of text. After a long, roller-coaster year, I came to the end of this tedious yet enlightening milestone of my life full of hope that this book will shed light on the path of those who want to learn machine learning in finance. I want to convey my deepest gratitude to those who contributed to the book. Preface | xv
📄 Page 18
(This page has no text content)
📄 Page 19
PART I Risk Management Foundations
📄 Page 20
(This page has no text content)
The above is a preview of the first 20 pages. Register to read the complete e-book.

💝 Support Author

0.00
Total Amount (¥)
0
Donation Count

Login to support the author

Login Now

Recommended for You

Loading recommended books...
Failed to load, please try again later
Back to List