as

Projects / research

research

Concept drift and adaptive retraining, on synthetic fraud data.

Why

A model trained on last month’s fraud can look fine on last month’s holdout and be wrong on this week. I wanted the retrain to be a candidate that runs next to the model that is serving, and only then a comparison. Swapping on a training score skips that.

Diagrams

A solid outline is the path in the repo. A dashed outline is the alternative that shape is refusing.

The datasets are synthetic: banking, ecommerce, crypto, insurance. The pipeline retrains, shadow-deploys the candidate, and compares families. ks_gaps.py is a two-sample KS distance on two numeric columns.

flowchart TD
  data["Synthetic fraud sets"]
  train["Incremental retrain"]
  shadow["Shadow deploy"]
  shoot["Family shootout"]
  ks["ks_gaps.py"]
  data --> train --> shadow --> shoot
  data --> ks
  class data,train,shadow,shoot,ks chosen
          

The candidate sees the slice and does not take the decision. Swapping it in because the training score moved skips that. A KS gap is a hint that a feature moved. It is not a gate.

flowchart TD
  q{A retrained model}
  q -->|"it scores the slice and does not decide"| shadow["Shadow deploy"]
  q -->|"swap on the training score"| swap["Replace what is serving"]
  class shadow chosen
  class swap rejected
          

Why this shape

The datasets are synthetic: banking, ecommerce, crypto, insurance. The pipeline retrains incrementally, shadow-deploys the candidate, and compares model families in a shootout. Shadow means the candidate sees the slice and does not take the decision. ks_gaps.py is the small check next to that: a two-sample KS distance between two numeric columns, so you can see a feature move before you blame the model.

Where it breaks

Synthetic drift is drift I planted. A shootout that wins here has not seen a real ledger. And a KS gap on one column can fire while the decision boundary is fine, or stay quiet while the boundary moves. It is a hint, not a gate.