| Credit Card Fraud Detection Analysis and Preprocessing - | |
| 1. Introduction, Data Source, and Project Goal | |
| This project presents an Exploratory Data Analysis (EDA) and strategic data preparation for a credit card fraud detection dataset. The dataset, sourced from Kaggle, contains over 280,000 records. The primary challenge identified is extreme class imbalance, as less than 0.2% of transactions are fraudulent. The goal is to prepare the data for a classification model capable of predicting whether a transaction is Fraud (Class 1) or Legitimate (Class 0). | |
| 2. Data Cleaning and Preprocessing | |
| Initial cleaning involved the removal of 1,081 duplicate records to ensure reliability. Feature Engineering was performed by transforming the raw 'Time' feature into more meaningful features: Hour_Of_Day and Day. The original 'Time' column was subsequently dropped as it became redundant. | |
| Following this cleaning, the data was split into training and test sets. The additional strategic treatment included two steps: RobustScaler was applied only to the 'Amount' feature (fitting exclusively on the training set) to address outliers and prevent bias. The imbalance was handled using the SMOTE technique, applied only to the training set to balance the classes. | |
| 3. Key EDA Insights and Findings | |
| Visual analysis revealed crucial patterns guiding the modeling approach: | |
| Amount Pattern: Analysis by amount categories showed that the fraud rate is highest in the high amount category (above 500), suggesting a criminal strategy focused on "big-ticket" transactions. | |
| Time Pattern: A clear temporal pattern exists; the fraud rate increases significantly during late-night and early-morning hours. | |
| Correlations: Correlation analysis indicated that anonymized features V17, V14, V12 (negative correlation) and V11, V4 (positive correlation) are the strongest linear predictors of fraud. | |
| 4. Baseline Model Strategy | |
| The data is now prepared for training. Logistic Regression was chosen as the baseline model. The strategy focuses on achieving high Recall for the fraud class, as the standard Accuracy metric is misleading due to the severe imbalance. The use of SMOTE and RobustScaler is essential to ensure the model successfully identifies the rare fraud cases. | |
| Video link to my EDA presentaion - https://drive.google.com/file/d/1T1N9ADKIbEJcNwqCmrC61p8uVzA3IpWR/view?usp=drive_link |