Skip to content

Jampana-Jagadeesh/Payment-Fraud-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real Time Financial Anomaly Detection

Googel Cobal File

This repository contains a Python script for financial anomaly detection using the Isolation Forest algorithm. The script includes data loading, preprocessing, model training, and evaluation steps.

Dataset

The financial anomaly dataset is stored in 'financial_anomaly_data.csv'. It contains information about transactions, including timestamps, transaction amounts, and types.

Prerequisites

Make sure you have the following libraries installed:

  • pandas
  • scikit-learn
  • matplotlib
  • seaborn

You can install them using: bash pip install pandas scikit-learn matplotlib seaborn

Steps

  1. Load the Dataset:

    • Load the financial anomaly dataset using Pandas.
  2. Check and Impute Missing Values:

    • Check for missing values in the dataset.
    • Impute missing values using the mean strategy.
  3. Normalize Data:

    • Standardize data by normalizing if needed.
  4. Train Isolation Forest Model:

    • Use the Isolation Forest algorithm to detect potential fraudulent transactions.
  5. Identify Potential Fraudulent Transactions:

    • Predict and identify potential fraudulent transactions.
    • Example feature engineering: Extract the hour from the timestamp.
  6. Visualize Anomaly Scores:

    • Create scatter plots, histograms, box plots, and violin plots to visualize anomaly scores and potential fraudulent transactions.
  7. Evaluate Model Performance:

    • Split the data into training and testing sets.
    • Train the model on the training set and evaluate its performance on the test set.
  8. Pair Plot of Relevant Variables:

    • Create a pair plot to visualize the relationships between variables, including anomaly scores.

How to Run

Clone the repository and run the Python script. Make sure to have the required libraries installed.

Feel free to customize the script or extend it based on your specific requirements.