Sign inSign up

jaybee123/xente-fraud-api

By jaybee123

•Updated 4 months ago

Machine Learning REST API for detecting fraudulent financial transactions in real-time.

Image
Security
Machine learning & AI
Data science
0

348

jaybee123/xente-fraud-api repository overview


⁠Enterprise Real-Time Fraud Detection API (Xente/Fintech)

⁠Overview

This image provides a production-ready, containerized Machine Learning REST API for detecting fraudulent financial transactions in real-time.

Built using FastAPI and an optimized XGBoost model trained on the Xente Fintech dataset (Mobile Money/E-commerce), this microservice evaluates incoming transaction payloads, applies custom Scikit-Learn behavioral feature engineering, and returns a probability score and fraud classification in milliseconds.

The underlying model was specifically engineered to handle high-cardinality categorical data and extreme class imbalance (AUPRC: 0.842, False Positive Rate: 0.094%), ensuring high recall with minimal friction to legitimate customers.

ā šŸ› ļø Tech Stack Inside the Container

  • Serving Layer: FastAPI, Uvicorn, Pydantic (Strict Schema Validation)
  • Machine Learning: XGBoost (v2.0+), Scikit-Learn (Custom Pipelines)
  • MLOps: MLflow (Model unpickling, Signature enforcement)
  • Base Image: python:3.10-slim

ā šŸš€ Quick Start

1. Pull the image:

docker pull jaybee123/xente-fraud-api:latest

2. Run the container:

docker run -d --name fraud-api -p 8000:8000 jaybee123/xente-fraud-api:latest

3. Access the API: Once running, the interactive Swagger UI documentation is automatically available at: šŸ‘‰ http://localhost:8000/docs⁠

ā šŸ“” API Usage & Endpoints

⁠GET /test

A built-in testing endpoint that runs a dummy transaction through the loaded MLflow model to verify inference integrity.

⁠POST /predict

The primary inference endpoint. It expects a JSON payload containing the raw transaction parameters. The internal Scikit-Learn transformer automatically extracts temporal and behavioral velocity features on the fly.

Example cURL Request:

curl -X 'POST' \
  'http://localhost:8000/predict' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "TransactionId": "TransactionId_51888",
  "CustomerId": "CustomerId_1",
  "ProviderId": "ProviderId_4",
  "ProductId": "ProductId_10",
  "ProductCategory": "airtime",
  "ChannelId": "ChannelId_2",
  "Amount": -10000.0,
  "Value": 10000.0,
  "TransactionStartTime": "2018-11-21T16:49:14Z",
  "PricingStrategy": 4
}'

Example JSON Response:

{
  "transaction_id": "TransactionId_51888",
  "Product_Category": "airtime",
  "fraudResult": false,
  "fraud_probability": 0.00004561
}

ā āš™ļø Configuration

The container exposes port 8000 by default. It natively contains the compiled MLflow model artifacts and the custom Scikit-Learn transformer class required for deserialization.

ā šŸ”— Source Code & Documentation

This container is built and pushed automatically via GitHub Actions CI/CD pipelines. For the complete MLOps architecture, exploratory data analysis, and model training scripts, please visit the source repository:

Tag summary

Content type

Image

Digest

sha256:63260fd3e…

Size

864.3 MB

Last updated

4 months ago

docker pull jaybee123/xente-fraud-api