Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2022 Feb 1.
Published in final edited form as: Artif Intell Med. 2021 Jan 5;112:102006. doi: 10.1016/j.artmed.2020.102006

A deep-learning-based unsupervised model on esophageal manometry using variational autoencoder

Wenjun Kou a,*, Dustin A Carlson a, Alexandra J Baumann a, Erica Donnan a, Yuan Luo b, John E Pandolfino a, Mozziyar Etemadi c,d
PMCID: PMC7901248  NIHMSID: NIHMS1661923  PMID: 33581826

Abstract

High-resolution manometry (HRM) is the primary method for diagnosing esophageal motility disorders and its interpretation and classification are based on variables (features) from data of each swallow. Modeling and learning the semantics directly from raw swallow data could not only help automate the feature extraction, but also alleviate the bias from pre-defined features. With more than 32-thousand raw swallow data, a generative model using the approach of variational auto-encoder (VAE) was developed, which, to our knowledge, is the first deep-learning-based unsupervised model on raw esophageal manometry data. The VAE model was reformulated to include different types of loss motivated by domain knowledge and tuned with different hyper-parameters. Training of the VAE model was found sensitive on the learning rate and hence the evidence lower bound objective (ELBO) was further scaled by the data dimension. Case studies showed that the dimensionality of latent space have a big impact on the learned semantics. In particular, cases with 4-dimensional latent variables were found to encode various physiologically meaningful contraction patterns, including strength, propagation pattern as well as sphincter relaxation. Cases with so-called hybrid L2 loss seemed to better capture the coherence of contraction/relaxation transition. Discriminating capability was further evaluated using simple linear discriminative analysis (LDA) on predicting swallow type and swallow pressurization, which yields clustering patterns consistent with clinical impression. The current work on modeling and understanding swallow-level data will guide the development of study-level models for automatic diagnosis as the next stage.

Keywords: high-resolution manometry, artificial intelligence, esophageal diagnosis, generative modeling

Graphical Abstract

graphic file with name nihms-1661923-f0001.jpg

1. Introduction

High-resolution Manometry (HRM) is the primary method for the clinical evaluation of esophageal motility and the diagnosis of esophageal motility disorders [1, 2, 3]. The approach for clinical interpretation of HRM studies is guided by the Chicago Classification (CC), which categorizes each HRM study into one of 10 classes (i.e. esophageal motility diagnoses) based on a decision-tree-like algorithm [1]. A typical HRM study is generated from a clinical procedure that involves a patient completing multiple swallows. From data of individual swallow, referred to here as swallow data, around three to four outcomes are computed based on pre-defined algorithms and manual landmark identification. Those swallow-level outcomes could be considered as swallow-level features and firstly applied to a labeling scheme to derive a classification of each individual swallow (i.e. swallow type). Then, the composite (median) values among the swallows that constitute the HRM study and proportions of swallow types are applied to the hierarchical decision tree of the CC to generate an esophageal motility diagnosis on the study.

Two issues may arise from this diagnosis platform. First, due to reliance on pre-defined outcomes, the CC algorithm is sensitive to noise/outliers that may lead to misclassification. For example, integrated relaxation pressure (IRP), as one key outcome/feature to quantify the behavior of lower esophageal sphincter (LES), computes the sum of relaxed pressure along user-picked LES channels. The CC applies the IRP such that a low IRP is associated with normal swallow, whereas an elevated IRP leads to abnormal classifications of disorders, such as so-called esophageal-gastric junction outflow obstruction (EGJOO). However the parameter of the IRP could be sensitive to wall-catheter contact or catheter movement (i.e. pressure artifacts) or esophageal shortening. Second, the feature extraction/calculation relies on expert experience, which could lead to inter-rater disagreement. For example, the manual identification of LES channel in computing IRP not only requires the knowledge of esophageal sphincter function, but also could become complicated/problematic in cases where hiatal hernia and/or catheter movement occurs. Even metric-related parameters generated by the analytic software are reliant on manual review and positioning of anatomic and physiologic landmarks. Thus interpretation of HRM is subject to inter-rater variation and rater associated inaccuracy, which is impacted by rater experience and expertise [4, 5, 6]. Reliance on subjective experience also poses a challenge in medical training. A recent post-training evaluation survey from GI fellows showed only 84 percent were confident in the interpretation of esophageal manometry [7].

However, machine learning could provide a viable solution to alleviate issues associated with HRM interpretation. In particular, deep learning models developed with large set of raw manometry data could learn the distinctive patterns that separate various clinical phenotypes of esophageal motility disorders. Those learned patterns could further be synthesized or encoded as new outcomes/features that potentially generalize better than pre-defined features based on limited datasets. Moreover, the trained model could also automate the pipeline from raw manometry data to final diagnosis, and therefore acts as an artificial intelligence (AI) assistant to facilitate clinical practice and medical training.

AI (or machine learning) has already found wide applications in various fields of medicine [8, 9, 10], including gastroenterology [11]. Based on several review reports [11, 12, 13], the primary focus of AI in gastroenterology is generally related to interpretation of endoscopic images, such as detection of intestinal malignancies or premalignant lesion or evaluation of inflammatory bowel disease and gastrointestinal bleeding (see [11]). Regarding esophageal manometry, however, there seems to be no machine learning model to predict type of swallow and esophageal motility diagnosis directly from raw manometry data. These deep learning model (as to differentiate them from feature-based machine learning models) may be lacking from esophageal manometry interpreter, due to lack of large cleaned manometry dataset to counter-against the curse of dimensionality [14]. Thus, based on a newly created dataset with 32-thousand manometry swallows, this study aimed to develop an unsupervised deep learning model using variational auto-encoder (VAE). VAE, as a generative approach to approximate high-dimensional data distribution, has been successfully used in many applications including image analysis [15, 16], abnormality detection, and semi-supervised learning [17]. The VAE model developed in this work is conjectured to not only represent the distinctive patterns of various types of swallows, but also could act as features extractors for building study-level models for automatic diagnosis.

The presentation of this work is organized as follow. After the brief introduction of HRM procedure and dataset, the VAE formulation is revisited and modified to include additional type of loss motivated by the esophageal functioning. Then the training of the VAE model are discussed. Cases with different dimensionality of latent space and specific type of loss are compared. The model’s generative and discriminative capabilities are evaluated and discussed.

2. Materials and Methods

2.1. Overview of High-resolution Manometry data

After a minimum 6-hour fast, HRM studies were completed using a 4.2-mm outer diameter solid-state assembly with 36 circumferential pressure sensors at 1-cm intervals that samples at 100-Hz frequency (Medtronic Inc, Shoreview, MN). The HRM assembly was placed transnasally and positioned to record from the hypopharynx to the stomach with approximately three intragastric pressure sensors. After a 2-minute baseline recording, the HRM protocol was performed with ten, 5-ml liquid swallows in a supine position. Additionally, five, 5-ml liquid swallows were performed in the upright, seated position. During each swallow, pressure variations reflecting physiology of esophageal function were recorded, which is referred here as swallow data. HRM swallows and studies were interpreted according to CC v3.0 [1], in which swallow-level features were applied to derive swallow types, which were applied at the study-level to assign the esophageal motility classification (study label). Study and swallow-level labels were assigned prospectively into patients’ medical records during the course of standard clinical interpretation by a single interpreter with expertise in HRM interpretation (JEP). The classifications among the study cohort were retrospectively reviewed by a group of experienced HRM interpreters (DAC, ED, AJB) to verify and confirm classifications; questions were settled via group review and consensus assignment (JEP, DAC, ED, AJB).

An illustration of information flow is shown in Figure. 1, which indicates the swallow-level modeling and learning is a building block for study-level prediction. Based on the approach outlined by the CC, the pressure data within a 12 to 20-second window starting from swallow onset, was characterized independently to obtain various swallow-level features. The swallow types were assigned as Normal, Weak, Failed, Fragmented, Premature or Hypercontractile, and the pressurization types included Normal (NP), Compartmental pressurization (CP) and Panesophageal pressurization (PEP). Finally, 2,161 HRM studies, consisting of 32,415 labeled swallows, were included. This labeled 32,415 swallow data was used to develop the VAE model described in this work. Next, the whole dataset was split into three datasets: training, validation and test dataset. The train-validation-test split, were stratified to 70-15-15 splits at the study level, so that the individual swallows within a single study fell into the same dataset, avoiding information leaking. Table. 1 lists the data distribution with respect to both study-level category and swallow-level categories. It can be seen that the data distribution of swallow type and swallow pressurization was similar across training, validation and test datasets.

Figure 1:

Figure 1:

Illustration of high-resolution manometry procedure and associated information flow from raw data to final diagnosis in current clinical practices

Table 1:

Sample distribution with respect to study-level categories (the Chicago Classification) and two swallow-level categories (swallow type and swallow pressurizaton).Note for category, Chicago Classification, listed are the number of studies in each dataset for the corresponding label. Also, Label IEM includes the studies labeled as Fragmented Peristalsis (FRP) in original Chicago Classification, and Label T3A includes those labeled as Distal Esophageal spasm (DES) originally [1]. For Categories, swallow type and swallow pressurizaton, listed are the number of swallows in each dataset.

Category label label details train # valid. # test #
Chicago ABC Absent Contractility 65 14 15
classification T1A Type1 Achalasia 48 10 11
T2A Type2 Achalasia 93 19 20
T3A Type3 Achalasia 70 14 16
EGJOO EGJ outflow obstruction 238 51 52
JES Jackhammer esophagus 33 7 8
NEM Normal motility 722 154 155
IEM Ineffective esophageal motility 242 51 53
swallow type N Normal 12636 2719 2869
W Weak 2752 575 521
F Failed 5340 1074 1194
FR Fragmented 694 188 122
P Premature 641 121 119
H Hypercontraction 602 123 125
swallow NP Normal pressurization 19544 4119 4302
pressurization CP Compartmental pressurization 1892 404 306
PEP Panesophageal pressurization 1229 277 342

2.2. data augmentation and rebalance

Table. 1 also highlights the issue of data imbalance. Imbalanced data distribution could bias the generator to focus more on the majority class. Therefore, data rebalance was conducted as part of data augmentation, which will be discussed later. Another part of data augmentation is about down-sampling of raw data to alleviate the issue from the curse of dimensionality. In particular, we set the time duration for each swallow as 24 second and down-sample the data from 100Hz to 10Hz. This choice of time window is based on the following reasons. First, a baseline data occurred before swallow onset is needed to inform the resting state of esophageal body and EGJ, for which 4 seconds of data seems sufficient. Second, duration of a typical swallow lasts about 12–16 seconds from our experience [6]. Finally, an additional 4–8 second post-swallow data with redundancy permits time rolling as one way of data augmentation. The temporal down-sampling from 100Hz to 10Hz is motivated by two reasons. First, to our knowledge, all of the relevant physiological signals measurable by manometry have a frequency below 10Hz. These signals include respiration, pulse due to heartbeat, muscle contraction-relaxation wave, and gastric slow wave. Hence down-sampling to 10Hz should lead to minimal loss of information associated with patterns of esophageal swallow. Second, 10Hz is the sampling frequency of another data source from a comparable procedure, Functional lumen imaging probe (FLIP) [18]. FLIP, similar to manometry, manifests the dynamics of esophageal functions based on readings of pressure and impedance sensors, but with a sampling frequency as 10Hz. Adopting 10Hz in our current model may help the future development of multi-module models that incorporate those two data sources. After the down-sampling, the dimensionality of swallow data shrinks from 2400 × 36 to 240 × 36. To boost the counts of minority classes, we designed data augmentation by artificially rolling data along the channel-wise axis and time-wise axis, respectively. This is illustrated in Figure. 2. Note that the whole procedure of data augmentation is done on the fly by a user-defined data generator built on top of the keras library [19].

Figure 2:

Figure 2:

Exploration of swallow data showing the variation of pressure pattern by swallow type (Upper) and by swallow pressurization (Lower left). Lower right shows the data augmentation by temporal rolling (i.e. along x-direction) and channel-wise rolling (i.e. along y-direction)

2.3. generative model: variational auto-encoder

Generative modeling is a broad area of machine learning that aims to model the distribution P(X), defined over datapoint X = Xn in an n-dimensional space X. For the current HRM swallow data, datapoint X is the raw pressure recordings from ny = 36 channels, each of which records nx samples in time. The dimensionality, n = ny × nx = 36 × 240, as we adopted 240 samples in time. A straightforward kind of generative models that directly compute P(X) could suffer from the curse of dimensionality. Techniques related to dimension reduction and/or compressive sensing, such as principle component analysis, independent component analysis, auto-encoder, and variational auto-encoders (VAE) are often used [14]. In particular, VAE proposes to approximate an optimal P(X) through maximizing a tractable lower bound, and offers structured latent space for data generation. Due to these features, VAE is adopted in this work. Details of VAE methodology have been well studied and reported in literature [14, 20]. Hence we only discuss several key ingredients in this section for completeness. We begin by introducing the latent space as below.

P(X)=P(X|Z)P(Z)dZ (1)
P(X|Z)=R(X|d(Z;θd)); (2)

where, Z = Zr is the latent variables in a r-dimensional space Z, which is a typically low-dimension space. A priori density function of latent space, P(Z) is typically assumed as r independent Gaussian with zero mean and unit variance. d(Z; θd) denotes a decoder model (or generator) with parameters θd to be learned. The decoder model, depending on the needed capacity, could be any directed graphical model, including the neural network that is adopted here. It signifies how the information flows in an expanded fashion from low-dimensional latent space to high-dimensional data space. The R(·) is a density function to facilitate the quantification of reconstruction loss between X and outputs of decoder, X¯=d(Z;θd). For example, for n-dimensional continuous data X, one could choose R(·) = N,σ × I), n independent Gaussian distribution with constant variance σ, yielding logR(·) as L2 loss (plus a constant). For n-dimension binary data X, one could choose R(X|X¯=d(Z;θd))=ei=1n(XilogXi¯+(1Xi)log(1Xi¯), with logR(·) as the cross-entropy loss.

Another key ingredient for VAE is the evidence lower bound objective (ELBO), denoted as L

L=EQ(Z|X)[logP(X,Z)logQ(Z|X)]=EQ(Z|X)[logP(X)+logP(X|Z)logQ(Z|X)]=logP(X)DKL(Q(Z|X)P(Z,X))logP(X), (3)

where, Q(Z|X) is a density function to model the posterior of latent variables Z, discussed later. DKL(Q(Z|X)∥P(Z, X)) is non-negative Kullback–Leibler (KL) divergence. Evidently, Eq. 3 shows one can maximize logP(X) by maximizing ELBO, L, which can be further written as a sum of expected log likelihood and the KL divergence between the prior P(Z) and Q(Z|X),

L=EQ(Z|X)[logP(X|Z)+logP(Z)logQ(Z|X)]=EQ(Z|X)[logP(X|Z)]DKL(Q(Z|X)P(Z)). (4)

Examining Eq. 4 gives the intuition on how Q(Z|X) is encouraged during the optimization of ELBO. The first term is an expected likelihood that moves the density mass on configurations of the latent variables that explain the observed data, whereas the second term encourages the density function Q(Z|X) to be close to the prior P(Z). The balance between the likelihood and prior in the ELBO allows us to bias one against the other by incorporating a weight scalar, λ. This was referred to as the modified ELBO, L¯

L¯=EQ(Z|X)[logP(X|Z)]λDKL(Q(Z|X)P(Z) (5)

Now we come to discuss the posterior Q(Z|X). Q(Z|X) is another directed probabilistic graph, pointing from the high-dimensional data space, XX toward a low-dimensional latent space ZZ. Similar to P(X|Z). Q(Z|X) typically incorporates a neural network model, referred to as the encoder, to capture the information flow. Thus we have

Q(Z|X)=S(Z|e(X;θe)) (6)
L¯=L¯(X;θe,θd)=ES(Z|e(X;θe))[logR(X|d(Z;θd)]λDKL(S(Z|e(X;θe))P(Z)]. (7)

In Eq. 6, e(X; θe) is a deterministic encoder mode (a neural net here), with θe as parameters to be learned. S(·) is a density function that depends on the latent space Z. For r-dimensional continuous latent variables used in this work, S(·) is taken as r independent Gaussian, whose mean and variance are outputs of the encoder neural network e(X; θe). Hence, the objective function L¯(X;θe,θd) identifies two sets of parameters, θe in the encoder and θd in the decoder, to be optimized. The optimization with respect to θd appears to be straight forward, with the gradient computed as below,

θdL¯(X;θe,θd)=ES(Z|e(X;θe))[θdlogR(X|d(Z;θd)]]. (8)

However, the optimization with respect to θe is not obvious, as apparently θeES(Z|e(X;θe))[logR(X|d(Z;θd)]ES(Z|e(X;θe))[θelogR(X|d(Z;θd)]. This motivates the introduction of the re-parameterization trick that moves the θe out of the expectation evaluation, shown as below.

ϵ~p(ϵ) (9)
Z=g(ϵ,e(X;θe))=g(ϵ,e) (10)
EZ~S(Z|e)[logR(X|d(Z;θd)]=Eϵ~p(ϵ)[logR(X|d(g(ϵ,e);θd)]. (11)

As illustrated above, we introduce a new random variable, denoted as ϵ with density function as p(ϵ), to generate random variable Z through a deterministic mapping g(ϵ, e). Then the expectation is transferred from Z to ϵ, as in Eq. (11). Hence, the gradient with respect to θe in the objective could be conveniently evaluated as below,

θeL¯(X;θe,θd)=Eϵ~p(ϵ)[θelogR(X|d(g(ϵ,e;θe);θd)]λθeDKL(S(Z|e;θe)P(Z))]. (12)

With both P(Z) and p(ϵ) specified as r independent Gaussian with zero mean and unit variance, and g(ϵ,e)=(μi+σi×ϵi)i=1r, we obtain Z ~ S(Z|e; θe) as joint distribution of r independent Gaussian with mean μi and variance σi for i ∈ 2 (1, 2, …, r). So the KL divergence term in Eq. 12 can be evaluated analytically as,

DKL(S(Z|e;θe)P(Z)]=12ir(σi+μi2log(σi)1). (13)

By contrast, the expectation term in Eqs. 5 and 12, is evaluated by single-point Monte-Carlo sampling, denoted as ϵI, when we feed into the model a data point XI from a dataset. Thus, we have

ZI=g(ϵI,e;θe)=(μi+σi×ϵiI)i=1r (14)
Eϵ~p(ϵ)[logR(XI|d(g(ϵ,e;θe);θd))]=logR(XI|d(g(ϵI,e;θe);θd))=logR(XI|d(ZI;θd)). (15)

Note that, both mean μi and variance σi, as output of our encoder model, will be functions of model parameters θe.

logR(·), as discussed before, defines the reconstruction loss. Here, we introduce a hybrid reconstruction loss to facilitate comparison among different types of loss through hyper-parameter tuning. The hybrid reconstruction loss associated with one single data point XI reads,

logR(XI|XI¯=d(ZI;θd))=γ1(i=1n(XiIlogXiI¯+(1XiI)log(1XiI¯))+γ2(in(XiIX¯iI)2+γ2tin(dtXiIdtX¯iI)2), (16)

where, the first term represents the cross-entropy loss, the second term represents the L2 loss. The third term, referred to as hybrid L2 loss, is motivated by the temporal contraction-relaxation pattern in manometry, where dtXi = Xt+1,y − Xt,y is the temporal difference of pressure values along each channel y. This term acts to be a regularizer that encourages the generator to capture the temporal discontinuity of esophageal pressure.

Now, all the terms of the ELBO associated with one single data point XI can be summarized as below.

L¯I(XI;θe,θd)=logR(XI|X¯I)]12λ(ir(σi+μi2log(σi)1)) (17)
logR(XI|XI¯)=γ1(i=1n(XiIlogXiI¯+(1XiI)log(1XiI¯))+γ2(in(XiIX¯iI)2+γ2tin(dtXiIdtX¯iI)2) (18)
XI¯=d(ZI;θd) (19)
ZI=(μi+σi×ϵiI)i=1r (20)
(μi,log(σi))i=1r=e(XI;θe) (21)
ϵiI~N(0,1), (22)

where, λ is a hyper parameter to balance the reconstruction loss and KL divergence. γ1, γ2, γ2t are hyper-parameters to tune the specific form of reconstruction loss. d(ZI; θd) and e(XI, θe) are decoder and encoder, respectively. They are modeled as convolutional neural networks. The total ELBO associated with a minibatch of size m is just a simple summation, L¯=I=1mL¯I. Optimization on the stochastic gradient descent could be appliedLby computing gradients with respect to θd and θe, as shown in Eqs. 8 respectively.

2.4. Other details on model setup

As mentioned above, the encoder and decoder models in this work were implemented as a convolutional neural network (CNN), respectively. The encoder acts like information compressor composed by multiple convolution, pooling filters and fully-connected layers. The decoder, also referred to as generator, attempts to reconstruct the source data fed to the encode. Note that, the reconstructed data X needs to satisfy, XI ∈ [0, 1], in order to be compatible with the cross-entropy loss. Therefore, before feeding it to the encoder, we scale pressure data as, (X + 10)/160 → X and then clip it at (0, 1). We found the scaled data were also beneficial even for cases with L2 loss and helped to mitigate the issue of gradient exploding. With the scaled data, the last layer of decoder adopted sigmoid activation for output, where a low value indicates a low pressure, a high value indicates a high pressure. In the context of binary distribution implied in the cross-entropy loss, the output of sigmoid activation layer could be interpreted as the probability of high pressure. Both the cross-entropy loss and L2 loss attains minimum when each dimension of data is exactly reconstructed, but the slope of former becomes more gradual when the minimum is away from both 0 and 1.

Regarding the implementation, the model was developed based on several libraries including tensorflow [21] and keras [19]. The training was performed on Northwestern Quest, a cluster to provide super computing services.

3. Results and Discussions

3.1. Overview: encoder and decoder models

Through extensive experimentation, we obtained the architecture of the encoder and decoder neural networks that seemed to perform well. Specific layers of each neural network are listed in Table. 2 and Table. 3, respectively. The same architectures were used for all case studies, except the adjustment of the shape of encoder output and decoder input for different dimensionality of Zr. The training process was found very sensitive to the step size. However, scaling of the ELBO as L/nL, n = 36 × 240, seemed to alleviate the issue exploding gradient. During training, we also adopted early stopping as one regularizer and reduced learning rate once validation loss was plateaued. The initial learning rate was set as, lr = 1.0e3. Unlike the learning rate, the weight parameter λ was found to have little impact, and thus was simply chosen to be 1.0e5 × n, n = 36 × 240. Each case study included an initial run, followed by 5 restart runs using previously trained weights with the lowest validation loss. Each run lasted four hours unless early stopping was triggered. An example of training history is illustrated in Fig. 3. Evidently, the validation loss and training loss was plateaued before the onset of second restart run (i.e. the 2nd red triangle in the figure). For the last three restarts, the initial phase was accompanied with a short spike of loss increase, due to reset of learning rate (i.e. lr = 1.0e3). This also seems to indicate that the training is sensitive to the learning rate.

Table 2:

Layers in the encoder neural net for cases with a 4-dimensional latent space. The first dimension of Output shape, labeled as None, corresponds to the size of mini-batch. Details of layer type could be found from Keras documentation [19]

Layer type Output Shape
InputLayer (None, 36, 240, 1)
Conv2D (None, 34, 79, 8)
MaxPooling (None, 16, 39, 8)
Conv2D (None, 14, 12, 16)
MaxPooling (None, 13, 10, 16)
Conv2D (None, 11, 8, 32)
MaxPooling (None, 5, 4, 32)
Conv2D (None, 3, 2, 64)
MaxPooling (None, 1, 1, 64)
global average pooling2d (None, 64)
Dense (None, 128)
Dense (None, 8)

Table 3:

Layers in the decoder neural net for cases with a 4-dimensional latent space. The first dimension of Output shape, labeled as None, corresponds to the size of mini-batch. Details of layer type could be found from Keras documentation [19]

Layer type Output Shape
InputLayer (None, 4)
Dense (None, 128)
Reshape (None, 1, 1, 128)
UpSampling2D (None, 1, 1, 128)
UpSampling2D (None, 2, 2, 128)
Conv2DTranspose (None, 4, 4, 64)
UpSampling2D (None, 8, 8, 64)
Conv2DTranspose (None, 10, 10, 32)
UpSampling2D (None, 10, 20, 32)
Conv2DTranspose (None, 12, 41, 16)
UpSampling2D (None, 12, 82, 16)
Conv2DTranspose (None, 37, 247, 8)
Conv2D (None, 36, 240, 1)

Figure 3:

Figure 3:

Training history of Case 2 listed in Table. 4. Line curves: loss, val_loss, lr represent the history of training loss, validation loss, and learning rate, respectively. Same to all the other cases, training of Case 2 includes a fresh run followed by 5 restart runs, where the onset of the nth restart run is indicated by #n red triangle.

3.2. Impact of dimensionality of the latent space: r

The performance of VAE model would likely depend on the dimensionality of the latent space, which determines the narrowness of the information bottleneck arising from the latent space Z that bridges encoder and decoder models. Cases with r = (2, 4, 6, 8) were studied, as listed in Table. 4. For performance evaluation, the trained VAE model was used to first encode and then decode the training/test/validate dataset to compute the reconstruction loss, also listed in Table. 4. For each case, the loss of 3 datasets are roughly the same, indicating that no apparent overfitting occurred. By contrast, the loss decreases with the dimensionality, since larger dimension provides a larger modeling space to explore a better loss-less reconstruction.

Table 4:

Cases with di erent dimensionality, r, of the latent space. For all cases, the reconstruction loss was chosen as L2 loss (see Eq. (16) for details). The train/validation/test loss was computed using trained encoder and decoder network on corresponding dataset, and then averaged over both sample and dimension of data space X.

Case # r train loss validation loss test loss
Case 1 2 1.186e-3 1.181e-3 1.208e-3
Case 2 4 1.017e-3 1.016e-3 1.045e-3
Case 3 6 9.245e-4 9.275e-4 9.515e-4
Case 4 8 8.514e-4 8.612e-4 8.784e-4

The learned semantics could be illustrated by the generated images from sampling in the latent space, as shown in Figure. 4. Case 1 with even 2 latent variables, (z1, z2), clearly shows disentanglement. The high-pressure band, indicating the muscle contraction, diminished diagonally from corner: (left,upper)=(−2,2) to corner: (right,lower)=(2,−2). z1 = x seemingly encoded the spasm pattern, whereas z2 = y the contraction strength. Case 2 with 4 latent variables, (z1, z2, z3, z4), needs projections onto 2D images for illustration. For each projection, 2 latent variables were chosen as (x, y) and varied within (−2, 2), with other latent variables fixed at the origin. Compared with Case 1, Case 2 showed a richer disentanglement. The upper-middle panel of Figure. 4 suggested z1 may encode the transition from normal contraction pattern to concurrent contraction observed in PEP (see Figure. 2). By contrast, z4 focused more on the transition from normal contraction to non-relaxing body contraction in cases of Hyper-contraction (Figure. 2). z2, z3 encoded the relaxation pattern of lower esophageal sphincter (LES), and contraction strength, respectively. Case 3 with a 6-dimensional latent space adopted similar projections, as shown in the lower panel of Figure. 4. Evidently, with more latent variables, Case 3 is also capable to disentangle weak vs. strong contraction, normal vs. concurrent contractions. However, Case 3 also showed patterns that are physiologically implausible. For example, the lower-middle panel of Figure. 4 shows higher contraction in LES region during swallow and/or post-swallow period, encoded by z2, z5. But the esophageal physiology suggests LES should typically show a higher tone during pre-swallow period, and a lower or diminished tone during swallow period to allow the passage of food bolus. Even associated with disorders, the during-swallow and post-swallow LES tone is rarely higher than pre-swallow tone. This might suggest that Case 3 could be over-encoding, i.e. over-exaggerating/extrapolating information from the dataset. Similar over-encoding phenomenon were also observed in Case 4 with 8-dimensional latent space. Hence, Case 2 with 4-dimensional latent space appeared ideal for further study in the following sections.

Figure 4:

Figure 4:

Illustration of generated swallow data for Cases 1, 2, and 3, listed in Table. 4. For high dimensional latent space, various projection onto 2D (x-y)-plane is applied with un-projected dimensions set at the origin.

3.3. Impact of reconstruction loss type

Besides the dimensionality of the latent space, we conjecture the specific form of loss (i.e. reconstruction loss, in particular) could also impact the VAE model. This is because the loss type influences how the optimization procedure pushes the model parameters to represent (i.e. reconstruct) the raw data X by X¯. Based on studies on dimensionality of latent space from the last section, we choose dimensionality of latent space, r = 4, and varies the specific reconstruction form as shown in Eq. (16). Cases are listed in Table. 5, which also includes computed reconstruction loss on train/validation/test dataset using the trained encoder and decoder models. Across the train/validation/test dataset, the reconstruction loss are almost the same, indicating no apparent overfitting. Among different cases, however, the magnitude varies greatly. Compared with Cases with L2 loss, cases with hybrid loss showed slight increase of reconstruction loss due to an additional term in Eq. (16). Case 7 with cross-entropy loss showed the highest level of reconstruction loss, probably because the optimization tries to encode/decode only the overall level of high and low pressure (or contraction). Interestingly, if we adopt L2 loss for comparison, all cases seemed to fall into the same level, as shown in the last column of Table. 5. This might imply that the magnitude of original loss may not be always a reliable metric in comparing model performance without accounting for the specific loss type. A better comparison could be made by investigating the generated images from sampling in the latent space. Generated images on Case 5, 6, and 7 are shown in Figure. 5, which utilized the same projection approach as in Figure. 4 for illustration. Compared with cases with L2 and hybrid-L2 loss, Case 7 with the cross-entropy loss seems to over-emphasize on (repeatedly) encoding spasm contraction, evidenced by two regions (z1 ~ −2, 0, 0, z4 ~ 2) and (0, z2 ~ 2, z3 ~ 2, 0) (see the two left panels). By contrast, Case 5 and Case 6 with hybrid-loss shows a larger spectrum that includes both contraction’s strength and propagation pattern. Compared with Case 2 with L2 loss, Cases 5 and 6 seem to capture a better coherence of transition between contraction/relaxation(i.e. transition between high and low pressure bands). Cases 5 and 6, however, does not reveal significant visual difference, after we compare the projected images from all the 6 pairs of latent variables (not shown here). Therefore, we identify Case 5 as the optimal case for next section of study.

Table 5:

Cases with different type of reconstruction loss. The reconstruction loss is dictated by γ1, γ2, γ2t, weights of the cross-entropy loss, L2 loss, and hybrid L2 loss, respectively, as in Eq. (16). The dimensionality of latent space, r, for all cases was chosen as 4. The train/validation/test loss was computed using trained encoder and decoder network on corresponding dataset, and then averaged over both sample number and dimension in the data space X.

Case # (γ1, γ2, γ2t) train loss validation loss test loss test L2-loss
Case 2 (0,1,0) 1.017e-3 1.016e-3 1.045e-3 1.045e-3
Case 5 (0,1,0.5) 1.558e-3 1.544e-3 1.598e-3 1.088e-3
Case 6 (0,1,5) 5.833e-3 5.833e-3 6.001e-3 1.054e-3
Case 7 (1,0,0) 3.772e-1 3.787e-1 3.766e-1 1.059e-3

Figure 5:

Figure 5:

Illustration of generated swallow data for Cases 5, 6, and 7, listed in Table. 5. For high dimensional latent space, various projection onto 2D (x-y)-plane is applied with un-projected dimensions set at the origin.

3.4. Evaluation of discriminative capability : linear discriminant analysis

The above analysis evaluated the capability of generator on pattern generation and disentanglement. Now we move to the evaluation on the model’s discriminative capability. In particular, we choose the VAE model of Case 5 for this study and use the linear discriminant analysis (LDA) for evaluation. The LDA serves as both a simple classification model for prediction and a supervised dimension-reduction model for 2D illustration. The dataset for developing LDA models are (Z, y), where Z = (z1, z2, z3, z4) are 4-dimensional latent variables and y are labels from either 6-class swallow type or 3-class swallow pressurization (see Table. 1). For each category, The LDA model was trained using the same training dataset as our VAE model and then evaluated on the same validation and test dataset as VAE. The specific implementation is based on machine learning library, scikit-learn, in which two LDA components were adopted for dimensionality reduction. Therefore, the trained LDA model also served as a transformer to map Z = (z1, z2, z3, z4) onto 2-dimensional LDA space, L = (L1, L2) for illustration. Figure. 6 shows the mapped LDA space of test dataset for predicting the 6-class swallow type. The overall accuracy for train/validation/test dataset was 0.64/0.63/0.64. For each class, the class mean, and the class standard deviation of L1(L2) components are denoted as the center, and twice of x(y) radius of the corresponding ellipse (See the upper panel). Three clusters seem to emerge. The first cluster could be the Hypercontraction located on the far right. The second cluster likely includes Premature, Fragmented and widely spread Normal groups, located near upper right. The third cluster consists of Failed and Weak groups, which are both associated with diminished peristalsis. These three emerged clusters are actually consistent with clinical impression. Figure. 7 shows the mapped LDA space of test dataset for predicting the 3-class swallow pressurization. The overall accuracy for train/validation/test dataset was 0.87/0.86/0.87. Note that metrics based on accuracy may be biased because of sample imbalance. But the separation, illustrated by the three corresponding ellipses on class mean and class standard deviation, seemed to be reasonable good.

Figure 6:

Figure 6:

Mapped LDA space of test dataset for predicting the 6-class swallow type using the 4-dimensional latent variables from Case 5. The ellipse associated with each class is centered at the class mean, with x(y) radius equal to half of the class standard deviation of L1(L2) component.

Figure 7:

Figure 7:

Mapped LDA space of test dataset for predicting the 3-class swallow pressurization using the 4-dimensional latent variables from Case 5. The ellipse associated with each class is centered at the class mean, with x(y)-radius equal to half of the class standard deviation of L1(L2) components.

To better appreciate the class separation with the LDA model, we also provided the mapped LDA space of the training dataset as interactive plots. See supplemental data for details.

Unsupervised dimension-reduction technique was also adopted to examine the clustering. Due to simplicity, the principle-component analysis (PCA) with n-components=2 was conducted using 4-dimensional latent variables. Results on both training dataset and testing dataset showed an impressive pattern separation on swallow types (see supplemental interactive plots). In particular, a clear separation was found between Hyper-contractile (H) swallows with Failed (F)/Weak (W) swallows, with widely spread Normal (N) swallows.

4. Conclusion

Current clinical diagnosis algorithms, like Chicago Classification(CC) for Manometry, are largely built on a group of experts’ experience. The generated algorithm, however, could suffer from bias due to subjective experiences and lack of generalized capability for new data, which may disagree with previous impression/knowledge built on limited dataset. Those two issues, from the machine learning’s perspective, could be alleviated by increasing the model’s complexity (to deal with bias) and size of training data (for model generalization). For example, the current CC algorithm essentially assumes as a classification tree based on manually extracted features. Both the assumption on the existence of an optimal classification tree and a handful pre-defined features could be relaxed, for diagnosis algorithm to be determined by a more capable machine learning model, such as multi-layer neural networks. Our current work on learning and understanding swallow-level raw data is one step forward along this route. Moreover, as the first deep-learning-based unsupervised model on raw manometry data, the current VAE model could serves as a benchmark for future related tasks.

The current VAE model also offered several interesting findings. In terms of methodology, the current VAE model identifies the sensitivity of learning rate, which could be tuned with a modified ELBO scaled by the dimension of data space. Parametric studies illustrate the impact of dimensionality of the latent space and the specific form of reconstruction loss. In particular, a hybrid L2 loss with a physiology-motivated penalty term is found to capture a better coherence during contraction/relaxation transition. This could be one example that model tuning could be benefited from the guidance of the domain knowledge. In terms of application, the learned latent variables are able to disentangle various contraction patterns and encode physiologically meaningful scores on contraction strength and motility patterns. The LDA model derived from latent variables, though simplistic, shows clustering patterns that are consistent with clinical impressions. For downstream modeling with the latent variables, however, more capable model could be adopted to overcome the bias from LDA model and likely yield a better classification schemes. This could be pursued in a future work.

Although modeling and learning of the study-level data is the ultimate goal for deriving automatic diagnosis, modeling and learning its basic building block, swallow-level data, is useful for two reasons. First, a well-learned swallow-level model could be a high-level feature extractor for developing study-level models. This is especially the case for VAE model, which generates latent variables to automatically encode scores of various patterns of esophageal contractility and motility. Second, the extracted information and patterns from each swallow could serve as reasoning elements for checking/validating study-level predictions. This is particular useful when the study-level model itself acts to be a black-box model due to its complexity.

One limitation of the current work is that the developed VAE model is purely based on machine learning (ML) approaches, lacking the interpretation from bio-physical principles. Incorporation of bio-physical models into evidence-based ML models could offer more insights in interpretation and understanding of biological phenomena. This methodology has recently been adopted in study of esophageal physiology. For example, Carniel et al. [22] proposed a physiological model to investigate esophageal motility, which was later incorporated into an automatical procedure to identify esophageal diseases based on manometry data [23]. Developing integrated models with both bio-physical principles and evidenced-based ML models is an interesting direction to pursue. In conjunction with our previously developed bio-mechanical esophageal models [24, 25], the current VAE model could potentially be an important component during the future integration.

In conclusion, the current VAE model on swallow data will guide ongoing efforts on developing study-level classification models. It could also serve as an important component in developing an integrated model that incorporates both bio-physical principles and evidence-based principles.

Supplementary Material

1
2
3
4

Highlights.

  • With 32-thousand swallows of esophageal manometry data, a first-of-its-kind deep-learning-based unsupervised model was developed using variational auto-encoder (VAE).

  • The generative capability on disentangling semantics was evaluated and compared among models trained with different latent space and reconstruction loss.

  • Various physiologically-meaningful motility patterns including contraction strength and propagation trend as well as lower sphincter relaxation was found to be well-encoded by 4-dimensional latent variables.

  • The discriminating capability was also examined based on linear discriminative analysis (LDA) trained with latent variables, which revealed clustering patterns that are consistent with clinical impression.

  • Modeling and understanding of swallow-level data will facilitate the development of study-level models for artificial-intelligence-based automatic diagnosis of esophageal manometry.

Acknowledgement

This work was supported by P01 DK117824 (JEP) from the Public Health service.

Footnotes

Publisher's Disclaimer: This is a PDF file of an unedited manuscript that has been accepted for publication. As a service to our customers we are providing this early version of the manuscript. The manuscript will undergo copyediting, typesetting, and review of the resulting proof before it is published in its final form. Please note that during the production process errors may be discovered which could affect the content, and all legal disclaimers that apply to the journal pertain.

Declaration of interest

Dustin A. Carlson: Medtronic (Speaking, Consulting), FLIP panometry (Shared intellectual property)

John E. Pandolfino: Crospon, Inc (stock options), FLIP panometry (Shared intellectual property), Given Imaging (Consultant, Grant, Speaking), Sand-hill Scientific (Consulting, Speaking), Takeda (Speaking), Astra Zeneca (Speaking), Medtronic (Speaking. Consulting), Torax (Speaking, Consulting), Iron-wood (Consulting), Impleo (Grant).

None: Wenjun Kou, Alexandra J. Baumann, Erica Donnan, Yuan Luo, Mozziyar Etemadi.

Supplemental materials: Interactive data visualization

To illustrate the LDA mapping with a larger dataset, we provide results on training dataset as interactive plots. The LDA coordinates (L0, L1) (corresponding to L1, L2 in Results and Discussion) are mapped from 4-dimensional latent variables trained in Case 5. The file:case5-lda-sw-type.html shows the results of the LDA model on predicting the 6-class swallow type. The file:case5-lda-sw-type.html shows the results on predicting the 3-class swallow pressurization. Notice when hovering on any data point, the associated latent variables, LDA variables as well as swallow labels will pop up.

Also included are interactive plots based on principle component analysis (PCA). The file:case5-pca-test-dataset.html shows the mapping results from PCA model on testing dataset. The file:case5-pca-train-dataset.html shows the mapping results from PCA model on training dataset.

References

  • [1].Kahrilas PJ, Bredenoord AJ, Fox M, Gyawali CP, Roman S, Smout AJ, Pandolfino JE, I. H. R. M. W. Group, The chicago classification of esophageal motility disorders, v3.0, Neurogastroenterology & Motility 27 (2) (2015) 160–174. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [2].Roman S, Huot L, Zerbib F, Des Varannes SB, Gourcerol G, Coffin B, Ropert A, Roux A, Mion F, High-resolution manometry improves the diagnosis of esophageal motility disorders in patients with dysphagia: a randomized multicenter study, American Journal of Gastroenterology 111 (3) (2016) 372–380. [DOI] [PubMed] [Google Scholar]
  • [3].Tolone S, Savarino E, Zaninotto G, Gyawali CP, Frazzoni M, de Bortoli N, Frazzoni L, del Genio G, Bodini G, Furnari M, et al. , High-resolution manometry is superior to endoscopy and radiology in assessing and grading sliding hiatal hernia: A comparison with surgical in vivo evaluation, United European gastroenterology journal 6 (7) (2018) 981–989. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [4].Carlson DA, Ravi K, Kahrilas PJ, Gyawali CP, Bredenoord AJ, Castell DO, Spechler SJ, Halland M, Kanuri N, Katzka DA, et al. , Diagnosis of esophageal motility disorders: esophageal pressure topography versus conventional line tracing, The American journal of gastroenterology 110 (7) (2015) 967. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [5].Fox M, Pandolfino JE, Sweis R, Sauter M, Abreu Y Abreu A, Anggiansah A, Bogte A, Bredenoord A, Dengler W, Elvevi A, et al. , Inter-observer agreement for diagnostic classification of esophageal motility disorders defined in high-resolution manometry, Diseases of the Esophagus 28 (8) (2015) 711–719. [DOI] [PubMed] [Google Scholar]
  • [6].Carlson DA, Lin Z, Kou W, Pandolfino JE, Inter-rater agreement of novel high-resolution impedance manometry metrics: Bolus flow time and esophageal impedance integral ratio, Neurogastroenterology & Motility 30 (6) (2018) e13289. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [7].Rao SS, Parkman HP, Advanced training in neurogastroenterology and gastrointestinal motility, Gastroenterology 148 (5) (2015) 881–885. [DOI] [PubMed] [Google Scholar]
  • [8].Miotto R, Wang F, Wang S, Jiang X, Dudley JT, Deep learning for healthcare: review, opportunities and challenges, Briefings in bioinformatics 19 (6) (2018) 1236–1246. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [9].Hosny A, Parmar C, Quackenbush J, Schwartz LH, Aerts HJ, Artificial intelligence in radiology, Nature Reviews Cancer 18 (8) (2018) 500–510. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [10].Johnson KW, Soto JT, Glicksberg BS, Shameer K, Miotto R, Ali M, Ashley E, Dudley JT, Artificial intelligence in cardiology, Journal of the American College of Cardiology 71 (23) (2018) 2668–2679. [DOI] [PubMed] [Google Scholar]
  • [11].Le Berre C, Sandborn WJ, Aridhi S, Devignes M-D, Fournier L, Smail-Tabbone M, Danese S, Peyrin-Biroulet L, Application of artificial intelligence to gastroenterology and hepatology, Gastroenterology 158 (1) (2020) 76–94. [DOI] [PubMed] [Google Scholar]
  • [12].Ahmad OF, Soares AS, Mazomenos E, Brandao P, Vega R, Seward E, Stoyanov D, Chand M, Lovat LB, Artificial intelligence and computer-aided diagnosis in colonoscopy: current evidence and future directions, The Lancet Gastroenterology & Hepatology 4 (1) (2019) 71–80. [DOI] [PubMed] [Google Scholar]
  • [13].Ru e JK, Farmer AD, Aziz Q, Artificial intelligence-assisted gastroenterology-promises and pitfalls, American Journal of Gastroenterology 114 (3) (2019) 422–428. [DOI] [PubMed] [Google Scholar]
  • [14].Goodfellow I, Bengio Y, Courville A, Deep learning, MIT press, 2016. [Google Scholar]
  • [15].Pu Y, Gan Z, Henao R, Yuan X, Li C, Stevens A, Carin L, Variational autoencoder for deep learning of images, labels and captions, in: Advances in neural information processing systems, 2016, pp. 2352–2360. [Google Scholar]
  • [16].Chen X, Konukoglu E, Unsupervised detection of lesions in brain mri using constrained adversarial auto-encoders, arXiv preprint arXiv:1806.04972 (2018).
  • [17].Kiran BR, Thomas DM, Parakkal R, An overview of deep learning based methods for unsupervised and semi-supervised anomaly detection in videos, Journal of Imaging 4 (2) (2018) 36. [Google Scholar]
  • [18].Carlson DA, Functional lumen imaging probe: The flip side of esophageal disease, Current opinion in gastroenterology 32 (4) (2016) 310. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [19].Chollet F, et al. , Keras, https://keras.io (2015).
  • [20].Kingma DP, Welling M, Auto-encoding variational bayes, arXiv preprint arXiv:1312.6114 (2013).
  • [21].Abadi M, Barham P, Chen J, Chen Z, Davis A, Dean J, Devin M, Ghemawat S, Irving G, Isard M, et al. , Tensorflow: A system for large-scale machine learning, in: 12th USENIX Symposium on Operating Systems Design and Implementation (OSDI 16), 2016, pp. 265–283. [Google Scholar]
  • [22].Carniel EL, Frigo A, Costantini M, Giuliani T, Nicoletti L, Merigliano S, Natali AN, A physiological model for the investigation of esophageal motility in healthy and pathologic conditions, Proceedings of the Institution of Mechanical Engineers, Part H: Journal of Engineering in Medicine 230 (9) (2016) 892–899. [DOI] [PubMed] [Google Scholar]
  • [23].Frigo A, Costantini M, Fontanella CG, Salvador R, Merigliano S, Carniel EL, A procedure for the automatic analysis of high-resolution manometry data to support the clinical diagnosis of esophageal motility disorders, IEEE Transactions on Biomedical Engineering 65 (7) (2017) 1476–1485. [DOI] [PubMed] [Google Scholar]
  • [24].Kou W, Gri th BE, Pandolfino JE, Kahrilas PJ, Patankar NA, A continuum mechanics-based musculo-mechanical model for esophageal transport, Journal of computational physics 348 (2017) 433–459. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [25].Kou W, Pandolfino JE, Kahrilas PJ, Patankar NA, Studies of abnormalities of the lower esophageal sphincter during esophageal emptying based on a fully coupled bolus–esophageal–gastric model, Biomechanics and modeling in mechanobiology 17 (4) (2018) 1069–1082. [DOI] [PMC free article] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

1
2
3
4

RESOURCES