{"id":20796924,"url":"https://github.com/liamarguedas/credit-score-gfc","last_synced_at":"2026-04-29T23:33:12.201Z","repository":{"id":173436430,"uuid":"650771443","full_name":"liamarguedas/credit-score-GFC","owner":"liamarguedas","description":"Credit Score classification system for a Global Finance Company","archived":false,"fork":false,"pushed_at":"2023-06-08T20:31:05.000Z","size":11640,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-26T11:46:40.011Z","etag":null,"topics":["classification","data-science","machine-learning"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/liamarguedas.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":"2023-06-07T19:18:10.000Z","updated_at":"2023-06-07T19:40:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3ab6996-e098-49e5-a04b-acb8c3d7029f","html_url":"https://github.com/liamarguedas/credit-score-GFC","commit_stats":null,"previous_names":["liamarguedas/credit-score-gfc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/liamarguedas/credit-score-GFC","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamarguedas%2Fcredit-score-GFC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamarguedas%2Fcredit-score-GFC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamarguedas%2Fcredit-score-GFC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamarguedas%2Fcredit-score-GFC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liamarguedas","download_url":"https://codeload.github.com/liamarguedas/credit-score-GFC/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamarguedas%2Fcredit-score-GFC/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32448400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["classification","data-science","machine-learning"],"created_at":"2024-11-17T16:31:35.232Z","updated_at":"2026-04-29T23:33:12.178Z","avatar_url":"https://github.com/liamarguedas.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GFC Credit Score Classification \r\n\r\n## Problem description \r\nOver the years, the GFC (Global Finance Company) has collected basic bank details and gathered a lot of credit-related information. The management wants to build an intelligent system to segregate the people into credit score brackets to reduce the manual efforts. The objective is to build a machine learning model that can classify the credit score based in a person’s credit-related information, into 3 brackets: Poor, Standard and Good Credit Score.\r\n\r\nClassifying effectively each person credit score helps the GFC to create a profile for that particular person that would help in the decision taking for interest rates, loans and negotiation with that person. Besides being a good indicator for future Machine Learning problems such as risk perception.\r\n\r\n## Decision Making process\r\n\r\nWith the training data, It was noticeable that the target (Credit_Score) was unbalanced showing more observations labeled as \"Standard\". From the beginning I knew that my biggest challenge through this project was to create a Machine Learning Model that can differentiate between the unbalanced labels (Poor and Good credit score).\r\n\r\n![Target balance](https://raw.githubusercontent.com/liamarguedas/credit-score-GFC/main/Summary-Charts/Target%20Balace.png)\r\n\r\nIn order to create a model that can differentiate between the unbalanced labels I needed to understand the profile of each one (Poor and Good credit score), understanding those patterns and looking for them in the data will made a good performance model for the problem, the statistics of each profile showed me the following:\r\n\r\n![Target Statistics](https://raw.githubusercontent.com/liamarguedas/credit-score-GFC/main/Summary-Charts/Target%20Statistics.png)\r\n\r\nIt is noticeable that there were manny cut off points to determine if someone has good or poor credit score, the ones I notice are:\r\n\r\n- Older people usually have good credit score than youger people, the median showed Good credit score age as 36 and Poor credit score as 31.\r\n\r\n- People with Good credit score have higher income than people with Poor credit score as showed in the columns \"Annual_Income\" and \"Monthly_Inhand_Salary\"\r\n\r\n- People with Good credit score usually have less bank accounts that people with Poor credit score, the meadian in this case is 3 for the Good credit score and 5 for the Poor credit score\r\n\r\n- People with Good credit score usually have better interest rates than people with Poor credit score.\r\n\r\n- People with Good credit score have less loans than people with Poor credit score.\r\n\r\nBy that point I knew that I have the data I needed to create a good model. There was a few challenges through the project like many arbitrary values and the data that needed to be filled, also there were many outliers in some feature that needed to be understand and decide if they were worth removing or leaving. Some outliers showed good patterns for our model, such as Total_EMI_per_month:\r\n\r\n![EMI_per_month](https://raw.githubusercontent.com/liamarguedas/credit-score-GFC/main/Summary-Charts/EMI%20per%20Month.png)\r\n\r\nOutliers than ended up being valuable for the models performance. Since it was a multi-class classification problem I needed to choose Machine Learning algorithms that support this type of classification, I decided to try with:\r\n\r\n- K-Nearest Neighbors\r\n- Random Forest\r\n- Gradient Boosting\r\n- Keras NN\r\n\r\nFor classifications problems I could not based my solution only in the Score metric so I decided to use a ROC AUC, Accuracy, Cohen’s Kappa, Recall, Precision and F1-score. I also needed a baseline score to understand if my model was actually working or it was only making random predictions, my baseline metrics were calulate by:\r\n\r\n- ZeroR value: ZeroR score is the score I will get if I predict everything as zero, this means if the model only predicts Standard credit scores, in order to get a good model I will have to get an score higher than that.\r\n\r\n    ZeroR score: 0.5493287321546753\r\n\r\n- Random Rate Classifier (Weighted Guessing): Calculated by squaring our classed percentage and sum all the values.\r\n\r\n    Random Rate score: 0.55 ** 2 + 0.26 ** 2 + 0.19 ** 2 = 0.40620000000000006\r\n\r\nKnowing what performance the model needed to achieve in order to be useful I created a cross validation scaling the data in each fold to reduce data leakage and I managed to score the next results:\r\n\r\n![Algorithms Performance](https://raw.githubusercontent.com/liamarguedas/credit-score-GFC/main/Summary-Charts/Algorithms%20Performance.png)\r\n\r\n## Final Decision\r\n\r\nRandom Forest showed the best performance out of all of the algorithms So I decided to use Random Forest and tune its hyperparameters, after the tuned I trained another model in a cross validation to see its performance and got the following results:\r\n\r\n![Random Forest Performance](https://raw.githubusercontent.com/liamarguedas/credit-score-GFC/main/Summary-Charts/Random%20Forest%20Classification%20Report.png)\r\n\r\nThe model got a precision of 0.75 in classifying 1 (Good credit score) and 0.78 in classifying 2 (Poor credit score) and an F1-score (It describes the optimal blend of precision and recall combined) of 0.74 for 1 (Good credit score) and 0.79 for 2 (Poor credit score) with an overall accuracy (Including 0 Standard) of 0.80.\r\n\r\nThe confuision matrix for this tunned model were showing the next results:\r\n\r\n![Confusion Matrix](https://raw.githubusercontent.com/liamarguedas/credit-score-GFC/main/Summary-Charts/Random%20Forest%20Confusion%20Matrix.png)\r\n\r\nIt is noticeable that the model really learned to differentiate between 1 (Good credit score) and 2 (Poor credit score) which was the objetive. From the confusion matrix out of 17.000 there is only 25 observations predicted as 2 (Poor credit score) when they were really 1 (Good credit score) and 70 observatios predicted as 1 (Good credit score) when they were really 2 (Poor credit score). This means that from the cross validation the model performed very well classifying the data points.\r\n\r\nSince Random Forest showed an amazing performance I decided to train the final model with the entire dataset (85.000 Observations) in order to solve the problem and understand the importance of each feature trainned. The feature importance graph looked like:\r\n\r\n![Feature importance](https://raw.githubusercontent.com/liamarguedas/credit-score-GFC/main/Summary-Charts/Random%20Forest%20Feature%20Importance.png)\r\n\r\nFrom the chart we can see that they were a lot of features that were not that much important for the model and among those that were important in the trainning we have \"Outstanding_Debt\", \"Interest_Rate\" and \"Credit_History_Age\". Since the GFC provided a testing data, I predicted the values of the data and compare their statistics to the original (Model trained) data set to see if the Random Forest model could really describe our data.\r\n\r\n![Statistics](https://raw.githubusercontent.com/liamarguedas/credit-score-GFC/main/Summary-Charts/Train%20vs%20Test%20Statistics.png)\r\n\r\nWe can see that the model predictions hold the statistics from the original data set, which is good for our problem. An example of this is age, at the beginning I said that older people usually have good credit score than younger people and the predicted variables showed the same behavior and the patterns hold for each continuos feature in the project. \r\n\r\n## Did my decision solve the GFC problem?\r\n\r\nFrom the final statistics is noticeable that the model predictions can really describe the data with a really good precision, since it is an unbalanced target there's gonna be some datapoints that were predicted as 0 (Standard) but I managed to reduced the amount of observations that were 1 (Good) and got predicted 2 (Poor) and vice-versa. Which was the main objective of the project, since predicting 1 (Good) and 2 (Poor) as 0 (Standard) was not a such a deal for the GFC, differentiate between Good and Poor credit score was the main goal. It would be a huge mistake and problem if the model predicted someone with poor credit score as having a good credit score and I worked focusing in minimazing those predictions and erros. I am satisfied with the results delivered and it satisfies the company goals. So in overall it solved the GFC Problem.\r\n\r\n## Is there any room for improvement?\r\n\r\nI tried training the model with and without engineered features and I found no difference. I also tried trainning the model without the features with little to no correlation and without outliers and there was no difference, the best performance model without overfitting was the one I showcased in the project together with the hyperparameters tunned, there could be room for improvement in the creation of new feature engineered variables and transformations (that might affect the model in production) or new valuable features to trained the model again.\r\n\r\nRandom Forest with the hyperparameters tunned showed a model that describes the data with a good precision and can differentiate between the classes, having a low cost of implementation and a sustainable model overall. I have managed to solve the entire problem, developed a really good approach and an amazing data science project.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliamarguedas%2Fcredit-score-gfc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliamarguedas%2Fcredit-score-gfc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliamarguedas%2Fcredit-score-gfc/lists"}