psfc/rr-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · psfc/rr-19-6...

16
PSFC/RR-19-6 Confinement regime identification on Alcator C-Mod using supervised machine learning methods A. Mathews, J.W. Hughes, A.E. Hubbard, D.G. Whyte, S.M. Wolfe, T. Golfinopoulos, D. Brunner, R.S. Granetz, C. Rea, A.E. White, Alcator C-Mod Team April 2019 Plasma Science and Fusion Center Massachusetts Institute of Technology Cambridge MA 02139 USA This work was supported by the U.S. Department of Energy (DOE) Office of Science Fusion Energy Sciences program under contracts DE-FC02-99ER54512, DE-SC0014264, and the Joseph P. Kearney Fellowship. Reproduction, translation, publication, use and disposal, in whole or in part, by or for the United States government is permitted.

Upload: others

Post on 24-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

PSFC/RR-19-6

Confinement regime identification on Alcator C-Mod using supervised machine learning methods

A. Mathews, J.W. Hughes, A.E. Hubbard, D.G. Whyte, S.M. Wolfe,T. Golfinopoulos, D. Brunner, R.S. Granetz, C. Rea,

A.E. White, Alcator C-Mod Team

April 2019

Plasma Science and Fusion Center Massachusetts Institute of Technology

Cambridge MA 02139 USA

This work was supported by the U.S. Department of Energy (DOE) Office of Science Fusion Energy Sciences program under contracts DE-FC02-99ER54512, DE-SC0014264, and the Joseph P. Kearney Fellowship. Reproduction, translation, publication, use and disposal, in whole or in part, by or for the United States government is permitted.

Page 2: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

PSFC Report: PSFC/RR-19-6

CONFINEMENT REGIME IDENTIFICATION ON ALCATOR C-MOD USING SUPERVISED MACHINE

LEARNING METHODS

A. Mathews, J.W. Hughes, A.E. Hubbard, D.G. Whyte, S.M. Wolfe, T. Golfinopoulos D. Brunner, R.S.

Granetz, C. Rea, A. E. White, and the Alcator C-Mod Team

Plasma Science and Fusion Center, Massachusetts Institute of Technology, 77 Massachusetts Avenue, Cambridge, MA 02139, US

ABSTRACT

Automating confinement regime identification could provide enhanced capability for controlling toka-

maks to optimize power output. Distinguishing features between fusion plasma confinement regimes

are explored via machine learning methods to analyze experimental data from the compact, high-field

Alcator C-Mod tokamak. Four supervised machine learning techniques (Gaussian naıve Bayes, logistic

regression, multilayer perceptron, and random forest) are employed to identify accessibility conditions

for a confinement database with over 200 distinct plasma discharges consisting of approximately 400

L-, 200 H-, and 100 I-mode periods. These algorithms each demonstrate overall identification accu-

racy exceeding 90%, and can be employed concurrently during operation and establish boundaries

in confinement regimes based on past runs while providing areas for focused exploration to further

understand transition physics.

1. INTRODUCTION

Accessing high confinement plasmas is key to optimizing

energy gain, which is an essential component in devel-

oping economical nuclear fusion reactors. The discovery

of H-modes [26] significantly improved energy confine-

ment across a range of fusion devices and led to numer-

ous studies of factors for H-mode access such as plasma

shaping, toroidal field, particle density, divertor geome-

try, and wall materials [8, 11, 12, 20, 22]. Future burn-

ing plasma devices are largely relying on achieving this

higher confinement, but reduced performance from im-

purity accumulation due to increased overall particle con-

finement and the possibility of damaging edge localized

modes (ELMs) are causes for worry. ELM-suppressed

high confinement regimes such as I-mode [27] offer a

viable alternative scenario to H-mode in burning plas-

mas. I-modes are robustly observed at higher magnetic

field strength, which presently operating tokamaks rarely

achieve, yet could be crucial to sustainable and econom-

ical reactor operation [24]. Therefore, there is a need

to improve understanding of transition physics for the

scoping of confinement to future fusion devices.

Machine learning is being widely applied in nuclear fusion

on several topics including disruption prediction, opti-

mizing integrated modelling, and L-H transition physics

[1, 2, 13, 14, 21, 25]. With extensive data available on fu-

sion machines spanning several campaigns, delving into

robust techniques to study intricate and/or poorly un-

derstood mechanisms provides a useful additional tool

to further compare and validate existing models. One

Page 3: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

2 A. Mathews

crucial element to remember when applying supervised

models is that utility of their outputs is limited by the

quality of inputs. The machine learning methods utilized

in this report are general and previously deployed in a

plethora of applications ranging from medical research

to image recognition to text identification [10, 16, 28].

Their apparent robustness in various settings serves as

a motivation to assess their accuracy in identifying con-

finement regimes in fusion plasmas. A goal of this work

is to derive a probabilistic model whereby a real-time

automated plasma control system can gain knowledge of

the likelihood of entering (or staying) in a particular con-

finement mode. Learning optimal accessibility conditions

for I-modes, for example, could help tokamaks access this

regime’s favourable properties.

2. METHODS

2.1. Confinement Regime Database

Different confinement regimes exhibit distinct properties.

The evolution of density and temperature pedestals in

the plasma edge region near the last closed flux surface

is used to classify plasma behaviour. These boundaries

can be blurred as transition regions are approached and

parameters (e.g. input heating power) are varied on a

continuum. Thus definitions of labels are critical when

applying supervised learning techniques. These are data-

driven methods and performance is limited by the con-

sistency of given data. Characterizations of L-, H-, and

I-modes are thus provided below as the applied defini-

tions in this study and akin to [27]:

H-mode: formation of both a strong edge ne and Te

pedestal along with reduction in broadband edge fluc-

tuations (. 100 kHz).

I-mode: formation of a strong edge Te pedestal with-

out significant change in ne, and appearance of high fre-

quency edge fluctuations (& 100 kHz).

L-modes are a third regime typically exhibiting relatively

weak edge pressure gradients and defined as not being H-

or I-modes, including discharge periods without auxiliary

power classically considered ohmic. Other signals such as

sharp changes in Dα and radiated power are also helpful

in diagnosing transitions but not necessary markers. A

plasma was considered to be present in Alcator C-Mod

and possibly included in the database if its plasma cur-

rent was exceeding 100 kA. Transition periods are typi-

cally events with finite durations that can vary on the or-

der of milliseconds. In the database, a constant time in-

terval (i.e. a single millisecond) was used to separate each

sample of data to classify the bifurcation, although the

observed characteristics around transition regions can be

relatively smeared and intermediate to either mode.

A database was initially developed by manually identi-

fying signals as either L-, H-, or I-mode and their associ-

ated (forward and backward) transitions. I-modes were

almost exclusively verified using an existing database de-

veloped by A.E. Hubbard and D.G. Whyte, while L- and

H-modes were obtained from a variety of sources using

the logbook primarily. It should be noted that misclas-

sifications of L-, H-, and I-mode are penalized equally,

yet the database is imbalanced as it currently consists

of manual shot selections with a frequency of particular

modes not necessarily representative of all shots histor-

ically. The true ratio of regime durations during oper-

ation is not known with exactness, but is expected to

be dominated by L-mode plasmas. The database de-

veloped and analyzed here consists of over 200 shots

with the periods spanning L-, H-, and I-modes com-

posing approximately 80%, 10%, and 10%, respectively.

Included are discharges from 1995 to 2016 on Alcator

C-Mod. The below results are based on predominantly

D-D plasmas with typically trace amounts of minority

and impurity species present. The database spans a

Page 4: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

Confinement Regime Identification on C-Mod 3

fairly vast space where volume-averaged density ranged

from 4 × 1019 − 5 × 1020 m−3, toroidal magnetic field

from 3 − 8 T, plasma current up to 1.5 MA, auxiliary

power reaching nearly 6 MW, and shots consisting of

lower single null, upper single null, and double null X-

point configurations running the ion ~∇B drift in both the

favourable and unfavourable directions. There are over

40 readily available measurements including quantities

derived from equilibrium fits to the 2-dimensional ideal

magnetohydrodynamics (Grad-Shafranov) equation, us-

ing the EFIT code. A full list of variables available in

the database with a corresponding brief description is

provided in the Appendix.

Figure 1 : Correlation of selected features to indicate

possible redundancy. Shot number is also incorporated

for reference.

The confinement database consists of 0-D data that

does not account for measurement errors nor causal ef-

fects in time. Codes were created to automatically run

magnetics-based EFIT and populate the table with rel-

evant quantities from MDSplus, and these data were

obtained using a sampling rate of 1 millisecond on a

129 × 129 grid (based on a custom version generously

created by S. Wolfe). The goal is to ensure this method

can be validated, so training our classifiers with routinely

available measurements will assist in its repeatability

across experiments. The variables used are not exhaus-

tive but comprise a significant number of experimentally-

relevant quantities. The inputs provided to the classifiers

are selected to avoid high cross-correlation. For example,

the Shafranov shift is a relatively good input variable,

but radial displacement of flux surfaces is highly corre-

lated with fundamental features such as plasma pressure

which may be considered instead.

2.2. Machine Learning Algorithms

The current supervised methods applied from the Python

package scikit-learn are: Gaussian naıve Bayes, logistic

regression, random forests, and a class of feedforward

neural networks known as a multilayer perceptron [18].

These are trained for the classification problem of deter-

mining the class, K (which may be L, H, or I).

Gaussian naıve Bayes is a conditional probability model

based on Bayes’ theorem which states:

posterior=prior×likelihood

evidence⇔ p(K |x) = p(K)p(x|K)

p(x)

Two major assumptions are inherent to this specific clas-

sifier. The first is that each of the features (xi) are nor-

mally distributed within each confinement regime:

p(xi|K) =1

2πσ2K

exp[− (xi − µK)2

2σ2K

] (1)

The second is a naıve yet computationally expedient as-

sumption of independence:

p(K |x1, . . . , xn) ∝ p(K)p(x1 |K) · · · p(xn |K) (2)

Finally, the decision rule is based on selecting the class

that maximizes the posterior probability:

y = argmaxK∈{L,H,I}

p(K)

n∏i=1

p(xi | K) (3)

Page 5: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

4 A. Mathews

Figure 2 : Observed distribution of βp in the entire

database based upon confinement regime identification.

It should be noted these assumptions are not necessarily

valid since, for example, βp is dependent on ne. Simi-

larly, the input features are not necessarily normally dis-

tributed. The degree to which these assumptions are

violated appears to worsen the output of this classifier

and constrain suitable inputs.

A binary (i.e. yn,K equals 0 or 1) logistic regression

model is trained by applying a ‘one vs. rest’ approach

(i.e. H-mode vs. not H-mode) which essentially reduces

the number of comparisons from NK(NK − 1)/2 to NK ,

where NK is the number of classes and equals 3 in

the present case of L-, H-, and I-modes. A ‘one vs.

one’ approach (i.e. H-mode vs. I-mode which is na-

tively handled by multinomial logistic regression) dif-

fers since it compares all classes individually to one an-

other as opposed to simply comparing versus the null

case. For NK = 3, the two approaches are equivalent

in their number of evaluations, although quickly diverge

if NK 6= 3 and further confinement modes are employed

(e.g. EDA H-mode, ohmic plasma). The probability of

the nth sample input feature vector, xn, belonging to

a particular class, K, is given by the logistic function,

pn,K(yn,K = 1|xn) = 11+e−βK ·xn , where βK is a set of

weights and bias terms optimized by minimizing a cost

function comprising logistic loss (i.e. cross-entropy) and

Tikhononv regularization:

− 1

N

N∑n=1

[yn,K log pn,K + (1− yn,K) log(1− pn,K)

]+λ‖βK‖22

(4)

The linear predictor here is linked to the response vari-

able by a logit function, βK · xn = logit(pn,K) =

ln(

pn,K1−pn,K

). This is similar to other generalized linear

models such as the probit link function where βK · xn =

Φ−1(pn,K), and Φ is the normal cumulative distribution

function. Outlining the treatments given in [6, 15, 17],

binary choice models can also be understood from their

utility by studying a response, yn,K , to a latent variable,

Un,K = βK ·xn−en, where βK is a set of regression coeffi-

cients, xn is a sample feature vector, and en is a random

variable specifying “noise” or “error” in the response,

assumed to be distributed according to some symmetric

distribution (e.g. logistic, normal) centered at 0, such

that

yn,K =

1, if Un,K > 0

0, if Un,K ≤ 0(5)

Now we can denote the cumulative distribution function

(CDF) of en as Fe, and the quantile function (inverse

CDF) of en as F−1e . Note that

Pr(yn,K = 1) = Pr(Un,K > 0) (6)

= Pr(βK · xn − en > 0) (7)

= Pr(−en > −βK · xn) (8)

= Pr(en ≤ βK · xn) (9)

= Fe(βK · xn) (10)

Since yn,K is a Bernoulli trial, where E[yn,K ] =

Pr(yn,K = 1), we have E[yn,K ] = Fe(βK · xn), or, equiv-

alently, F−1e (E[yn,K ]) = βK · xn

Page 6: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

Confinement Regime Identification on C-Mod 5

If en ∼ Logistic(0, 1), i.e. distributed as a standard logis-

tic distribution with mean 0 and scale parameter 1, then

the corresponding quantile function is the logit function,

and logit(E[yn,K ]) = βK · xn, which is exactly a logit

model:

E[yn,K = 1 | xn] = pn,K = logit−1(βK · xn) =1

1 + e−βK ·xn

(11)

To further outline the statistics involved in this model,

the probability density function of the logistic distribu-

tion is given by:

f(x;µK , sK) =e−( x−µKsK

)

sK

(1 + e

−( x−µKsK))2 =

1

4sKsech2

(x− µK

2sK

)(12)

which has greater peaking and heavier tails (or higher

kurtosis) relative to the normal distribution. The CDF

of the logistic distribution is itself in the family of logis-

tic functions, which can be represented as a hyperbolic

tangent:

Fe(x;µK , sK) =1

1 + e−( x−µKsK

)=

1

2+

1

2tanh

(x− µK

2sK

)(13)

In these equations, x is the random variable, µK is the

mean, and sK is a scale parameter linearly proportional

to the standard deviation (σK = πsK√3

). Here a general-

ization of the logit function is given by the inverse CDF

of the logistic distribution:

F−1e (pn,K ;µK , sK) = µK + sK ln

(pn,K

1− pn,K

), (14)

F−1e′(pn,K ; sK) =

sKpn,K(1− pn,K)

(15)

The simplicity of the binary logistic regression applied

here assists in interpretation. For example, the odds of

a particular outcome can be defined as

pK(x)

1− pK(x)= eβK ·x (16)

and the odds ratio as

odds(xi + 1)

odds(xi)=eβK,i(xi+1)

eβK,ixi= eβK,i (17)

This physically means the odds of being in class K mul-

tiply by eβK,i for every 1-unit increase in the ith com-

ponent of the feature vector. This assessment does not

hold perfectly because the four features applied are not

wholly independent. Quantitative interpretation of the

parameters as effect measures is further muddled by un-

observed variables that have not been accounted so pre-

cise numerical values may not be exactly representative.

Nevertheless, these coefficients are meaningful within the

confines of the model and quantify general trends.

Random forest [3] is an ensemble algorithm which trains

independent decision trees and aggregates their individ-

ual responses to classify an input. This is accomplished

by the random forest providing a randomly selected

subset with repeated sampling of the original training

database to each of the trees, and only a subset of the

total input features can be used at each node. The deci-

sion trees themselves try to split the sample into different

branches trying to minimize an impurity measure known

as the Gini impurity, IG =∑K

pK(1 − pK), where pK

is the fraction of samples in class K. In the particular

model trained, log2N features are randomly provided for

each node in each tree, where the number of features is

N = 4. Based on runs, a random forest with approxi-

mately 50 fully grown trees was found to be optimal.

Multilayer perceptron is a feedforward artificial neural

network which consists of an input layer with N nodes

for the feature vector, one or more hidden layers, and an

output layer with NK nodes as an output. A deep fully

Page 7: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

6 A. Mathews

connected network with 10×10×10×10 hidden layers

appeared optimal after multiple manual runs. Increas-

ing complexity of the model architecture beyond this

structure did not increase accuracy and actually wors-

ened performance on the testing set despite higher accu-

racy on the training data—a basic demonstration of high

variance resulting in poor generalization to unseen exam-

ples. This applied model utilizes a rectified linear unit

activation function, f(z) = max(0, z), at each neuron,

where z is the combined set of weighted inputs commu-

nicated from the nodes in the preceding layer. The high

degrees of freedom aids in reducing bias, and the univer-

sal approximation theorem states that multilayer feedfor-

ward neural networks with appropriate activation func-

tions and even a single hidden layer with finite neurons

can approximate any continuous function in the feature

space [4, 7], although there are no guarantees on gen-

eralized learning on untrained domains and the network

architecture may be impractically large.

The measured clock times for the trained classifiers to

make a single identification were sub-millisecond (the

only exception was the random forest algorithm). As

will be demonstrated, these methods provide an active

tool to investigate distinct confinement regimes and de-

marcate expected transition boundaries.

2.3. Evaluating Data

Based on the observed distribution of raw data, it is

found that points pertaining to particular regimes tend

to cluster together in certain ranges of parameter space.

This is extremely important when utilizing training data

that is multidimensional and sparse due to lack of data

and limitations in operation space as opposed to physics-

based constraints. Selecting the optimum number and

type of features for the confinement regime identifica-

tion problem is critical. Principle component analysis

was considered but this transformation alters the phys-

ical dimensions of the problem and can cloud interpre-

tation. The four quantities found to be optimal based

upon the mean decrease impurity via the random for-

est algorithm are: dimensionless normalized internal in-

ductance (li), poloidal beta (βp), total volumetric heat-

ing power (Pinput), and volume-averaged electron density

(ne). These quantities compose an input feature vector

x = (x1, . . . , xn) and are defined as [5]:

li =Li

2πR0

µ0=〈B2

θ 〉B2θ (a)

, (18)

βp =〈p〉

Bθ(a)2/2µ0, (19)

Pinput = (Pohm + Paux)/VLCFS , (20)

where Li is the internal inductance, R0 is the major ra-

dius, Bθ is the poloidal magnetic field, Pohm is the ohmic

heating power, Paux is the total ion cyclotron resonance

heating power (without any heating inefficiencies consid-

ered and consists of primarily minority heating), VLCFS

is the volume enclosed by the last closed flux surface,

and Ip is the plasma current. The ohmic heating power

is calculated by finding the resistive voltage and multi-

plying it by the total current: Pohm = (Vloop −Li dIpdt )Ip.

The line-integrated plasma electron density is measured

by a two-color interferometer along ten vertical chords,

and this is used to construct ne.

Page 8: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

Confinement Regime Identification on C-Mod 7

Figure 3 : Relative feature importance based on mean

decrease impurity via random forest.

1. βp (0.383± 0.075)

2. ne (0.243± 0.027)

3. Pinput (0.238± 0.075)

4. li (0.139± 0.019)

Normalization of the data was applied consistently dur-

ing preprocessing by subtracting the mean and divid-

ing the standard deviation of each feature before feeding

data to all the classifiers. This step is unnecessary in the-

ory but practically essential for the multilayer perceptron

when updating parameters for numerical purposes.

The four supervised learning techniques are trained on

a sample that consists of 80% of the unique shots in the

database (of which 80% of the time slices are randomly

sorted for training and 20% for validation), and tested on

a set containing the remaining 20% of unique shots. The

validation set contains time slices derived from discharges

included in the training set, while the testing set shares

no shots with the training set. This process is repeated

for 100 cycles, and the mean and standard deviation for

different accuracy metrics are computed based on binary

confusion matrices which can be created for multiclass

problems via the ‘one vs. rest’ approach.

3. RESULTS AND OVERVIEW

For logistic regression, the linear predictors (i.e. product

of coefficient and input feature vectors) were found to be:

βL · x = 2.79 + 0.12ne − 3.25βp + 1.81li − 0.29Pinput

(21)

βH · x = −3.89 + 1.17ne + 2.33βp − 1.72li − 1.18Pinput

(22)

βI · x = −4.53− 2.39ne + 1.68βp − 0.83li + 1.87Pinput

(23)

As expected, there is a bias towards L-mode originat-

ing from the imbalance of modes in the database. Low

values of li indicate a broad current profile, and the

negative coefficients for both H- and I-modes demon-

strates a greater prevalence of broad currents in these

two confinement regimes. Based on the above param-

eters, high βp is associated with both H- and I-modes,

although they have contrasting dependencies on both ne

and Pinput which indicate past accessibility conditions.

When applying normalization by the Greenwald density

(nG[1020m−3] = Ip[MA]/(πa0[m]2)) instead of using ne,

the accuracy of the classifiers reduced, possibly indicat-

ing nG is relatively poorer at distinguishing confinement

regimes. This is consistent with [11] where transition

power threshold was not strongly correlated with nG.

Shot 1160930033 on Alcator C-Mod achieved a record

plasma pressure on any magnetically confined fusion ex-

periment at approximately 2 atmospheres [9], and this is

essential to maximizing the triple product. No shots from

this final run day were included in the entire database,

and provides an unseen test case for the trained algo-

rithms which pushes the boundaries of the training set

itself. The four inputs to the different classifiers are

plotted, which essentially contain all the information the

classifiers utilize to determine the plasma’s mode. This

Page 9: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

8 A. Mathews

(a) ne (b) βp

(c) li (d) Pinput

Figure 4 : Inputs given to the trained classifiers for shot

1160930033 which is an unseen test case.

shot provides a basic extrapolation test case trying to in-

crease the stored energy in a high-field, diverted tokamak

plasma. Based on the quantities in Figure 4 being the

input feature vector for each time slice, the probability

of being in an H-mode was computed using the trained

classifiers. (Probabilities are calibrated to add up to 1

and the I-mode probability remained relatively low dur-

ing the shot, therefore an L-mode can be assumed to be

identified if not an H-mode in Figure 5.) The triple prod-

uct was also calculated for the entire shot to indicate the

quality of confinement. The dark orange shaded region

indicates a manually identified region where a stable en-

hanced Dα (EDA) H-mode appears approximately 15 ms

after auxiliary power is turned on, and this is confirmed

by the electron density and temperature profiles from

core and edge Thomson scattering diagnostics. While

the triple product does not return to its initial L-mode

value immediately after exiting the dark orange shaded

region, which ends approximately when auxiliary power

is turned off, it does degrade. This reduction in confine-

ment coincides with oscillations in the classification prob-

ability as the triple product and edge pedestal are dimin-

ishing yet an ohmic H-mode with current ramping down

is still present in this region in which energy is escap-

ing the core plasma increasingly fast. Variations in the

probability correspond to variations in confinement, and

provide insight into the plasma’s expected behaviour.

Figure 5 : Classification probability of H-mode for shot

1160930033 based on input features given in Figure 4.

Probability contours in the 4-dimensional feature space

can be identified to aid experiments in operation. For

simplicity both li and Pinput are kept constant while plot-

ting, but one may seek a global or local minimum path

to access different modes in the full feature space. The

current method does not impose causal nor operational

bounds for operation (e.g. Greenwald limit, disruption

prediction algorithm), which would be essential during

real-time operation to provide forbidden regions in the

feature space. Nevertheless, boundaries in confinement

regime are produced which indicate possible critical bi-

furcation regions. Computing the optimal path between

the initial and final state can be accomplished by ap-

plying global optimization methods, although local tech-

niques may be preferable from a control standpoint. The

results appear qualitatively similar to plots produced by

D. Brunner, although the boundary regions vary consid-

erably with Pinput, and to a lesser extent with li. Tran-

sitions are also noted to be influenced by factors such as

probe plunges and wall condition, which are not explic-

itly accounted for in the present analysis.

Page 10: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

Confinement Regime Identification on C-Mod 9

Figure 6 : Probability contours determined by each ma-

chine learning method for accessing different confine-

ment regimes on Alcator C-Mod with volumetric heating

power and normalized internal inductance kept constant.

Differences in the relative accuracy of these different

models when applied to separate machines could also

signify underlying distributions and accessibility path-

ways. For example, logistic regression improves in per-

formance when confinement regimes can be partitioned

into single continuous regions (as displayed in Figure 6)

as opposed to multiple fragments with several pockets

of distinct modes, and this provides an analytic bound-

ary. Visual inspection of the neural network probabil-

ity contours in Figure 6 indicates possible over-fitting

based on sharp gradients and isolated pockets. The ran-

dom forest exhibits a similar sharpness. This could be

a consequence of the imperfect data and may warrant

further regularization techniques to reduce the degrees

of freedom these algorithms have when generalizing to

novel scenarios despite fairly good accuracy on Alcator

C-Mod. It should be acknowledged these methods are

largely constrained by the size and quality of available

data in representing scenarios of interest. Final results

comparing the four different classifiers on both validation

and test sets are provided in the Appendix. These involve

averaging over 100 independent runs, and all four clas-

sifiers perform with above 90% total accuracy, although

with some notable differences as exemplified by Tables

2 and 3. Overall accuracy was optimal with the neural

network based on several reported metrics. The devel-

opment of this exploratory tool can now establish a new

transitions database arising from the automatic charac-

terization of time slices from tens of thousands of dis-

charges conducted over the span of decades on Alcator

C-Mod. In particular, there was data readily available

for 30175 shots comprising a total of 2177026 data points

at 20 millisecond intervals which resulted in the following

overall percentages for expected mode prevalence:

Random Forest: 86.6% L, 10.7% H, 2.7% I

Gaussian naıve Bayes: 83.6% L, 11.7% H, 4.7% I

Neural Network: 85.5% L, 10.9% H, 3.6% I

Logistic Regression: 85.9% L, 10.7% H, 3.4% I

Time slices from these shots can be directly assessed

to locate atypical experimental inputs that permit or

prevent specific confinement regimes. For example, a

user can check the signals “ssep” and “btor” (see Ta-

ble 4 in the Appendix) to locate all time slices where

both favourable ion ~∇B drift exists and an I-mode is

expected. Depending on the quantity of interest (e.g.

divertor strike point position, edge ion heat flux), associ-

ations between controlled variables and expected modes

can be systematically studied on a large scale to compre-

hensively document causal factors and improve predic-

tion capabilities.

This work presents an initial approach towards the goal

of L-, H-, and I-mode prediction. The machine learn-

ing methods applied here permit data-driven real-time

guidance for experiments and indicate regions for con-

tinued exploration. For example, by controlling parame-

ters this permits active feedback to help optimally access

Page 11: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

10 A. Mathews

H-mode from L-mode or stay in I-mode while presently

in that regime. Incorporating a regression task going

forward to capture associated relevant values such as

energy confinement time or even pedestal pressure pro-

files directly would augment the current algorithm. This

would provide a quantitative performance measure to

differentiate confinement regimes because two plasmas

in the same mode are themselves not necessarily identi-

cal. Including input features involving time-dependent

and spatial quantities will likely increase accuracy con-

siderably as transition physics is believed to be largely

dictated by edge processes and hysteresis. A systematic

routine automating database development could enable

studies in a wider range of operational space and cross-

validation across machines. Pedestal density and tem-

perature profiles define confinement regimes and regres-

sion techniques could expedite construction of predictive

methods, which will be explored in upcoming work.

4. CONCLUSION

Distinguishing features between fusion plasma confine-

ment modes are explored via machine learning methods

to analyze experimental data from the compact, high-

field Alcator C-Mod tokamak. Supervised learning tech-

niques with zero-dimensional data and time-independent

quantities are employed which increases the transferabil-

ity of this approach for real-time confinement mode iden-

tification across separate fusion devices. Multiclass clas-

sification utilizing Gaussian naıve Bayes, logistic regres-

sion, multilayer perceptron (i.e. feedforward neural net-

works), and random forests performed similarly and ob-

tained an average accuracy above 90% using the plasma’s

normalized internal inductance, poloidal beta, total heat-

ing power (ohmic and ICRH), and volume-averaged den-

sity as inputs. Development of a new training confine-

ment database with over 200 distinct shots consisting

of approximately 400 L-, 200 H-. and 100 I-mode peri-

ods extends upon previous databases and the new clas-

sifiers open pathways to explore large-scale comparative

studies, guided experimentation, and increased control

of confinement regimes in fusion plasmas. Cross-machine

validation is important to understand generalizability in

accessing different plasma behaviour, and further explo-

ration of statistical methods and spatiotemporal data are

expected to improve insights into transition physics.

5. ACKNOWLEDGEMENTS

Supported by the U.S. Department of Energy (DOE) Of-

fice of Science Fusion Energy Sciences program under

contracts DE-FC02-99ER54512, DE-SC0014264, and the

Joseph P. Kearney Fellowship.

REFERENCES

[1] C.M. Bishop et al 1994 NIPS 1007-1014.[2] C. Bourdelle et al 2015 Nucl. Fusion 55 073015.[3] L. Breiman 2001 Machine Learning 45 1.[4] G. Cybenko 1989 Math. of Cont., Sign., and Syst. 2 4.[5] J.P. Freidberg 2007 Plasma physics and fusion energy,

Cambridge University Press.[6] R.D. Gupta and D. Kundu 2010 J. Appl. Stat. Sci. 18, 51–66.[7] K. Hornik 1991 Neural Networks 4 2.[8] J.W. Hughes et al 2007 Fusion Sci. and Tech. 51, 317-341.[9] J.W. Hughes et al 2018 Nucl. Fusion 58 112003.

[10] Y. LeCun and Y. Bengio 1995 Handbook of Brain Theory andNeural Networks 3361 10.

[11] Y. Ma et al 2012 Nucl. Fusion 52 023010.[12] Y.R. Martin et al 2008 J. Phys. Conf. Ser. 123 012033.[13] A.J. Meakins et al 2010 Plasma Phys. Control. Fusion 52

075005.[14] O. Meneghini et al 2015 Nucl. Fusion 55 083008.[15] C. Mood 2010 Euro. Soc. Rev. 26 1.[16] K. Nigam et al 2000 Machine Learning 39 2-3.[17] S. O’Halloran 2005 Econometrics for Sustainable Development

II, Columbia University.[18] F. Pedregosa et al 2011 JMLR 12:2825-2830.[19] C.C. Petty 2008 Phys. Plasmas 15 080501.[20] A. Pochelon et al 2012 Plasma and Fus. Res. 7 2502148.[21] C. Rea and R.S. Granetz 2018 Fusion Sci. and Tech. 74 1-2.[22] F. Ryter et al 2013 Nucl. Fusion 53 113003.[23] F. Ryter et al 2014 Nucl. Fusion 54 083003.[24] B.N. Sorbom et al 2015 Fusion Eng. Des. 100 378.[25] J. Vega et al 2009 Nucl. Fusion 49 085023.[26] F. Wagner et al 1982 Phys. Rev. Lett. 49 1408.[27] D.G. Whyte et al 2010 Nucl. Fusion 50 105005.[28] A.A. Wright et al 2008 JAMA 300 14.

Page 12: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

Confinement Regime Identification on C-Mod 11

APPENDIX

Accuracy metrics included in the report are: true positive rate (TPR), true negative rate (TNR), positive pre-

dictive value (PPV), negative predictive value (NPV), and Matthews correlation coefficient (MCC). These are

based on the outcomes of a confusion matrix, i.e. true positive (TP), true negative (TN), false negative

(FN), and false positive (FP), which are produced by applying the ‘one vs. rest’ approach for each L-, H-

, and I-modes. This is an inherently multiclass problem, but can be simply converted into a binary compar-

ison for simpler analysis of accuracy metrics across modes. When dealing with imbalanced datasets, the to-

tal accuracy can misrepresent the overall strength of a classifier, in which case an alternative measure such as

the Matthews correlation coefficient (MCC) which accounts for unevenness in the database may be preferred.

TPR =TP

TP + FN(sensitivity or recall) (A.1)

TNR =TN

TN + FP(specificity) (A.2)

PPV =TP

TP + FP(precision) (A.3)

NPV =TN

TN + FN(A.4)

ACC =TP + TN

TP + TN + FP + FN(A.5)

MCC =TP× TN− FP× FN√

(TP + FP)(TP + FN)(TN + FP)(TN + FN)(A.6)

The results for the different classifiers after 100 cycles are reported below. The results in the main report are based on

utilizing the trained classifiers from 1 of the cycles. The total accuracy (ACC) is based on the cumulative correct and

incorrect classifications for all 3 modes combined. A metric known as the area under curve (AUC) is also reported.

AUC is a measure of the area under a curve known as the receiver operating characteristic (ROC) which is a plot

of the true positive rate as a function of the false positive rate at different threshold cut-off points for a particular

classification decision. A higher AUC indicates the algorithm is learning quicker to distinguish between groups.

TP1

1

FN

0

FP0 TN

Actu

al

Prediction

Table 1: Example of a binary confusion matrix.

Page 13: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

12 A. Mathews

GNB LR MLP RFL

-mode

PPV 0.959± 0.003 0.943± 0.004 0.971± 0.004 0.989± 0.001

TPR 0.925± 0.004 0.959± 0.003 0.970± 0.004 0.991± 0.001

TNR 0.867± 0.011 0.808± 0.013 0.906± 0.015 0.964± 0.003

NPV 0.776± 0.009 0.855± 0.010 0.902± 0.011 0.971± 0.002

AUC 0.957± 0.003 0.971± 0.002 0.989± 0.001 0.998± 0.000

MCC 0.763± 0.010 0.783± 0.013 0.875± 0.009 0.957± 0.003

H-m

ode

PPV 0.773± 0.014 0.833± 0.013 0.861± 0.015 0.953± 0.004

TPR 0.775± 0.017 0.752± 0.017 0.841± 0.024 0.936± 0.006

TNR 0.966± 0.003 0.977± 0.002 0.980± 0.003 0.993± 0.001

NPV 0.966± 0.003 0.964± 0.002 0.977± 0.003 0.991± 0.001

AUC 0.953± 0.005 0.966± 0.003 0.986± 0.002 0.997± 0.000

MCC 0.740± 0.014 0.762± 0.014 0.830± 0.013 0.937± 0.005

I-m

ode

PPV 0.723± 0.013 0.817± 0.014 0.913± 0.014 0.983± 0.003

TPR 0.894± 0.019 0.814± 0.021 0.943± 0.012 0.986± 0.002

TNR 0.954± 0.004 0.976± 0.002 0.988± 0.002 0.998± 0.000

NPV 0.985± 0.002 0.975± 0.003 0.992± 0.002 0.998± 0.000

AUC 0.973± 0.003 0.982± 0.002 0.997± 0.001 0.999± 0.000

MCC 0.775± 0.015 0.791± 0.018 0.918± 0.009 0.983± 0.002

ACC 0.903± 0.004 0.917± 0.004 0.951± 0.003 0.984± 0.001

Table 2: Accuracy metrics for validation set.

Page 14: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

Confinement Regime Identification on C-Mod 13

GNB LR MLP RFL

-mode

PPV 0.955± 0.015 0.941± 0.016 0.954± 0.014 0.941± 0.015

TPR 0.927± 0.018 0.958± 0.014 0.955± 0.013 0.956± 0.011

TNR 0.855± 0.047 0.803± 0.051 0.848± 0.044 0.799± 0.046

NPV 0.779± 0.046 0.853± 0.043 0.852± 0.043 0.843± 0.039

AUC 0.951± 0.019 0.970± 0.010 0.970± 0.011 0.959± 0.014

MCC 0.758± 0.039 0.777± 0.041 0.804± 0.036 0.769± 0.036

H-m

ode

PPV 0.770± 0.055 0.830± 0.054 0.814± 0.052 0.777± 0.061

TPR 0.774± 0.064 0.751± 0.062 0.851± 0.029 0.763± 0.059

TNR 0.964± 0.010 0.976± 0.008 0.972± 0.009 0.966± 0.010

NPV 0.965± 0.011 0.962± 0.011 0.969± 0.009 0.964± 0.010

AUC 0.952± 0.018 0.965± 0.013 0.967± 0.011 0.949± 0.020

MCC 0.735± 0.046 0.758± 0.047 0.807± 0.035 0.734± 0.046

I-m

ode

PPV 0.720± 0.081 0.807± 0.082 0.831± 0.081 0.826± 0.078

TPR 0.864± 0.064 0.802± 0.077 0.843± 0.073 0.755± 0.076

TNR 0.956± 0.015 0.975± 0.012 0.978± 0.010 0.980± 0.010

NPV 0.981± 0.010 0.974± 0.013 0.979± 0.012 0.968± 0.013

AUC 0.961± 0.031 0.981± 0.008 0.981± 0.022 0.970± 0.019

MCC 0.757± 0.059 0.777± 0.059 0.815± 0.064 0.762± 0.061

ACC 0.900± 0.016 0.914± 0.015 0.923± 0.013 0.909± 0.013

Table 3: Accuracy metrics for testing set.

Page 15: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

14 A. Mathews

Variable Description Units Source

shot shot number in Alcator C-Mod logbook - -

id arbitrary unique identification number - -

present mode current mode (L, H, or I) - -

next mode mode at next transition (L, H, I, or end) - -

time current time s -

time at transition time at which next transition occurs s -

btor toroidal magnetic field T MAGNETICS

ip plasma current A MAGNETICS

i beam neutral beam A DNB

p lh lower hybrid power W LH

p icrf net ion cyclotron radio frequency power W RF

p icrf d D-port ion cyclotron radio frequency power W RF

p icrf e E-port ion cyclotron radio frequency power W RF

p icrf j3 J3-port ion cyclotron radio frequency power W RF

p icrf j4 J4-port ion cyclotron radio frequency power W RF

freq icrf d frequency of ICRH at D-port Hz RF

freq icrf e frequency of ICRH at E-port Hz RF

freq icrf j frequency of ICRH at J-port (both J3 and J4) Hz RF

beta N normalized beta - EFIT

beta p poloidal beta - EFIT

beta t toroidal beta - EFIT

kappa elongation (vertical) - EFIT

triang l lower triangularity - EFIT

triang u upper triangularity - EFIT

triang overall triangularity = 0.5 (triang l + triang u) - EFIT

li normalized internal inductance - EFIT

psurfa surface area of plasma on last closed flux surface m2 EFIT

areao cross-sectional area of last closed flux surface m2 EFIT

vout volume of last closed flux surface m3 EFIT

aout minor radius of last closed flux surface m EFIT

rout major radius of last closed flux surface m EFIT

zout z-position of last closed flux surface m EFIT

zmag z-position of magnetic axis m EFIT

rmag r-position of magnetic axis m EFIT

lgap inner gap to primary separatrix m EFIT

rgap outer gap to primary separatrix m EFIT

zsep lower z-position of lower x-point m EFIT

zsep upper z-position of upper x-point m EFIT

p rad radiated power (2π foil) W SPECTROSCOPY::TWOPI FOIL

Page 16: PSFC/RR-19-6library.psfc.mit.edu/catalog/reports/2010/19rr/19rr006/19rr006_full.pdf · PSFC/RR-19-6 . Confinement regime identification on Alcator C-Mod using supervised machine learning

Confinement Regime Identification on C-Mod 15

p rad core core radiated power W SPECTROSCOPY::BOLOMETER

rsep lower r-position of lower x-point m EFIT

rsep upper r-position of upper x-point m EFIT

zvsin z-position of inner strike point m EFIT

rvsin r-position of inner strike point m EFIT

zvsout z-position of outer strike point m EFIT

rvsout r-position of outer strike point m EFIT

upper gap top gap to primary separatrix m EFIT

lower gap lower gap to primary separatrix m EFIT

q0 safety factor at centre - EFIT

qstar safety factor in cylindrical approximation - EFIT

q95 edge safety factor (at 95% poloidal flux surface) - EFIT

V loop efit loop voltage V EFIT

V surf efit surface voltage V EFIT

Wmhd stored plasma energy J EFIT

dWmhddt time derivative of stored plasma energy W EFIT

cpasma calculated plasma current A EFIT

ssep midplane separation between separatrices m EFIT

P ohm ohmic heating power W -

Dalpha Dα(n = 3 to n = 2) W/(m2 · sr) SPECTROSCOPY

Halpha Hα(n = 3 to n = 2) W/(m2 · sr) SPECTROSCOPY

HoverHD Hα/(Hα +Dα) - SPECTROSCOPY

nLave 04 line-averaged electron density (chord 4) m−3 ELECTRONS:TCI

NL 04 line-integrated electron density (chord 4) m−2 ELECTRONS:TCI

nebar efit volume-averaged electron density m−3 ELECTRONS:TCI

b bot mks B-port divertor pressure mTorr EDGE

e bot mks E-port divertor pressure mTorr EDGE

g side rat G-port midplane external pressure mTorr EDGE

update time time/date at which the row is last updated - -

Table 4: Variables presently available in confinement database.

Feature Mean (µ) Variance (σ2)

βp 0.256 0.015

li 1.366 0.038

ne (m−3) 1.547× 1020 4.158× 1039

Pinput (W/m3) 2.194× 106 2.156× 1012

Table 5: Transformation of input features (i.e. x−µσ ) for applied machine learning method based on training set.