Inspiration

Online shopping has grown rapidly, but so has e-commerce fraud. Every year, billions are lost due to fraudulent transactions, impacting both customers and businesses. I and my team wanted to explore how machine learning could help tackle this real-world problem by predicting and preventing such frauds in real-time. As we passionate about AI and data science, this project allowed me to connect the theory I've learned with something practical, useful, and socially impactful.

What it does

This web app consists of the transaction form, the stakeholders need to input the necessary for example: 1) Transaction Amount 2)Customer age 3)Source 4)Browser 5)Account Age 6)Transaction hour 7)sex ( Male or Female) 8)Payment method 9)Product category 10) quantity 11)Device used 12)Address match these are the columns in the dataset. It is the labeled dataset according to the correct inputs the corresponding results will be given along with the confidence of the prediction and risk scores of it. XAI LIME integration is resulted in the form of the graph indicating the explanation of the frauds and safe features of the inputs. We have a dashboard feature where the the new inputs used for predictions are stored in the mysql database, the stored data are inherited from the the database to provide dashboard insights in the frontend. we used four charts to explain the visualization insights a bar chart, pie chart, donut chart, line chart.

How we built it

Frontend: HTML, CSS, JavaScript — used for the home page, transaction form, result page, and dashboard. Backend: Python with Flask API to handle form submissions and model predictions. Database: MySQL for storing transaction records. Machine Learning Model: Trained using XGBoost and Random Forest, with a focus on interpretability. Explainable AI: Integrated LIME to provide clear insights into why a transaction was flagged as fraud or safe. Dataset was taken from kaggle and filtered according to our model.

Challenges we ran into

• Connecting MySQL with Flask and debugging connection errors

• Ensuring the ML model handled decimal inputs gracefully

• Making the frontend visually appealing while still being informative

• Managing project structure and keeping code modular and secure

Accomplishments that we're proud of

We successfully built and deployed a complete end-to-end fraud detection system that analyzes e-commerce transactions and predicts the likelihood of fraud in real-time. The machine learning model achieved an accuracy of 96%, meaning it correctly classified 96 out of every 100 transactions.

In addition, it reached a precision of 0.83, which indicates that 83% of the transactions flagged as fraudulent were actually frauds. The recall score was 0.625, showing that the model was able to detect about 63% of all actual fraud cases. With an F1 score of 0.71, the model maintains a reasonable balance between precision and recall, which is important in real-world fraud detection where both false positives and false negatives have consequences.

Beyond model performance, we integrated LIME to make the predictions explainable, improving transparency and helping users understand why a transaction was marked as fraudulent or safe. The project also includes a dynamic dashboard to visualize transaction data and fraud patterns

What we learned

• How to build a full-stack ML web application from scratch

• How to securely manage credentials using .env files

• Hands-on experience with model deployment

• Creating visual explanations using LIME

• Using Git & GitHub for version control and collaboration

• Presenting data clearly using interactive charts

Share this project:

Updates

Submission history