{"id":20812473,"url":"https://github.com/chandkund/loan-eligibility-prediction","last_synced_at":"2026-04-09T23:49:13.369Z","repository":{"id":253590220,"uuid":"843953211","full_name":"chandkund/Loan-Eligibility-Prediction","owner":"chandkund","description":"This project is designed to predict the eligibility of loan applicants based on various factors such as income, credit history, and marital status. By analyzing historical loan application data, the model helps to determine whether a loan application should be approved or not.","archived":false,"fork":false,"pushed_at":"2025-02-11T16:48:55.000Z","size":388,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T17:44:55.867Z","etag":null,"topics":["data-analysis","data-science","data-visualization","machine-learning-algorithms","matplotlib","numpy","pandas","python","seaborn"],"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/chandkund.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":"2024-08-17T23:23:39.000Z","updated_at":"2025-02-11T16:48:58.000Z","dependencies_parsed_at":"2024-08-18T00:27:25.803Z","dependency_job_id":"41ef1366-a1fc-4ad2-8483-0330970206cd","html_url":"https://github.com/chandkund/Loan-Eligibility-Prediction","commit_stats":null,"previous_names":["chandkund/loan-eligibility-prediction"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chandkund%2FLoan-Eligibility-Prediction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chandkund%2FLoan-Eligibility-Prediction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chandkund%2FLoan-Eligibility-Prediction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chandkund%2FLoan-Eligibility-Prediction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chandkund","download_url":"https://codeload.github.com/chandkund/Loan-Eligibility-Prediction/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243158972,"owners_count":20245669,"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":["data-analysis","data-science","data-visualization","machine-learning-algorithms","matplotlib","numpy","pandas","python","seaborn"],"created_at":"2024-11-17T20:54:41.085Z","updated_at":"2025-12-26T00:15:22.534Z","avatar_url":"https://github.com/chandkund.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Loan-Eligibility-Prediction\nThis project is designed to predict the eligibility of loan applicants based on various factors such as income, credit history, and marital status. By analyzing historical loan application data, the model helps to determine whether a loan application should be approved or not.\n\n   \n## Table of Contents \n- [Introduction](#introduction)   \n- [Installation](#installation)            \n- [Data_Loading](#data_loading)        \n- [Data_Cleaning_and_Preprocessing](#data_cleaning_and_preprocessing)              \n- [Normalization](#normalization)       \n- [Modeling](#modeling)       \n- [Results](#results)   \n- [License](#license)          \n\n## introduction\nThe dataset used for this project includes the following columns:   \n- **Loan_ID**: Unique identifier for each loan application.    \n- **Gender**: Applicant's gender (Male/Female).\n- **Married**: Marital status of the applicant (Yes/No).\n- **Dependents**: Number of dependents (0, 1, 2, 3+).\n- **Education**: Education level of the applicant (Graduate/Not Graduate).\n- **Self_Employed**: Whether the applicant is self-employed (Yes/No).\n- **ApplicantIncome**: Income of the applicant.\n- **CoapplicantIncome**: Income of the co-applicant (if any).\n- **LoanAmount**: Requested loan amount.  \n- **Loan_Amount_Term**: Term of the loan in months.  \n- **Credit_History**: Whether the applicant has a credit history (1: Yes, 0: No).\n- **Property_Area**: Area of the property (Urban/Semiurban/Rural).\n- **Loan_Status**: Loan approval status (Y: Yes, N: No).\n## Installation\nTo run this project, you need to have Python and the following libraries installed:\n\n- pandas\n- numpy\n- matplotlib\n- seaborn\n- scikit-learn\n  \nYou can install these libraries using pip:\n\n     pip install pandas numpy scikit-learn seaborn matplotlib\n  \nOR \nClone the repository and install the required libraries:\n\n     git clone https://github.com/chandkund/Loan-Eligibility-Prediction.git\n\n## Data_Loading\nFirst, load the dataset using pandas:\n```python\nraw_data = pd.read_csv(\"D:\\\\Data_Science_Project\\\\Project_5\\\\train.csv\")\nraw_data.head()\ndf = raw_data.copy()\ndf.info()  # Check the dataset information\n```\n\n## Data_Cleaning_and_Preprocessing\nThe following steps are performed for data cleaning and preprocessing:\n\n-  Handle missing values in numerical and categorical columns using SimpleImputer.\n-  Visualize the cleaned data using box plots and histograms.\n-  Normalize and standardize the data for better model performance.\n```python \nsns.pairplot(df)\nplt.show()\npd.crosstab(df['Credit_History'],df['Loan_Status'],margins = True)\ndf.boxplot(column = 'ApplicantIncome')\ndf['ApplicantIncome'].head()\ndf['ApplicantIncome'].hist(bins= 20)\nplt.show()\ndf.boxplot(column = 'LoanAmount')\nplt.show()\ndf['LoanAmount'].hist(bins = 20)\nplt.show()\n# Normalization\ndf['LoanAmount_log'] = np.log(df['LoanAmount'])\ndf['LoanAmount_log'].hist(bins = 20)\nplt.show()\ndf.isnull().sum()\n```\n- **Imputing missing values***:\n```python \ndf[\"Gender\"].fillna(df[\"Gender\"].mode()[0],inplace =True)\ndf[\"Married\"].fillna(df[\"Married\"].mode()[0],inplace =True)\ndf[\"Dependents\"].fillna(df[\"Dependents\"].mode()[0],inplace =True)\ndf[\"Self_Employed\"].fillna(df[\"Self_Employed\"].mode()[0],inplace =True)\ndf[\"LoanAmount\"].fillna(df[\"LoanAmount\"].mean(),inplace =True)\ndf[\"LoanAmount_log\"].fillna(df[\"LoanAmount_log\"].mean(),inplace =True)\ndf[\"Credit_History\"].fillna(df[\"Credit_History\"].mode()[0],inplace =True)\ndf[\"Loan_Amount_Term\"].fillna(df[\"Loan_Amount_Term\"].mode()[0],inplace =True)\ndf.isnull().sum()\n# Heatmap =\u003e All numerical data \nnum_df = df.select_dtypes(include=['number']) \nsns.heatmap(num_df.corr(), annot=True)\nplt.title(\"Correlation Heatmap for all Numerial Variables\")\n```\n\n ## Normalization\n```python   \ndf[\"TotalIncome\"] = df['ApplicantIncome'] +df[\"CoapplicantIncome\"]\ndf[\"TotalIncome_log\"] =np.log(df[\"TotalIncome\"])\ndf[\"TotalIncome_log\"].hist(bins = 20)\nplt.show()\n```\n\n - **Features and target**:\n ```python\nX = df.iloc[:,np.r_[1:5,9:11,13:15]].values\nY = df.iloc[:,12].values\n```\n\n- **Split the data**:\n```python\nfrom sklearn.model_selection import train_test_split\nX_train,X_test,Y_train,Y_test = train_test_split(X,Y,test_size = 0.2, random_state= 0)\nX_train.shape,X_test.shape,Y_train.shape,Y_test.shape \n```\n- **LabelEncoder**:\n\n```python\nfrom sklearn.preprocessing import LabelEncoder\nlabelencoder_X = LabelEncoder()\nfor i in range(0,5):\n    X_train[:,i] =labelencoder_X.fit_transform(X_train[:,i])\nX_train[:,7] =labelencoder_X.fit_transform(X_train[:,7])\nX_train[:5]\nfrom sklearn.preprocessing import LabelEncoder\nlabelencoder_y = LabelEncoder()\nY_train =labelencoder_y.fit_transform(Y_train)\nY_train[:5]\nfor i in range(0,5):\n    X_test[:,i] = labelencoder_X.fit_transform(X_test[:,i])\n\nX_test[:5]\n\nX_test[:,7] =labelencoder_X.fit_transform(X_test[:,7])\nY_test =labelencoder_y.fit_transform(Y_test)\nY_test[:5]\n```\n\n- **Standardizatio of Data**:\n```python\nfrom sklearn.preprocessing import StandardScaler \n\nscaled = StandardScaler()\nX_train = scaled.fit_transform(X_train)\nX_text = scaled.fit_transform(X_test)\nX_train \n```\n\nDifferent regression models are built and evaluated:\n\n- LogisticRegression\n- Support Vector Machine\n- DecisionTreeClassifier\n- KNeighborsClassifier \n\n## Modeling\n\n- **Model_1:Logistic Regression**:\n```python\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.tree import DecisionTreeClassifier\n\nmodel_1 = LogisticRegression()\nmodel_1.fit(X_train,Y_train) \n```\n- **Model_1:Evaluation**: \n```python\npred1 = model_1.predict(X_test)\nscore1 = accuracy_score(pred,Y_test)\nprint(f'Accuracy: {score * 100:.2f}%')\n```\n\n- ***Model_2: Support Vector Machine**:\n```python\nfrom sklearn.svm import SVC\nmodel_2 = SVC()\nmodel_2.fit(X_train,Y_train)\n```\n- **Model_2:Evaluation**:\n```python\npred2 = model_2.predict(X_test)\nscore2  = accuracy_score(pred2,Y_test)\nprint(f'Accuracy: {accuracy * 100:.2f}%')\n```\n- **Model 3 .DecisionTreeClassification**:\n\n```python\nfrom sklearn.tree import DecisionTreeClassifier\n\nModel_3 = DecisionTreeClassifier()\nModel_3.fit(X_train,Y_train)\n```\n- **Model_3:Evaluation**: \n\n```python\npred3 = Model_3.predict(X_test)\nscore3 = accuracy_score(pred3,Y_test)\nprint(f'Accuracy: {score3 * 100:.2f}%')\n```\n- **Model 4.KNeighborsClassifier**:\n\n```python\nfrom sklearn.neighbors import KNeighborsClassifier\nknn = KNeighborsClassifier()\nknn.fit(X_train,Y_train)\n```\n- **Model_4:Evaluation**: \n```python\npred4 = knn.predict(X_test)\nscore4 = accuracy_score(pred4,Y_test)\nprint(f'Accuracy: {score4 * 100:.2f}%')\n```\n\n\n## Results\nThe models are evaluated based on Mean Squared Error (MSE). Below are the MSE results for each model:\n\n- LogisticRegression accuracy_score  : 82.93%\n- Support Vector Machine  accuracy_score  :82.93%\n- DecisionTreeClassifier accuracy_score  :73.17%\n- KNeighborsClassifier accuracy_score  : 79.67%\n\n## License\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchandkund%2Floan-eligibility-prediction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchandkund%2Floan-eligibility-prediction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchandkund%2Floan-eligibility-prediction/lists"}