Coder Social home page Coder Social logo

baylex / credit_risk_analysis Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 11.0 21.33 MB

Supervised Machine Learning and Credit Risk

Jupyter Notebook 100.00%
machine-learning imbalanced-learning scikit-learn random-over-sampling smote-algorithm cluster-centroids-algorithm smoteenn balanced-random-forest easy-ensemble-classifier

credit_risk_analysis's Introduction

Credit_Risk_Analysis

Supervised Machine Learning and Credit Risk

Overview of the loan prediction risk analysis:

Credit risk is an inherently unbalanced classification problem, as good loans easily outnumber risky loans. Different techniques were used to train and evaluate models with unbalanced classes. Various libraries and algorithms were used to build and evaluate models using resampling including:

  1. imbalanced-learn
  2. scikit-learn
  3. RandomOverSampler
  4. SMOTE algorithms
  5. ClusterCentroids algorithm
  6. SMOTEENN algorithm
  7. BalancedRandomForestClassifier (bias reduction model)
  8. EasyEnsembleClassifier (bias reduction model)

Purpose:

  1. Explain how a machine learning algorithm is used in data analytics.
  2. Create training and test groups from a given data set.
  3. Implement the logistic regression, decision tree, random forest, and support vector machine algorithms.
  4. Interpret the results of the logistic regression, decision tree, random forest, and support vector machine algorithms.
  5. Compare the advantages and disadvantages of each supervised learning algorithm.
  6. Determine which supervised learning algorithm is best used for a given data set or scenario.
  7. Use ensemble and resampling techniques to improve model performance.

Results:

The results for the six machine learning models including their respective balanced accuracy, precision, and recall scores are as follows:

Naive Random Oversampling

Pic 1

  1. Balanced Accuracy: 0.6612700484668286
  2. Precision: The precision is low for High-risk loans and is high for Low-risk loans.
  3. Recall: High/Low risk = .66/.67

SMOTE Oversampling

Pic 2

  1. Balanced Accuracy: 0.6303296388959394
  2. Precision: The precision is low for High-risk loans and is high for Low-risk loans.
  3. Recall: High/Low risk = .62/.64

Undersampling

Pic 3

  1. Balanced Accuracy: 0.6303296388959394
  2. Precision: The precision is low for High-risk loans and is high for Low-risk loans.
  3. Recall: High/Low risk = .63/.40

Combination Under-Over Sampling

Pic 4

  1. Balanced Accuracy: 0.5173713090878325
  2. Precision: The precision is low for High-risk loans and is high for Low-risk loans.
  3. Recall: High/Low risk = .70/.57

Balanced Random Forest Classifier

Pic 5

  1. Balanced Accuracy: 0.7877672625306695
  2. Precision: The precision is low for High-risk loans and is high for Low-risk loans.
  3. Recall: High/Low risk = .67/.91

Easy Ensemble AdaBoost Classifier

Pic 6

  1. Balanced Accuracy: 0.925427358175101
  2. Precision: The precision is low for High-risk loans and is high for Low-risk loans.
  3. Recall: High/Low risk = .91/.94

Summary:

When working with balanced accuracy, the highest compared accuracy between 0 and 1 and is closest to 1 is the best machine learning model. For the credit card data set, the Easy Ensemble AdaBoost Classifier is the best model to choose with its .93 balanced accuracy. The other models were below .80 balanced accuracy. The precision for all models were similar and within an appropriate range. The recall score also needs to fall within 0 and 1, with numbers closer to 1 being the better model. The Easy Ensemble AdaBoost Classifier had the highest recall score, making it the final best machine learning model to choose for further credit card analysis.

credit_risk_analysis's People

Contributors

baylex avatar

Stargazers

 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.