# Forecast new loans that will be granted next month using machine learning NN regressor

I'm attempting to apply a machine learning regression solution using NN to the following problem:

I have the history of loans granted by a bank, and I need to forecast what loans will be opened in the future based on macroeconomic variables. Amount, Zipcode and Segment are loan features and Unemployment and GDP are macroeconomic features.

Loan Date        Amount     Zipcode   Segment     Unemployment    GDP      Probability
1    Jan-2020    100,000     40921    Corporate      5.1%         2.5%         1.0
2    Oct-2020    250,000     54323    Business       4.9%         3.2%         1.0
3    Mar-2021    223,000     40921    Business       4.8%         3.1%         1.0
4    Dec-2021    562,000     43241    Coporate       5.0%         2.9%         1.0
5    Feb-2022    300,000     54325    Corporate      5.2%         2.7%         1.0


I added Probability = 1.0 to every line because the loan was actually granted. Probability is the label in the machine learning model, and it's what I need to predict with the regressor. If probability is greater than 0.5 then the loan is granted, else is not granted.

Now, I need to predict loans that will be opened next month, Apr-2022 at the moment of this writing. The question is what do I take as input in the prediction. My idea is to take all the loans that were granted in the past, combine with the Unemployment and GDP forecasted for Apr-2022, and see if the Probability is greater than 0.5.

I have two concerns. First, I'd like to know if this model makes sense. Second, since I don't have much control over the number of loans that were granted in the past, if the history is large then the predicted number will also be large, and this is not right.

Any suggestions how to approach this?

• you can try using the column probability as a target in your model. Mar 29 at 15:22
• Thanks, I already say that in the question, probability is the label, aka the target Mar 29 at 15:23
• At this moment, your ML is not regression. To resolve, you need to add a new variable that calculates the score for each loan. The score will be responsible for determining the default in loans and predicting the probability of new loans Mar 29 at 15:28

Given the data and information shared by you, if you also have rows in which loan application was rejected then this problem can be phrased as Classification Problem. Given the data shared by you i would frame the problem as following :

Independent Variable : ZipCode, Amount, Segment,Unemplyment, GDP

Target Variable : Loan Accepted Flag (0,1)


Once we have these we can also try to bring in more data like Crime Rate, Defaul Rate etc by Zipcode & Segment to overall level.

This model will use your independent variables and whenever you enter new loan with all information it will return probability of acceptance.

I think you can completely ignore Date Column unless you know that Load Acceptance varies by Month or any other date related variable.

Once the problem is formulated, you can approach it like any other classification problem

• Thanks, you say whenever you enter new loan with all information it will return probability of acceptance I shouldn't enter a new loan, I need to forecast new loans. Also, I'm not looking for the probability of acceptance. Mar 31 at 17:35
• Understood, That may be difficult using the current format of data you have, Mar 31 at 17:37

Both positive and negative labels are required in order to train a machine learning classification model. It appears that you only have positive labels. Any model trained on the current data will only predict positive labels for all future data.

I suggest finding additional data that is similar but the loan was not granted. Then the model will be able to learn which feature values are associated with granting or not granting a loan.

• Brian, I ended up adding not granted data, so I can calculate the probability. The problem now is that I don't know how to calculate the number of loans that will be requested to the bank in the future Apr 17 at 11:59