Skip to content

Machine learning models for predicting credit risk in LendingClub dataset.

Notifications You must be signed in to change notification settings

lingumd/Credit_Risk_Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.