Machine Learning data preprocessing and EDA project on the UCI Credit Card Default dataset.
Dataset: Default of Credit Card Clients (UCI Repository)
This project focuses on preprocessing the Default of Credit Card Clients dataset to prepare it for machine learning models that predict whether a customer will default on their credit card payment in the following month.
The notebook performs data cleaning, exploratory data analysis (EDA), feature analysis, outlier detection, feature scaling, and train-test splitting to ensure high-quality input for classification algorithm.
The final processed dataset is ready for training classification models such as Logistic Regression, Decision Tree, Random Forest, XGBoost, and other machine learning algorithms.
The goal of this project is to produce a clean and standardized dataset that improves model performance while preventing data leakage.
- Dataset Name: Default of Credit Card Clients
- Source: UCI Machine Learning Repository
- https://archive.ics.uci.edu/ml/datasets/default+of+credit+card+clients
The dataset contains demographic information, payment history, bill statements, previous payment amounts, and the target variable indicating whether the client defaulted on payment the next month.
- Total Records: 30,000
- Total Features: 25 (including the target variable)
- Problem Type: Binary Classification
The objective is to predict whether a customer will default on their credit card payment in the next month.
Target Variable:
-
default payment next month
- 0 → No Default
- 1 → Default
- Python
- Google Colab / Jupyter Notebook
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-learn
Credit_Default_Preprocessing/ │ ├── Credit_Default_Preprocessing.ipynb ├── default of credit card clients.xls ├── README.md
| Feature | Description |
|---|---|
| ID | Unique customer identifier |
| LIMIT_BAL | Amount of credit limit granted (NT dollars) |
| SEX | Gender (1 = Male, 2 = Female) |
| EDUCATION | Education level |
| MARRIAGE | Marital status |
| AGE | Customer age |
These variables represent the customer's repayment status during the previous six months.
| Feature | Description |
|---|---|
| PAY_0 | Repayment status in September |
| PAY_2 | Repayment status in August |
| PAY_3 | Repayment status in July |
| PAY_4 | Repayment status in June |
| PAY_5 | Repayment status in May |
| PAY_6 | Repayment status in April |
Repayment Status Codes:
- -2 = No consumption
- -1 = Paid in full
- 0 = Paid on time
- 1 = Payment delay for one month
- 2–8 = Delay for multiple months
Outstanding bill amount for the previous six months.
- BILL_AMT1
- BILL_AMT2
- BILL_AMT3
- BILL_AMT4
- BILL_AMT5
- BILL_AMT6
Amount paid by the customer during the previous six months.
- PAY_AMT1
- PAY_AMT2
- PAY_AMT3
- PAY_AMT4
- PAY_AMT5
- PAY_AMT6
| Value | Meaning |
|---|---|
| 0 | Customer did not default |
| 1 | Customer defaulted |
The following preprocessing steps were performed before model training.
The notebook imports the required Python libraries for:
- Data manipulation
- Visualization
- Feature engineering
- Data preprocessing
Libraries include:
- pandas
- numpy
- matplotlib
- seaborn
- scikit-learn
- Loaded the Excel dataset using Pandas.
- Verified dataset dimensions and feature names.
The notebook performs:
- Dataset overview
- Data types inspection
- Missing value analysis
- Duplicate record detection
- Statistical summary
Cleaning operations include:
- Checked for duplicate records.
- Removing duplicate records (if present).
- Dropping unnecessary columns
- Removing the ID column since it is only an identifier and does not contribute to prediction.
- Verified that the dataset contains no missing values.
The dataset is divided into:
- Numerical features
- Categorical features
This separation simplifies preprocessing and analysis.
Outliers are identified using visualization techniques such as boxplots to understand the distribution of numerical variables.
The notebook includes:
- Bivariate analysis
- Correlation matrix
- Heatmap visualization
- Mutual Information analysis to evaluate feature importance
Separated the dataset into:
Features (X)
- LIMIT_BAL
- SEX
- EDUCATION
- MARRIAGE
- AGE
- PAY_0 to PAY_6
- BILL_AMT1 to BILL_AMT6
- PAY_AMT1 to PAY_AMT6 All independent variables.
Target (y)
- default payment next month
The data is divided into training and testing sets.
- Training Data: 80%
- Testing Data: 20%
This ensures that the model is evaluated on unseen data.
Splitting is performed before scaling to prevent data leakage.
Only numerical columns are standardized using StandardScaler.
Scaling is performed by:
- Fitting the scaler on training data
- Transforming both training and testing data using the same scaler
This ensures consistent preprocessing while avoiding information leakage.
- No encoding was performed because all categorical variables (SEX, EDUCATION, MARRIAGE, PAY_0 to PAY_6) are already represented as numerical codes in the dataset.
After preprocessing, the notebook produces:
- Clean dataset
- Feature importance analysis
- Boxplots for Outlier Detection
- Correlation analysis
- Standardized numerical features
- Train and test datasets ready for machine learning
These analyses helped identify feature distributions, relationships, and potential outliers.
git clone https://github.com/your-username/Credit_Default_Preprocessing.gitcd Credit_Default_Preprocessingpip install pandas numpy matplotlib seaborn scikit-learn openpyxljupyter notebookOpen:
Credit_Default_Preprocessing.ipynb
Run the notebook from the first cell to the last.
| Team Member | Contribution |
|---|---|
| Gokul | Dataset Understanding & Initial Exploratory Data Analysis (EDA): Loaded the dataset, inspected its structure, identified numerical and categorical features, checked missing values and duplicates, validated categorical values, removed irrelevant columns (ID), identified the target variable, and performed univariate analysis on numerical, categorical, and target variables. |
| Devadeth | Outlier Handling & Visualization: Detected and analyzed outliers using the IQR method and boxplots, performed bivariate analysis between features and the target variable, created comparative visualizations, and documented key observations from the analysis. |
| Kanchana | Feature Selection: Conducted correlation analysis using a correlation matrix and heatmap, evaluated feature importance using Mutual Information, identified multicollinearity, selected relevant features, and prepared the final feature set for modeling. |
| Rinimol R | Feature Engineering & Data Preprocessing: Performed feature engineering where appropriate, documented preprocessing decisions, identified numerical features for scaling, applied StandardScaler after train-test splitting to prevent data leakage, verified the processed dataset, saved the final preprocessed dataset, summarized the preprocessing workflow, and prepared the GitHub project documentation (README). |
This preprocessed dataset can be used with several classification algorithms, including:
- Logistic Regression
- Decision Tree Classifier
- Random Forest
- Support Vector Machine (SVM)
- K-Nearest Neighbors (KNN)
- Naive Bayes
- AdaBoost
- Gradient Boosting
- XGBoost
- Artificial Neural Networks (ANN)
Load Dataset │ ▼ Data Cleaning │ ▼ Remove Duplicates │ ▼ Drop ID Column │ ▼ Check Missing Values │ ▼ Outlier Handling │ ▼ Bivariate Analysis │ ▼ Feature Selection │ ▼ Train-Test Split │ ▼ Feature Scaling │ ▼ Model Training │ ▼ Model Evaluation
The goal of this project is to build reliable machine learning models capable of predicting credit card payment defaults using customer demographic information, payment history, billing records, and previous payment behavior.
Yeh, I. C., & Lien, C. H. (2009). The comparisons of data mining techniques for the predictive accuracy of probability of default of credit card clients. Expert Systems with Applications, 36(2), 2473–2480.
Dataset: Default of Credit Card Clients from the UCI Machine Learning Repository.
https://archive.ics.uci.edu/ml/datasets/default+of+credit+card+clients
This project is intended for educational and academic purposes.