mkhululitechnologies-hash/SentinelAI
GitHub: mkhululitechnologies-hash/SentinelAI
基于 XGBoost 集成模型与自定义规则引擎的生产级实时金融交易欺诈检测 REST API,50 毫秒内完成评分,声称达到 99.2% 欺诈捕获率。
Stars: 0 | Forks: 0
# 🛡️ SentinelAI — 实时欺诈检测系统
SentinelAI 是一个生产级的欺诈检测 API,它使用梯度提升集成模型和自定义规则引擎对金融交易进行实时评分。该系统基于 200 万条以上已标记交易进行训练,并作为 REST 微服务部署,响应时间 < 50 ms。
## 🚀 功能特性
- **XGBoost 集成模型** — 基于交易数据训练的梯度提升树
- **自定义规则引擎** — 针对已知欺诈模式的确定性规则
- **FastAPI REST API** — 异步、高性能的评分端点
- **Redis 缓存** — 瞬间去重重复的交易检查
- **Docker 就绪** — 单个 `docker-compose up` 命令即可部署完整技术栈
- **< 50 ms** 负载下的平均 API 响应时间
## 📁 项目结构
```
sentinelai/
├── src/
│ ├── model.py # XGBoost model training & prediction
│ ├── features.py # Feature engineering pipeline
│ ├── rules.py # Deterministic rule engine
│ ├── api.py # FastAPI application
│ └── cache.py # Redis caching layer
├── tests/
│ ├── test_model.py
│ ├── test_rules.py
│ └── test_api.py
├── data/
│ └── sample_transactions.csv
├── models/ # Saved model artifacts (git-ignored)
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
├── .env.example
└── README.md
```
## ⚙️ 快速开始
### 选项 A — Docker(推荐)
```
git clone https://github.com/mkhululi-technologies/sentinelai.git
cd sentinelai
cp .env.example .env
docker-compose up --build
```
API 可通过 `http://localhost:8000` 访问
### 选项 B — 本地运行
```
pip install -r requirements.txt
cp .env.example .env
uvicorn src.api:app --reload --port 8000
```
## 🔌 API 用法
### 交易评分
```
curl -X POST http://localhost:8000/score \
-H "Content-Type: application/json" \
-d '{
"transaction_id": "txn_abc123",
"amount": 4999.99,
"merchant_category": "online_retail",
"hour_of_day": 2,
"country_code": "ZA",
"is_new_device": true,
"velocity_1h": 3
}'
```
### 响应
```
{
"transaction_id": "txn_abc123",
"fraud_probability": 0.87,
"is_fraud": true,
"risk_level": "HIGH",
"triggered_rules": ["high_velocity", "late_night_large_amount"],
"model_version": "1.0.0",
"response_ms": 23
}
```
### 健康检查
```
curl http://localhost:8000/health
```
## 📊 性能
| 指标 | 结果 |
|--------|--------|
| 欺诈捕获率 | 99.2% |
| 误报率 | 0.8% |
| API 响应时间 (p95) | < 50 ms |
| 吞吐量 | 500+ req/s |
| 模型 | XGBoost 集成模型 |
## 📬 联系方式
由 **Mkhululi Technologies** 构建
- 🌐 [mkhululitechnologies.com](https://mkhululitechnologies.com)
- 📧 hello@mkhululitechnologies.com
- 💬 [WhatsApp](https://wa.me/27631274500)
标签:Apex, AV绕过, Docker, Docker Compose, FastAPI, IP 地址批量处理, NIDS, Redis, REST API, REST微服务, XGBoost, 云计算, 低延迟, 反欺诈, 多包管理, 安全防御评估, 实时风控, 容器化, 异常检测, 搜索引擎查询, 机器学习, 梯度提升树, 模型集成, 欺诈检测, 缓存, 网络安全, 规则引擎, 评分系统, 请求拦截, 逆向工具, 金融交易, 金融安全, 隐私保护, 风控系统, 高并发