{"id":26234541,"url":"https://github.com/sharkb8t/credit-risk-classification","last_synced_at":"2026-04-15T19:38:08.474Z","repository":{"id":282124944,"uuid":"947568297","full_name":"Sharkb8t/credit-risk-classification","owner":"Sharkb8t","description":"Demonstrates my abilities to use Jupyter Notebook with scikit-learn to train and evaluate a machine learning model.","archived":false,"fork":false,"pushed_at":"2025-03-12T22:52:28.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T23:29:22.785Z","etag":null,"topics":["jupyter-notebook","numpy","pandas","pathlib","python","scikit-learn"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sharkb8t.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-12T22:36:02.000Z","updated_at":"2025-03-12T22:53:49.000Z","dependencies_parsed_at":"2025-03-12T23:39:24.824Z","dependency_job_id":null,"html_url":"https://github.com/Sharkb8t/credit-risk-classification","commit_stats":null,"previous_names":["sharkb8t/credit-risk-classification"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharkb8t%2Fcredit-risk-classification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharkb8t%2Fcredit-risk-classification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharkb8t%2Fcredit-risk-classification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharkb8t%2Fcredit-risk-classification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sharkb8t","download_url":"https://codeload.github.com/Sharkb8t/credit-risk-classification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243324593,"owners_count":20273129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jupyter-notebook","numpy","pandas","pathlib","python","scikit-learn"],"created_at":"2025-03-13T02:19:07.593Z","updated_at":"2026-04-15T19:38:08.425Z","avatar_url":"https://github.com/Sharkb8t.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 💳 Credit Risk Classification\n\n## 🌐Overview:\n\nThis project involves building a **logistic regression model** to predict **credit risk** based on historical loan data. The goal is to classify loans as either **healthy (0)** or **high-risk (1)** using **scikit-learn's Logistic Regression model**.  \n\n## 🖥️ Technologies Used:\n\n🐍 Python\n\n📊 Pandas\n\n🤖 Scikit-Learn\n\n📒 Jupyter Notebook  \n\n## ℹ️ Dataset:\n\nThe dataset (`lending_data.csv`) contains **loan records** with various financial attributes.  \n\n- **Label Variable (`loan_status`)**:\n\n  - `0`: Healthy Loan\n\n  - `1`: High-Risk Loan\n\n- **Features (`X`)**: Various financial indicators (e.g., income, loan amount, credit history).  \n\n## 🔧 Installation and Usage:\n\n### 1️⃣ Clone the Repository\n\n```bash\ngit clone https://github.com/Sharkb8t/credit-risk-classification.git\ncd credit-risk-classification\n```\n\n### 2️⃣ Install Required Libraries\n\n```bash\npip install pandas scikit-learn\n```\n\n### 3️⃣ Run the Jupyter Notebook\n\n```bash\njupyter notebook\n```\n\nOpen `credit_risk-classification.ipynb` and run cells in sequencial order.\n\u003e Update file path in cell *5*\n\n## 🗺️ Steps in the Analysis\n\n#### 1.) Data Preprocessing\n\n✅ Load and inspect the dataset:\n\n- Read lending_data.csv into a Pandas DataFrame.\n\n- Check for missing values and data types.\n\n✅ Define features and target variables:\n\n- Separate loan_status as the target variable (y).\n\n- Drop loan_status from the dataset to create features (X).\n\n✅ Split the dataset:\n\n- Use train_test_split() to divide the data into 80% training and 20% testing.\n\n#### 2.) Model Training\n\n🚀 Train a Logistic Regression Model:\n\n- Import `LogisticRegression` from scikit-learn.\n\n- Instantiate the model with `random_state=1`.\n\n- Train the model using `X_train` and `y_train`.\n\n#### 3.) Predictions and Evaluation\n\n📈 Generate Predictions:\n\n\u003e Use `predict()` on `X_test` to generate loan risk predictions (`y_pred`).\n\n📊 Evaluate Model Performance:\n\n- Compute the Confusion Matrix to analyze misclassifications.\n\n- Generate a Classification Report to measure:\n\n\u003e Precision (Positive Predictive Value)\n\n\u003e Recall (Sensitivity)\n\n\u003e F1-Score (Balance between Precision \u0026 Recall)\n\n- Overall Accuracy\n\n## 🧑‍🔬 Results Summary\n\n| Metric        | Class 0 (Healthy Loan) | Class 1 (High-Risk Loan) |\n|--------------|------------------------|--------------------------|\n| **Precision**  | 100%                   | 86%                      |\n| **Recall**     | 100%                   | 91%                      |\n| **F1-Score**   | 100%                   | 88%                      |\n| **Accuracy**   | **99%**                 | -                        |\n\n### 🔍 Key Observations\n\n- ✅ The model performs exceptionally well overall with 99% accuracy.\n\n- 🔵 Perfect precision and recall for healthy loans (0).\n\n- 🟡 Good recall (91%) for high-risk loans (1), but slightly lower precision (86%), meaning some false positives exist.\n\n### 📑 Recommendation\n\nThe model is highly effective for predicting healthy loans, but to improve high-risk loan precision, we could:\n\n- ⚖️ Adjust class weights (since high-risk loans are underrepresented).\n\n- 🔄 Experiment with higher `max_iter` values for better convergence.\n\n- 🌲 Use alternative models like Random Forest or SMOTE (Synthetic Minority Oversampling Technique) for balancing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkb8t%2Fcredit-risk-classification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharkb8t%2Fcredit-risk-classification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkb8t%2Fcredit-risk-classification/lists"}