https://github.com/sadegh15khedry/creditcard-transaction-anomaly-detection-using-isolationforest
detecting fraudulent transactions in credit card data using anomaly detection techniques.
https://github.com/sadegh15khedry/creditcard-transaction-anomaly-detection-using-isolationforest
anomaly-detection matplotlib numpy pandas python seaborn sklearn
Last synced: about 1 month ago
JSON representation
detecting fraudulent transactions in credit card data using anomaly detection techniques.
- Host: GitHub
- URL: https://github.com/sadegh15khedry/creditcard-transaction-anomaly-detection-using-isolationforest
- Owner: sadegh15khedry
- License: apache-2.0
- Created: 2024-06-11T15:28:12.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-08-17T10:24:10.000Z (6 months ago)
- Last Synced: 2024-11-11T21:08:51.861Z (3 months ago)
- Topics: anomaly-detection, matplotlib, numpy, pandas, python, seaborn, sklearn
- Language: Jupyter Notebook
- Homepage:
- Size: 28.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Anomaly Detection in Credit Card Transactions
The Isolation Forest is a powerful tool for detecting fraudulent credit card transactions. Its unsupervised nature allows it to detect anomalies in datasets without requiring labeled data, making it particularly useful in situations where fraudulent transactions are rare and unpredictable.## Table of Contents
- [Overview](#overview)
- [Installation Guide](#installation-guide)
- [Directory Structure](#directory-structure)
- [Files and Functions](#files-and-functions)
- [Results](#Results)
- [Contributing](#contributing)
- [Acknowledgments](#acknowledgments)
- [License](#license)
-## Overview
This project implements anomaly detection in credit card transactions using the Isolation Forest algorithm. The dataset used includes transaction details such as year, month, department, division, merchant, and transaction amount.### Installation
1. Clone the repository:
```bash
git clone https://github.com/your_username/your_repository.git
cd CreditCard-Transaction-Anomaly-Detection-Using-IsolationForest
```2. Install the required libraries using the environment.yml file using conda:
```bash
conda env create -f environment.yml
```
3. activate conda environment
```bash
conda activate anomaly-detection
```
4. Dataset:
get the dataset using the following link https://www.kaggle.com/datasets/ybifoundation/credit-card-transaction5. Run the notebooks:
Run the notebooks using the conda environment.6. Explore the results:
- The code performs exploratory data analysis, preprocessing, applies Isolation Forest for anomaly detection, and visualizes anomalies detected.## Folder Structure
The project folder structure is organized as follows:
```
CreditCard-Transaction-Anomaly-Detection-Using-IsolationForest/
├── src
│ ├── utils.py
│ ├── anomaly_detection.py
│ ├── data_preprocessing.py
│ └── data_exploration.py
├── notebooks
│ ├── data_exploration.ipynb
│ ├── data_preprocessing.ipynb
│ └── anomaly_detection.ipynb
├── LICENSE
├── environment.yml
└── README.md
```## Files and Functions
- `utils.py` : Utility functions for various tasks.
- `anomaly_detection.py` : Functions for anomaly detection.py.
- `data_preprocessing.py` : Functions for data preprocessing.
- `data_exploration.py` : Functions for data exploration.
- `data_exploration.ipynb`: Notebook for data exploration.
- `data_preprocessing.ipynb`: Notebook for data preprocessing.
- `anomaly_detection.py`: Notebook for anomaly detection.## Results
The following is the visulized result for 0.001 of data.

## Contributing
Contributions are welcome. For major changes, please open an issue first to discuss what you would like to change.
## Acknowledgments
- Inspired by tutorials and examples on anomaly detection and Isolation Forest.
## License
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.