This project implements an advanced deep learning solution for detecting fraudulent credit card transactions. It combines the power of Recurrent Neural Networks (RNN) with multiple activation functions and a sophisticated architecture to achieve high-accuracy fraud detection.
- Advanced RNN architecture with 6 hidden LSTM layers
- Multiple activation functions (ReLU, tanh, sigmoid, PReLU, ELU, SELU)
- Interactive web interface using Streamlit
- Support for both single and batch predictions
- Comprehensive visualization of results
- Detailed performance metrics and analysis
- Input Layer: LSTM with 128 units
- Hidden Layers:
- LSTM (64 units) with ReLU activation
- LSTM (32 units) with tanh activation
- LSTM (16 units) with sigmoid activation
- LSTM (8 units) with PReLU activation
- LSTM (4 units) with ELU activation
- LSTM (2 units) with SELU activation
- Output Layer: Dense layer with sigmoid activation
- Regularization: Dropout layers (0.2) after each LSTM layer
- Clone the repository:
git clone https://github.com/Mayankvlog/Credit-card-fraud-detection-Data-science-project.git
cd Credit-card-fraud-detection-Data-science-project- Create and activate virtual environment:
python -m venv myenv
source myenv/bin/activate # Linux/Mac
myenv\Scripts\activate # Windows- Install dependencies:
pip install -r requirements.txtstreamlit run app.py-
Single Prediction:
- Input transaction details manually
- Get instant fraud probability predictions
- Visual indicators for fraudulent/legitimate transactions
-
Batch Prediction:
- Upload CSV files with multiple transactions
- Get predictions for all transactions
- Download results in CSV format
- Visualize prediction distributions
- View confusion matrix and performance metrics
-
Model Information:
- View model architecture
- Access performance metrics
- Read usage instructions
The model expects the following features:
- Time: Seconds elapsed between transactions
- V1-V28: Principal components from PCA
- Amount: Transaction amount
- Uses binary cross-entropy loss
- Implements early stopping to prevent overfitting
- Includes comprehensive evaluation metrics:
- ROC curve and AUC score
- Precision-Recall curve
- Confusion matrix
- Classification report
├── app.py # Streamlit web application
├── requirements.txt # Python dependencies for model
├── requirements_app.txt # Dependencies for web app
├── data/
│ └── creditcard.csv # Dataset file
├── model/
│ ├── credit_card_fraud_model.h5 # Saved model
│ └── scaler.pkl # Saved scaler
└── credit_card_fraud_detection.ipynb # Model development notebook
Contributions are welcome! Please feel free to submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
- Dataset: Credit Card Fraud Detection dataset
- Libraries: TensorFlow, Keras, Streamlit, scikit-learn
- Visualization: Matplotlib, Seaborn
- Author: Mayank
- GitHub: @Mayankvlog