Probabilistic Triage Model for Disputed Order Claims
Machine LearningModel answerLast updated
Design a calibrated probabilistic model that scores dispute cases for fraud despite informative missing data, shifting base rates, and cost-sensitive routing decisions.
Context
An online marketplace has a trust and safety group that handles buyer-filed dispute cases. Each case is either a fraudulent claim (Y = 1) or a genuine one (Y = 0). Only a small share of cases ever get a human review, so labels are scarce. Each case carries evidence from three sources: free text, structured transaction fields, and buyer and seller history.
You must build a model that outputs the probability P(Y = 1 | X) for every new case. That probability directly drives two actions: cases above one threshold go to senior investigators, and cases below a much lower threshold are resolved automatically. Wrong decisions in either direction have different costs, so the numbers must behave like real probabilities, not just a ranking.
Complications
- Missingness carries information. Many fields are absent, and the absence is not random. Genuine one-time buyers often have no history. Accounts that repeatedly commit fraud tend to hide particular fields on purpose.
- The base rate moves. The weekly fraud rate swings between roughly 1% and 12% because of promotions and coordinated attack waves.
- Calibration is a hard requirement. Downstream thresholds are set in probability units.
What to cover
- Model family. Decide between a generative approach (naive Bayes, a Bayesian graphical model) and a discriminative model with Bayesian priors over its parameters (Bayesian logistic regression, Bayesian neural network). Justify the choice given the mixed feature types.
- Missingness. Give a mathematical treatment that uses the missingness pattern as evidence, without dropping incomplete cases and without assuming data are missing completely at random.
- Changing base rate. Explain how to track the fraud prior in near real time without refitting the part of the model that describes
P(X | Y). - Evaluation and calibration. Lay out a validation protocol covering ranking quality (for example PR-AUC) and calibration (for example expected calibration error and reliability diagrams), and describe how you would detect and repair calibration drift in production.
Hints
Hint 1
Write the posterior in log-odds form: prior log-odds plus a log-likelihood ratio. Ask which piece changes weekly and which should stay stable.
Hint 2
You do not need to model why data are missing. Model the joint of the observed values and the missingness indicators, and let the indicator pattern be a feature or a mixture component.
Hint 3
Under label shift, the prior update is an additive logit offset. Think about how to estimate the new prior when reviewed cases were chosen by the model itself (selection bias).
Hint 4
With a 1 to 12 percent base rate, equal-width calibration bins are nearly useless. Also consider the order of operations: recalibrate first, then apply the prior shift.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Core idea
Keep the posterior separable: a slowly changing evidence term and a fast-moving prior term.
$$ \text{logit},P(Y=1\mid X) = \log\frac{\pi}{1-\pi} + \log\frac{p(X\mid Y=1)}{p(X\mid Y=0)} $$
The second term is the log-likelihood ratio, written $\ell(X)$. The design goal is to learn $\ell$ once and move only $\pi$ as the weekly fraud rate changes.
1. Model family
Choice: a discriminative model with Bayesian parameter priors, for example Bayesian logistic regression on top of text embeddings, tabular features and history features, or a small deep ensemble as an approximation.
Why not naive Bayes:
- Mixed modalities. Embeddings, counts and categoricals would each need a class-conditional density, and mis-specifying any of them hurts.
- Correlated features. Order count and account age are strongly related. Naive Bayes multiplies their evidence and becomes overconfident, which directly breaks calibration.
- Uncertainty. Priors on weights (Gaussian, or hierarchical per feature group) regularize sparse inputs and give posterior uncertainty, useful for sending ambiguous cases to humans.
You keep the generative convenience because a model trained at prior $\pi_{train}$ with output $f(X)$ yields
$$ \hat\ell(X) = \text{logit},f(X) - \text{logit},\pi_{train} $$
2. Informative missingness
Let $M_j=1$ if feature $j$ is missing. For prediction you only need $P(Y\mid X_{obs}, M)$, which is identifiable from observed data, so there is no need to model the MNAR mechanism or impute. Use a pattern-mixture factorization:
$$ p(X_{obs},M\mid Y) = P(M\mid Y),p(X_{obs}\mid M,Y) $$
so
$$ \ell = \underbrace{\log\frac{P(M\mid Y=1)}{P(M\mid Y=0)}}{\text{evidence from missingness}} + \log\frac{p(X{obs}\mid M,Y=1)}{p(X_{obs}\mid M,Y=0)} $$
Per feature in a generative view: $p(x_j,m_j\mid y)=\rho_{jy}^{m_j},[(1-\rho_{jy})p(x_j\mid y)]^{1-m_j}$ with $\rho_{jy}=P(M_j=1\mid Y=y)$.
Discriminative implementation:
- Input $\tilde x_j=(1-m_j)x_j+m_j c_j$ (a fill constant) plus the indicator $m_j$.
- Add block-level indicators ("whole history block missing") and interactions $m_j\times$ group features so each pattern gets its own effect.
- Serving caveat: missingness must mean the same thing in training and production. A pipeline outage that nulls a field would be read as a fraud or legitimacy signal. Monitor per-field missing rates and alert on jumps.
3. Tracking the prior without retraining
Assume label shift: $p(X\mid Y)$ is stable and only $\pi_t$ moves. Then
$$ \text{logit},P_t(Y=1\mid X)=\text{logit},f(X)+\text{logit},\pi_t-\text{logit},\pi_{train} $$
This is O(1) per case.
Estimating $\pi_t$:
- Labeled stream: a Beta posterior with forgetting factor $\lambda$: $\alpha_t=\lambda\alpha_{t-1}+k_t$, $\beta_t=\lambda\beta_{t-1}+(n_t-k_t)$, $\hat\pi_t=\alpha_t/(\alpha_t+\beta_t)$. A smaller $\lambda$ reacts faster to swings but is noisier (effective window about $1/(1-\lambda)$ periods).
- Selection bias: reviewed cases were picked by the model and over-represent fraud. Use a small uniform random audit slice (1 to 2% of traffic) or inverse-propensity weights.
- Unlabeled stream: EM for label shift (Saerens et al.). Reweight posteriors with the current $\hat\pi$, set $\hat\pi$ to the mean adjusted posterior, and iterate to convergence.
Limit: a coordinated campaign with new fraud patterns changes $p(X\mid Y=1)$ itself (concept shift). A prior offset cannot fix that. Detect it with per-feature drift measures (PSI) and with calibration error that persists after the prior adjustment, then retrain.
4. Validation and calibration
Splits: time-based only. Random splits leak campaign signatures from the future.
Ranking quality:
- PR-AUC, always reported beside prevalence (a random model scores the base rate). Compare weeks through lift over prevalence.
- Recall at the precision the investigator queue needs, and the false-negative rate inside the auto-resolve band.
Calibration:
- ECE $=\sum_b \frac{|B_b|}{n}|\bar y_b-\bar p_b|$ with equal-mass bins, since fixed-width bins pile almost everything into the first bin at a 1 to 12% base rate.
- Reliability diagrams zoomed to 0 to 0.3 with bootstrap intervals per bin.
- Brier score and log loss as proper scoring rules.
- Slice by prior regime (low versus high fraud weeks) and by missingness pattern, since miscalibration hides in rare patterns.
Decision rule: with calibrated $p$, send to an investigator when $p > C_{FP}/(C_{FP}+C_{FN})$; use a separate, lower threshold for auto-resolve.
Fixing drift in production (order matters):
- Fit the calibrator (Platt, beta calibration or isotonic) on a recent held-out window at the training prior.
- Apply the prior offset after calibration.
- Track rolling ECE on matured audit labels:
- uniform log-odds shift: update $\pi_t$;
- slope error (over or under confidence): refit the calibrator;
- both persist: retrain.
Common mistakes
- Imputing missing values and discarding the missingness indicators, which throws away signal.
- Estimating the prior from model-selected reviewed cases without correction.
- Applying the prior shift before calibration, which double counts the shift.
- Using fixed-width ECE bins and random train/test splits.
- Reporting only AUC and treating scores as probabilities.