# Using bayes theorem to calculate credit risk given prior knowledge and predicted probability

How can one combine:

1. a priori knowledge of the default proability of a certain loan type based on historical data
2. the default probability of an individual loan as predicted by a machine learning model
3. the estimated accuracy (or recall or AUC) of the machine learning model

into credit risk estimation?

Let's say we have a loan application of a given duration and sum from a customer with n previous loans and from historical data we know that 80% of such loans will default. Then we have a machine learning model with an AUC of 0.7 and recall of 0.3 which says that this loan has only a 10% probability to go into default. Can Bayes theorem be used in this instance to calculate the credit risk and what should be events A and B in the theorem:

$$P(A|B) = \frac{P(B|A)P(A)}{P(B)}$$