This project demonstrates how Machine Learning can be used to detect fraudulent credit card transactions.
A Logistic Regression model is trained to classify transactions as fraudulent or legitimate.
Credit card fraud is a major issue in the financial sector.
The objective of this project is to build a binary classification model that can identify suspicious transactions and help reduce fraud-related losses.
The project focuses on:
- Data preprocessing
- Feature scaling
- Logistic Regression model training
- Model evaluation using accuracy
The dataset used in this project is taken from Kaggle:
🔗 https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud
- Python 🐍
- NumPy
- Pandas
- Scikit-learn
- Jupyter Notebook
Logistic Regression is a supervised learning algorithm used for binary classification problems.
Target Classes:
0→ Legitimate Transaction1→ Fraudulent Transaction
- Import required libraries
- Load the dataset
- Preprocess the data
- Split data into training and testing sets
- Apply feature scaling using
StandardScaler - Train the Logistic Regression model
- Evaluate model performance using accuracy score
The model is evaluated using:
- Accuracy Score 0.949238578680203
This metric helps measure how well the model correctly classifies transactions.
-
Clone the repository:
git clone https://github.com/Vinay-Rai/credit-card-fraud-detection.git
-
Navigate to the project directory:
cd credit-card-fraud-detection -
Install required dependencies:
pip install -r requirements.txt
-
Download the dataset from Kaggle and place it inside a
data/folder:data/creditcard.csv -
Open the Jupyter Notebook:
jupyter notebook Credit_Card_Fraud_Detection.ipynb
- Use advanced models like Random Forest or XGBoost
- Handle class imbalance using SMOTE
- Add Precision, Recall, F1-score, and ROC-AUC metrics
- Deploy the model using Flask or Streamlit
This project shows how Logistic Regression can be effectively applied to a real-world fraud detection problem.
It is beginner-friendly and serves as a strong foundation for more advanced machine learning projects.
⭐ If you find this project helpful, feel free to star the repository!