Data and AI

Player Churn Prediction

A C++ TCP server aggregates player telemetry into per-session features, an XGBoost model scores churn risk, and a scorer posts a webhook with a suggested action for each player above 0.7. The model reached 0.9121 AUC on held-out data, and a live socket run flagged 2 of 24 sessions.

Stack
C++17, Python, XGBoost, POSIX sockets
Code
github.com/ADM1SH/churn-prediction-scaling

Overview

Install

Requires g++ (C++17) and the shared venv ../.venv10projects (numpy, pandas, scikit-learn, xgboost already installed).

One command, correct order baked in:

./run_demo.sh

Or step by step (from this directory):

PY=../.venv10projects/bin/python

# 1. build the server
g++ -O2 -std=c++17 -pthread server/telemetry_server.cpp -o server/telemetry_server

# 2. train the model (synthetic batch -> XGBoost -> models/churn_model.json)
$PY ml/synthetic_data.py
$PY ml/train_model.py

# 3. start the mock webhook receiver (separate terminal / background)
$PY webhook/receiver.py 8090 &

# 4. start the telemetry server (separate terminal / background)
./server/telemetry_server 9000 data/telemetry_log.csv &

# 5. run the event generator (feeds the live server over a real socket)
$PY client/generator.py 127.0.0.1 9000

# 6. score the captured telemetry log and fire webhooks for at-risk players
$PY ml/churn_scorer.py data/telemetry_log.csv http://127.0.0.1:8090/webhook 0.7

Docs

The full documentation covers how it works, configuration and results.