Loan Eligibility Assessor

Binary Classification Model

In many real-world situations, we need to make decisions based on patterns in data. For instance, a bank may want to automatically decide if a customer is eligible for a loan. This decision depends on various factors such as the customer's age, income, and criminal history. Traditionally, this decision might be made manually by an agent reviewing each application. However, with the help of machine learning, we can build a model that learns from historical data and automates the decision-making process with high accuracy.

In this example, a binary classification model is built using ML.NET, Microsoft's machine learning framework. A binary classification task is a type of machine learning problem where the goal is to predict one of two possible outcomes (e.g., Yes or NoEligible or Not Eligible). 

The model is trained using historical data from past loan applications. While it doesn't rely on hardcoded rules, patterns in the data reveal a clear trend: applications submitted by individuals aged 25 or older, earning at least $40,000 annually, and with no criminal record are typically approved automatically. If any of these conditions are not met, the application is more likely to be declined.

This page demonstrates a live implementation of the machine learning model. It uses a FastTree binary classifier trained with ML.NET to predict loan eligibility based on a user's age, income, and criminal record status.

Test The Model
  • Decision: {{ result.decision ? '✅ Eligible for Loan' : '❌ Not Eligible' }}
  • Probability: {{ result.probability }}%
  • Score: {{ result.score }}
📊 Model Metrics
  • Accuracy: 99.8608%
  • AUC (Area Under ROC Curve): 99.99976%
  • F1 Score: 99.89323%

Evaluating the model

Evaluating a machine learning model is crucial to ensure it makes reliable predictions. It's not enough for the model to correctly identify eligible applicants — it must also avoid false positives, where someone is mistakenly approved despite being a high risk. A well-evaluated model helps businesses make fair, data-driven decisions, reducing financial risk while maintaining trust and consistency in the approval process. 

Here, three metrics are used to evaluate the model: 

Accuracy: the accuracy is the proportion of total predictions that were correct. It is calculated as: 

Accuracy = (True Positives + True Negatives) / Total Predictions

Area Under ROC Curve (AUC or AUROC): AUC measures the ability of the model to distinguish between the two classes. It's the area under the Receiver Operating Characteristic (ROC) curve, which plots the True Positive Rate (Sensitivity) against the False Positive Rate at various thresholds. It is calculated as: 

AUC = Probability the model ranks a randomly chosen positive instance higher than a negative one

F1 Score: the F1 Score is the harmonic mean of Precision and Recall. It is calculated as: 

F1 Score = 2 * (Precision * Recall) / (Precision + Recall)

Where: 

  • Precision = TP / (TP + FP): Of all positive predictions, how many were correct?
  • Recall = TP / (TP + FN): Of all actual positives, how many were identified?

 

Here, our model is scoring extremely well by all 3 measures. 

📁 Training Data (Sample)
Age Income Has Criminal Record Label
51 148703 False True
58 80405 False True
29 65902 False True
69 42259 False True
55 148236 False True
53 31633 False False
43 72582 False True
52 49516 False True
26 146344 True False
38 134157 True False
📥 Download Full Dataset

Data Quality

The quality of a machine learning model depends heavily on the quality of the data it's trained on. Inaccurate, outdated, or biased data can lead to misleading predictions and poor business decisions. Equally important is how the data is modelled — choosing the right features, handling missing values, and representing patterns effectively. Good data and thoughtful modelling are essential for building reliable, trustworthy systems that truly reflect the real-world problems they aim to solve.

Real-World Impact

Such applications solve real-world business problems by automating decision-making, reducing manual review time, and helping financial institutions make faster, more consistent, and cost-effective lending decisions. This small example can be applied to many areas:

  • Banks can automate loan approvals

  • HR teams can classify job applicants

  • Healthcare can predict if a patient is at risk

 

By building a binary classification model, you can scale up decision-making, reduce human error, and act faster on data-driven insights. 

ML.NET allows .NET developers to harness the power of machine learning without needing to switch to Python or R. It’s fast, flexible, and integrates naturally into your existing .NET applications. 

Whether you're looking to build a new AI-powered application or integrate machine learning capabilities into existing systems, I can bring the expertise to turn your vision into reality.

Feel free to contact me today to explore some new your ideas.