DEV Community

Cover image for Interpreting Loan Predictions with TrustyAI: Part 1
Sohini Pattanayak for TrustyCore

Posted on • Updated on • Originally published at dev.to

Interpreting Loan Predictions with TrustyAI: Part 1

An Overview

Introduction

AI/ML predictive models are essential for decision-making, but they need to be both accurate and interpretable, especially in regulated industries. TrustyAI provides the tools to understand and explain model decisions.

Imagine a bank using a machine learning model as part of the logic to approve loans. The model is accurate and has helped the bank make more profitable decisions. However, the bank needs to be able to explain why the model approved or denied a loan to a particular applicant. This is where TrustyAI can help!

TrustyAI can provide the bank with insights into the model's decision-making process, helping to ensure transparency and fairness.

Background

Jane, a data scientist at a bank, is building a model to predict applicant’s loan creditworthiness based on specific features. But there's a catch. Regulatory mandates stipulate that any loan decisions made by the bank must be interpretable. Hence, declining an application isn't enough!

There has to be an explanation behind this decision.

The Predictive Model:

The features Jane considers for her model are:

  • Annual Income
  • Number of Open Accounts
  • Number of times Late Payments in the past
  • Debt-to-Income ratio
  • Number of Credit Inquiries in the last 6 months

Jane's initial model is a straightforward linear one, with weights assigned to each feature based on their importance.

Before we get started on the actual code in the next part of this blog, make sure to follow the prerequisites before you plan on executing the code.

Prerequisites

Python: Ensure you have Python version 3.8 or higher. If not, download and install it from the official Python website.

Pip: Pip, the package installer for Python, should be installed by default with Python >=3.8, or we can also use an online platform like Binder or Google Collab

IDE: An Integrated Development Environment (IDE) makes it easier to write and run Python code. Some popular options include PyCharm or VsCode

A virtual environment is a self-contained directory that contains a Python installation for a particular version of Python, plus a number of additional packages, hence please create that.

With your virtual environment activated, it's time to install the trustyAI package: pip install trustyai

You're now ready to proceed with the tutorial.

For this tutorial, I have taken all references from the TrustyAI Python Documentation website - https://trustyai-explainability-python.readthedocs.io/en/latest/, you can follow this to build similar examples.

Follow the next blog to get started with the technical tutorial for this example!

Top comments (1)

Collapse
 
sohinip profile image
Sohini Pattanayak