Git Product home page Git Product logo

lingumd / credit_risk_analysis Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 27.2 MB

Machine learning models for predicting credit risk in LendingClub dataset.

Jupyter Notebook 100.00%
balancedrandomforestclassifier cluster-centroids-undersampling easyensembleclassifier imbalanced-learn machine-learning randomoversampler smote smoteenn confusion-matrix classification-report matplotlib-pyplot numpy pandas pathlib scikit-learn google-colab get-dummies

credit_risk_analysis's Introduction

Credit_Risk_Analysis

Overview

Employ different techniques to train and evaluate models with unbalanced classes. Use imbalanced-learn and scikit-learn libraries to build and evaluate models using resampling.

Using the credit card credit dataset from LendingClub, a peer-to-peer lending services company, oversample the data using the RandomOverSampler and SMOTE algorithms, and undersample the data using the ClusterCentroids algorithm. Then, use a combinatorial approach of over- and undersampling using the SMOTEENN algorithm. Next, compare two new machine learning models that reduce bias, BalancedRandomForestClassifier and EasyEnsembleClassifier, to predict credit risk. Evaluate the performance of these models and make a written recommendation on whether they should be used to predict credit risk.

Results

Using bulleted lists, describe the balanced accuracy scores and the precision and recall scores of all six machine learning models. Use screenshots of your outputs to support your results.

Oversampling

  • The accuracy score is 0.8325468421491353.
  • Confusion Matrix:

oversamplingcm

  • Imbalanced Classification Report:

oversampling_report

SMOTE Oversampling

  • The accuracy score is 0.8440938486973113.
  • Confusion Matrix:

SMOTEcm

  • Imbalanced Classification Report:

SMOTE_report

Undersampling(Cluster Centroids)

  • The accuracy score is 0.8203882595930314.
  • Confusion Matrix:

undersamplingcm

  • Imbalanced Classification Report:

undersampling_report

Combination (Over and Under) Sampling (SMOTEEN)

  • The accuracy score is 0.844016280135965.
  • Confusion Matrix:

combosamplingcm

  • Imbalanced Classification Report:

combosampling_report

Balanced Random Forest Classifier

  • The accuracy score is 0.7589504857875872
  • Confusion Matrix:

brfcm

  • Imbalanced Classification Report:

brf_report

  • The features are sorted in descending order by feature importance:

feature_importance

Easy Ensemble AdaBooster Classifier

  • The accuracy score is 0.9319231677611166
  • Confusion Matrix:

eecm

  • Imbalanced Classification Report:

ee_report

Summary

The resampling models and The BalancedRandomForestClassifier had low f1 scores(0.04-0.07).

The EasyEnsembleClassifier performed the best in classifying the credit risk as high risk with an f1 score of 0.16. Therefore, I would recommend using the EasyEnsembleClassifier to predict credit risk.

credit_risk_analysis's People

Contributors

lingumd 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.