{"id":15794252,"url":"https://github.com/jlenon7/lending-model","last_synced_at":"2025-06-12T17:31:54.466Z","repository":{"id":229849788,"uuid":"777814492","full_name":"jlenon7/lending-model","owner":"jlenon7","description":"🤖 Model that predicts if a customer is eligible for a lending based on dti, loan amount, mortgage accounts and more.","archived":false,"fork":false,"pushed_at":"2024-03-26T23:16:07.000Z","size":30152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-04T23:41:21.032Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jlenon7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-03-26T14:53:30.000Z","updated_at":"2024-03-26T14:54:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"cf4e4137-8ab2-4d7f-9d02-8e3090936e6f","html_url":"https://github.com/jlenon7/lending-model","commit_stats":null,"previous_names":["jlenon7/lending-model"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jlenon7/lending-model","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlenon7%2Flending-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlenon7%2Flending-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlenon7%2Flending-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlenon7%2Flending-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jlenon7","download_url":"https://codeload.github.com/jlenon7/lending-model/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlenon7%2Flending-model/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259512014,"owners_count":22869326,"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":[],"created_at":"2024-10-04T23:40:52.957Z","updated_at":"2025-06-12T17:31:54.448Z","avatar_url":"https://github.com/jlenon7.png","language":"Python","readme":"# Lending Model 🤖\n\n\u003e Model that predicts if a customer is eligible for a lending based on dti, loan amount, mortgage accounts and more.\n\n## Goals\n\nThe goal with this model is to be able to predict if a customer is eligible for a lending or not. The data set used to train the model got too many examples of customers that fully paid the lending than the ones charged off. Our goal is to explore the maximum potential of our data set to be able to create a good train/test data for our model, leading it to has a better accuracy in both cases.\n\n## Results\n\nOver fitting train test data:\n\n\u003cimg src=\"storage/plots/model/is-overfitting-train-test-data.png\" width=\"500px\"/\u003e\n\n### Confusion matrix\n\n```shell\n[[ 6941  8717]\n [  179 63207]]\n```\n\n### Classification report\n\n```shell\n              precision    recall  f1-score   support\n\n           0       0.97      0.44      0.61     15658\n           1       0.88      1.00      0.93     63386\n\n    accuracy                           0.89     79044\n   macro avg       0.93      0.72      0.77     79044\nweighted avg       0.90      0.89      0.87     79044\n```\n\n## Exploratory data analysis\n\nCount fully paid and charged off loans:\n\n\u003cimg src=\"storage/plots/dataframe/c-loan-status.png\" width=\"500px\"/\u003e\n\nCount loan sub grades by loan status:\n\n\u003cimg src=\"storage/plots/dataframe/c-subgrade.png\" width=\"500px\"/\u003e\n\nCorrelation between all fields:\n\n\u003cimg src=\"storage/plots/dataframe/correlation.png\" width=\"500px\"/\u003e\n\nCorrelation between installment and loan amount:\n\n\u003cimg src=\"storage/plots/dataframe/corr-installment-loan-amnt.png\" width=\"500px\"/\u003e\n\nCorrelation between loan repaid and other fields:\n\n\u003cimg src=\"storage/plots/dataframe/corr-loan-repaid.png\" width=\"500px\"/\u003e\n\nCorrelation between loan status and loan amount:\n\n\u003cimg src=\"storage/plots/dataframe/corr-loan-status-loan-amnt.png\" width=\"500px\"/\u003e\n\nHistoric of loans by loan amount:\n\n\u003cimg src=\"storage/plots/dataframe/h-loan-amnt.png\" width=\"500px\"/\u003e\n\n## Running\n\nTo run the model first create a new Python environment and activate it. I'm using [Anaconda](https://www.anaconda.com/) for that. The command bellow will automatically setup the environment with conda and pipenv:\n\n```shell\nmake env\n```\n\nNow install all the project dependencies:\n\n```shell\nmake install-all\n```\n\nAnd run the model:\n\n```shell\nmake model\n```\n\n\u003e [!WARNING]\n\u003e Dont run `make model` without deleting `storage/lending-model.keras`, this will\n\u003e cause train/test data over fitting.\n\nAfter running you model, it will be saved inside `storage/lending-model.keras`.\nTo just run your recent created model and predict a random value from our data set,\nuse the following script:\n\n```shell\nmake predict \n```\n\n\u003e [!WARNING]\n\u003e In case you have deleted the `storage/lending-model.keras`, remember that to get `make predict` working you need to run `make model` first to create it.\n\nTo run TensorBoard with the latest created version of the model within this\nrepository run:\n\n```shell\nmake board\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlenon7%2Flending-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjlenon7%2Flending-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlenon7%2Flending-model/lists"}