Giter VIP home page Giter VIP logo

asalvs / credit-risk-classification Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 541 KB

This project uses logistic regression models to analyze credit risk. The recommended model, trained with resampled data, shows higher precision and recall scores for predicting high-risk loans. This model helps mitigate credit risk for lending companies.

Jupyter Notebook 100.00%
creditcardfrauddetection datascience-machinelearning logistic-regression machine-learning-algorithms python

credit-risk-classification's Introduction

Credit Risk Analysis

Overview of the Analysis

The purpose of this analysis is to evaluate the performance of two logistic regression machine learning models in predicting the credit risk associated with loans. The analysis was conducted on financial data, specifically focusing on loan size, interest rate, borrower income, debt-to-income ratio, number of accounts, derogatory marks, and total debt. The objective was to predict the loan status, either as a healthy loan (0) or high-risk loan (1).

The stages of the machine learning process in this analysis included:

  1. Splitting the data into training and testing datasets
  2. Creating and fitting a logistic regression model with the original data
  3. Evaluating the model's performance using accuracy, precision, and recall scores
  4. Resampling the data using RandomOverSampler to address class imbalance
  5. Creating and fitting another logistic regression model with the resampled data
  6. Evaluating the performance of the resampled model using the same metrics

Methods used in this analysis include LogisticRegression and RandomOverSampler for resampling.

Results

Machine Learning Model 1: Logistic Regression with Original Data

Description of Model 1 Accuracy, Precision, and Recall scores.

Accuracy: The overall accuracy of the model is 0.99, indicating that it correctly classifies 99% of the instances. Precision:

  • Healthy loans (0): The model has a precision of 1.00, which means it's excellent at identifying true positives with very few false positives.
  • High-risk loans (1): The model has a precision of 0.87, indicating its moderate effectiveness in identifying high-risk loans with some false positives. Recall:
  • Healthy loans (0): The model has a recall of 1.00, which means it's correctly identifying nearly all instances of healthy loans with very few false negatives.
  • High-risk loans (1): The model has a recall of 0.89, indicating its effectiveness in identifying high-risk loans with some false negatives.

Machine Learning Model 2: Logistic Regression with Resampled Data

Description of Model 2 Accuracy, Precision, and Recall scores.

Accuracy: The overall accuracy of the model is 0.99, indicating that it correctly classifies 99% of the instances. Precision:

  • Healthy loans (0): The model has a precision of 0.99, which means it's excellent at identifying true positives with very few false positives.
  • High-risk loans (1): The model also has a precision of 0.99, indicating its effectiveness in identifying high-risk loans with very few false positives. Recall:
  • Healthy loans (0): The model has a recall of 0.99, which means it's correctly identifying nearly all instances of healthy loans with very few false negatives.
  • High-risk loans (1): The model has a recall of 0.99, indicating its effectiveness in identifying high-risk loans with very few false negatives.

Summary

Based on the results, the logistic regression model trained with resampled data (Model 2) performs better than the model trained with original data (Model 1), particularly in predicting high-risk loans. Model 2 demonstrates higher precision and recall scores for high-risk loans, which is crucial in minimizing potential financial losses for the lending company.

I recommend using the logistic regression model trained with resampled data (Model 2) for credit risk analysis, as it shows a significant improvement in predicting high-risk loans compared to the original model. This model will help the company effectively assess loan applications and make informed decisions when approving or rejecting loans, thus mitigating credit risk.

credit-risk-classification's People

Contributors

asalvs avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.