Computing Library › Worked Examples
Worked Examples

Training a Tiny Disruption Classifier

Build a small logistic classifier that flags impending plasma disruptions from a few diagnostic features - a scaled-down version of a real fusion control task.

The task

Tokamak plasmas can disrupt - suddenly lose confinement - and controllers benefit from early warning. Framed as supervised learning, the input is a vector of diagnostic signals (density, current, mode amplitude proxies) and the output is a probability that a disruption is imminent. We build a minimal logistic classifier on synthetic data to show the pipeline.

Data and model

Kronos motion — training from sim

Generate two clusters: stable shots and pre-disruptive shots, each with a few features. A logistic model p = sigma(w . x + b) outputs the disruption probability; we train it by minimizing binary cross-entropy with gradient descent.

python
import numpy as np
rng=np.random.default_rng(0)
n=400
stable=rng.normal([0,0],0.6,(n,2)); pre=rng.normal([2,2],0.6,(n,2))
X=np.vstack([stable,pre]); y=np.r_[np.zeros(n),np.ones(n)]
w=np.zeros(2); b=0.0; lr=0.1
sig=lambda z:1/(1+np.exp(-z))
for it in range(2000):
    p=sig(X@w+b); g=p-y
    w-=lr*(X.T@g)/len(y); b-=lr*g.mean()
acc=((sig(X@w+b)>0.5)==y).mean()
print('accuracy:',round(acc,3))  # ~0.98

Evaluating honestly

Accuracy alone misleads when disruptions are rare. What matters operationally is the trade-off between true alarms and false alarms, summarized by the ROC curve, and the warning time before the event. A model that fires too late or too often is useless even at high accuracy. Always evaluate on held-out shots the model never trained on.

From toy to real

Production disruption predictors use richer feature engineering or deep networks on raw diagnostic time series, cross-machine validation, and calibrated probabilities so a controller can act on a threshold. The logistic core here is the honest starting point: understand the features and the error trade-offs before adding model complexity. Machines like the Hyperion breeder design exist as simulations today, so such classifiers are trained on modeled and archival data, not live hardware.