1 Introduction

Acute hepatic encephalopathy (AHE) is a common condition, occurring in 30-45% of cirrhotic patients (Amodio et al. 2001). AHE is associated with decreased quality of life, increased hospitalization and increased mortality (D’amico et al. 1986). It is defined as a reversible clinical syndrome of impaired brain function occurring in patients with acute liver failure (ALF), and clinically leads to impaired attention, confusion and decreased arousal (Wijdicks 2016). Many patients with AHE exhibit a strikingly abnormal pattern of brain activity in the electroencephalogram (EEG), in which epileptiform discharges repeat in a regular repeating pattern. This pattern is known as generalized periodic discharges (Hirsch et al. 2013), or triphasic-waves (TPWs) (Agrawal et al. 2015).

Neural computational modeling is a well-established and rapidly increasing research area, which has been successfully applied to the biomedical field to analyze and understand the observed EEG phenomena, test mechanistic hypotheses, and predict system behaviors in space and/or time (Shayegh et al. 2013). Various computational models have been developed to simulate neuronal dynamics and shed light on the mechanisms underlying EEG patterns in healthy and pathological states, including epilepsy, sleep disorders, and other neurological conditions. These neural computational models can be categorized into two main families according to the level of biological organization they aim to represent: microscopic model and mesoscopic model. The former one describes interconnected neurons with each single neuron represented in detail by multiple compartments to model their structural components and functional properties (Wilson and Cowan 1972; Beurle 1956; Nunez 1974; Hutt and Buhry 2014; Fröhlich and Jezernik 2004). Although such models can reflect brain dynamics more realistically, they are challenging to implement on a large scale due to the high computational cost and complexity. In contrast, mesoscopic models study spatially averaged activity to characterize the collective behavior of neural populations instead of modeling the dynamic properties of individual neurons (Jansen et al. 1993; Jansen and Rit 1995; Wendling et al. 2000; Babajani-Feremi and Soltanian-zadeh 2010; Zavaglia et al. 2006; RJ et al. 2007; Zandt et al. 2014). Since mesoscopic models are able to capture certain brain dynamics in a simple and biologically explanative way, there has been increasing interest in the study of mesoscopic models to explore physiological or pathological phenomenon.

In 1952, Beurle modelled the cortex as a spatially uniform and continuous network with a fixed firing threshold (Beurle 1956), which broke new ground in characterizing brain dynamics from the “neural population” point of view. This work allowed researchers to more effectively tackle important and clinically-relevant open questions in neuroscience, including the origin of oscillations in the mammalian EEGs (Wilson and Cowan 1972), including the alpha (8-13 Hz) rhythm (Nunez 1974; Rotterdam et al. 1982) and EEG patterns during epileptic seizures in the olfactory system (Freeman 1987), among others. However, these early computational models had a number of limitations, such as (1) inaccurate representation of the post-synaptic response; (2) poorly defined neural sub-populations; (3) incomplete local or global connectivity; and (4) difficulties in obtaining independent estimates of model parameters (Liley 1997). In an effort to overcome some of these limitations, a variety of improved computational models have been developed. Among these, the model proposed by Liley in 1997 has been successful in clarifying the genesis of alpha rhythms in the mammalian brain (Liley 1997). In this model, two neural populations (excitatory and inhibitory) are connected via local feedforward and feedback excitatory and inhibitory couplings, and synaptic reversal potentials are incorporated in each population so that conductance-based neurons are defined. In Liley et al. (1999), Liley et al. further proposed an improved form of this model with more generalized mathematical formulations which could be applied if the proposed nine assumptions were achieved. For convenience, we refer to this model as the “Liley model” in what follows.

Recent work on patients with anoxic brain injury has shown that a modification of the Liley model can reproduce generalized periodic discharges, which are similar to the TPW EEG patterns seen in AHE patients (Ruijter et al. 2017). Building on this work, we study a modified Liley model in order to relate observed EEG patterns (TPWs) to mechanisms believed to be important in generating the neurological manifestations of delirium in AHE. To achieve this goal, a new computational model of AHE (AHE-CM) will be first proposed by integrating three known mechanisms underlying AHE into the Liley model: (1) impaired synaptic transmission secondary to impaired cellular metabolism; (2) increased neuronal excitability; and (3) enhanced postsynaptic inhibition. Then, to match this model to features of actual EEGs from patients with AHE, a parameter optimization method based on particle filtering (PF-POM) will be designed. In this work, we focus specifically on tuning the model to approximately reproduce the distribution of inter-TPW intervals. Finally, through combining AHE-CM with PF-POM, we study the model behaviours in response to changes in key parameters, as well as the relation between the frequency of TPWs in real AHE-EEGs and the mechanisms underlying AHE in our computational model. Performance of the proposed model will be verified on seven AHE patients hospitalized at Massachusetts General Hospital (MGH).

This paper is organized as follows. In Section 2, we introduce the proposed approach, including the neural computational model of AHE (AHE-CM) together with the mechanisms underlying AHE, and the model parameter optimization method PF-POM. In Section 3, we analyze the model performance on EEGs from 7 patients who were hospitalized at the Massachusetts General Hospital.

2 Methods

This section introduces our neural computational model of AHE (AHE-CM), and a model parameter optimization method based on particle filtering (PF-POM).

2.1 Neural computational model of AHE

In this subsection, we first give a brief overview of “Liley model”, including its topological structure and the dynamics of each neural population. Then we summarize three key neuropathological alterations believed to underlie delirium in AHE. Finally, a new neural computational model of AHE (AHE-CM) is proposed by integrating the three mechanisms into the Liley model.

A1) Overview of the Liley model

The Liley model comprises two neural populations: an excitatory population (represented by E) and an inhibitory population (represented by I), which are functionally distinct but synaptically coupled. The model includes two inter-connections (weighted by Nie and Nei) and two intra-connections (weighted by Nee and Nii). External input from thalamus to E and I are presented by pee and pei. Figure 1 illustrates the topological structure.

Fig. 1
figure 1

Sketch of Liley model

The dynamics of each population are described by two state variables, the soma membrane potential and the post-synaptic potential. The soma membrane potential V is modeled according to conductance-based rules (Ermentrout 1994), specifically,

$$ \begin{array}{@{}rcl@{}} \tau\dot{V}(x,t) &=& V^{r}-V(x,t) + \sum \psi(V(x,t))I(x,t) \end{array} $$
(1)

where

$$ \begin{array}{@{}rcl@{}} \psi(V(x,t)) &=& \frac{[V^{eq}-V(x,t)]}{|V^{eq}-V^{r}|}. \end{array} $$
(2)

Here, Vr is the resting membrane potential and Veq represents the reversal potential. On the other hand, post-synaptic potential I is modeled according to the convolution-based rules, specifically,

$$ \begin{array}{@{}rcl@{}} I(x,t) &=& h(t) \otimes m(x,t) \end{array} $$
(3)

where

$$ \begin{array}{@{}rcl@{}} m(x,t) &=& S(V(x,t)) \\ &=& \frac{Q^{max}}{1+e^{-\sqrt{2}(V(x,t)-V_{0})/\sigma}}, \end{array} $$
(4)
$$ \begin{array}{@{}rcl@{}} h(t) & =& {\varGamma}\gamma te^{1-\gamma t} (t \geq 0). \end{array} $$
(5)

Note that m(x,t) and h(t) denote the firing rate and impulse response of a population where t represents time and x corresponds to the spatial position of the population in the brain. In Eq. (4), S(⋅) is a sigmoid function, Qmax is the maximum population firing rate, σ is the steepness of the sigmoidal transformation, and V0 is firing threshold. In Eq. (5), Γ represents the peak amplitude of the post-synaptic potential and γ characterizes the exponential decay time scale of the post-synaptic potential. For convenience in calculating the convolution ⊗ in Eq. (3), further taking the Laplace transformation on it, then Eq. (3) can be re-expressed by a non-linear partial differential equation as

$$ \begin{array}{@{}rcl@{}} \ddot I (x,t) = -2\gamma\dot I(x,t)-\gamma^{2}I(x,t) + {\varGamma} \gamma e\cdot m(x,t). \end{array} $$
(6)

Details of the transformations of electrical activities in the Liley model are shown in Fig. 2. Blue lines represent intra-connected loops and the green dotted lines represent inter-connected loops. In each loop, the post-synaptic potential I can be obtained from the soma membrane potential V by Eq. (3), which is completed by two computational blocks (see sub-figure in Fig. 2): a potential-to-rate block (represented by S) and a rate-to-potential block (represented by h). Specifically, the soma membrane potentials V is transformed into firing rate m by Eq. (4) in the first block, and the firing rate m is converted into the post-synaptic potential I by Eq. (5) in the second block. After that, the post-synaptic potential I is further transferred into the soma membrane potential V according to Eqs. (1)-(2).

Fig. 2
figure 2

The detailed transformation of electrical activities in Liley model

A2) Neuropathological alterations of AHE :

In acute liver failure, there is a systemic build-up of toxic substances from the gut, including ammonia, that are normally metabolized and excreted by the liver (Wijdicks 2016). These toxins travel via the bloodstream to the brain, ultimately leading to development of AHE. Among numerous cellular and neurophysiological mechanisms underlying AHE, we we focus here on three for which there is clear evidence for a role in development of AHE. These are (1) impaired synaptic transmission secondary to reduced cellular metabolism; (2) increased neuronal excitability; and (3) enhanced postsynaptic inhibition.

Brain concentrations of ATP are significantly reduced in experimental animal models of AHE (Kosenko et al. 1994; Dhanda et al. 2018). This is thought to result from hyperammonia-induced mitochondrial dysfunction, systemic ischemia and hypoxia and increased ATP consumption (Kosenko et al. 1994; Monfort et al. 2002). The latter process may be secondary to hyperammonia-induced glutamate N-methyl-D-aspartate (NMDA) receptor hyperactivation and concomitant compensatory excessive activation of the sodium/potassium ATPase pump to maintain cellular sodium levels within the normal range (Kosenko et al. 1994; Monfort et al. 2002). Given that synaptic neurotransmission is a highly metabolically expensive process, accounting for 30% of the brain’s adenosine triphosphate (ATP) usage (Back et al. 1998), it is likely that ATP depletion observed in AHE is associated with impaired synaptic signaling. Supporting this claim, studies have shown that the reduction in brain ATP levels coincides with the onset of AHE-associated behavioral impairment and EEG abnormalities (Kosenko et al. 1994; Dhanda et al. 2018).

Increased neuronal excitability is another key mechanism underlying AHE. Increased neuronal excitability in AHE appears to arise from two processes: hyperactivation of glutamate NMDA receptors and anoxic long-term potentiation. Ammonia levels are significantly increased in AHE patients (Weiss et al. 2016), and elevated ammonia levels in acute liver failure (ALF) animal models lead to overactivation of NMDA glutamate receptors (Marcaida et al. 1992). Enhanced NMDA-mediated neuronal excitability is also supported by studies which demonstrate decreased expression of astrocytic glutamate transporters (EAAT-2) (Knecht et al. 1997) and astrocytic glycine transporters (GLYT-1) (Wendling et al. 2000), corresponding to increased levels of synaptic glutamate and glycine, agonists and co-agonists of NMDA receptors respectively, in ALF rat models and AHE patients. The resultant overactivation of glutamate NDMA receptors is followed by excessive formation of nitric oxide and cyclic guanosine monophosphate (cGMP), and ultimately increased neuronal excitability (Marcaida et al. 1992). In addition, anoxic long-term potentiation, the phenomenon of increased excitatory postsynaptic potential (EPSP) amplitudes following exposure to ischemia or anoxia, may also contribute to increased neuronal excitability in AHE. Indeed, AHE is often accompanied by a variety of other medical processes which may lead to decreased brain oxygenation, such as gastrointestinal bleeding, sepsis, or the effects of cytokines and other toxins released from necrotic liver tissue (Fauci et al. 1998; Saija et al. 1995).

Finally, a growing body of evidence suggests that enhanced gamma-aminobutyric acid (GABA)- and glycine-mediated postsynaptic inhibition may also be central to the pathophysiology of AHE. Levels of pregnenolone-derived neurosteroids (e.g. allopregnanolone), potent selective positive allosteric modulators of the GABAA receptor, are significantly increased in experimental ALF models and in brains of hepatic coma patients (Butterworth 2016). Additionally, a study in a rabbit model of ALF has shown greatly increased levels of GABA-like activity in peripheral blood plasma just before the onset of AHE (Ferenci 1987). As with ammonia, this finding may be partially due to impaired hepatic extraction of gut derived GABA from portal venous blood (Ferenci 1987). The same study also showed that the blood-brain barrier becomes abnormally permeable to an isomer of GABA before the onset of AHE, and that hepatic coma is associated with an increase in the brain density of GABA receptors (Ferenci 1987), thereby increasing the sensitivity of the brain to GABA-ergic neural inhibition. Another study showed that treatment with flumazenil, a GABA-benzodiazepine receptor antagonist, appears to result in clinical and electroencephalographic improvements in AHE patients (Barbaro et al. 1998). Further, increased levels of synaptic glycine, an inhibitory neurotransmitter observed in AHE, may lead to overactivation of glycine receptors, which together with the hyperactivation of GABA receptors result in post-synaptic inhibition through chloride-channel opening.

A3) Neural computational model of AHE :

To begin building our neural computational model of AHE (AHE-CM), we mathematically augment the Liley model to capture the three pathophysiologic mechanisms described above for AHE. We consider only temporal dynamics; we do not model spatio-temporal dynamics in this work.

First, the postsynaptic potential amplitude Γ in Eq. (6) is taken as a variable satisfying the slow dynamics of itself coupled to the presynaptic firing rate S(⋅) as in the work of Bojak et al. (2015), which can be expressed by

$$ \begin{array}{@{}rcl@{}} \dot{{\varGamma}_{k}} (t)&=&\frac{{\varGamma}_{k}^{rest}-{\varGamma}_{k}(t)}{\tau_{k}^{rec}}-p_{k}^{dep} S (V_{e} (t)) {\varGamma}_{k} (t). \end{array} $$
(7)

Here, \(p_{k}^{dep}\) is the depletion constant reflecting the impaired synaptic transmission, \({\varGamma }_{k}^{rest}\) is the resting value of the maximum amplitude of the postsynaptic potential (PSP), and \(\tau _{k}^{rec}\) is the recovery time for activity dependent synaptic depression, subscript k ∈{e,i} indicate excitatory and inhibitory populations, respectively. Note that this mechanism applies to both excitatory and inhibitory populations.

Next, to model the effect of increased neuronal excitability, we modify the Liley model to amplify the resting value of maximum amplitude Γrest of the excitatory postsynaptic potential (EPSP) in Eq. (7). This is accomplished by setting,

$$ {\varGamma}_{e}^{rest}={\varGamma}_{e}^{equ}*(1+F_{am}) $$
(8)

where \({\varGamma }_{e}^{equ}\) is the equilibrium voltage of the EPSP and Fam is the amplification factor. This mechanism applies only to the excitatory population.

We last model enhanced postsynaptic inhibition, caused by the increased GABAergic neural transmission. To do this, we prolong the duration of the inhibitory postsynaptic potential (IPSP) by altering the decay rate constant γi in Eq. (6) according to Bojak and Liley (2005), so that the inhibitory post-synaptic potential is given by

$$ \begin{array}{@{}rcl@{}} \ddot I_{i} (t) = &-&(\gamma_{i} + \tilde{\gamma}_{i}) \dot I_{i}(t) - \gamma_{i} \tilde{\gamma}_{i} I_{i}(t)+{\varGamma}_{i}(t) \tilde{\gamma}_{i} e^{\frac{{\gamma}_{i}}{{\gamma_{i}^{0}}}} m(t) \end{array} $$
(9)

where

$$ \begin{array}{@{}rcl@{}} \gamma_{i} &=& {\gamma_{i}^{0}}/\lambda_{i}, \\ \tilde{\gamma}_{i} &=& \rho_{i}\gamma_{i}, \\ \lambda_{i}&=& (e^{\epsilon_{i}}-1)/\epsilon_{i}, \\ \rho_{i} &=&e^{\epsilon_{i}}. \end{array} $$
(10)

Here, \({\gamma _{i}^{0}}\) is the baseline synaptic time constant, 𝜖i is the control parameter relating to the decay time of the IPSP. This mechanism applies only to the inhibitory population.

On the basis of the dynamics of each population and detailed transformation of electrical activities in Liley model, the proposed neural computational model of AHE (AHE-CM) can be formulated by combining the mathematical expressions (7)-(9) of three mechanisms. Equation (11) presents the mathematical model of AHE-CM. The Euler-Maruyama method with a time step of 0.1ms is applied to solve the Eq. (11) and the soma membrane potential of the excitatory population (i.e. Ve) is taken to represent the EEG signal. We denote by Θ the set of parameters in AHE-CM. A detailed explanation of the biological interpretation of these parameters and their default values, which we adopt, can be found in Bojak and Liley (2005).

$$ \begin{array}{@{}rcl@{}} \tau_e\dot{V_e}(x,t) &=&V_e^{rest}-V_e(x,t)+\psi_{ee}(V_e(x,t))I_{ee}(x,t)+\psi_{ie}(V_e(x,t))I_{ie}(x,t),\\ \tau_i\dot{V_i}(x,t) &=& V_i^{rest}-V_i(x,t)+ \psi_{ei}(V_i(x,t))I_{ei}(x,t)+\psi_{ii}(V_i(x,t))I_{ii}(x,t),\\ \ddot I_{ee}(x,t)&=& -2\gamma_{e}\dot I_{ee}(x,t)-\gamma_e^2I_{ee}(x,t)+{\Gamma}_e(t) \gamma_e e(N_{ee}^{\beta}S(V_e(x,t)+p_{ee}(t))),\\ \ddot I_{ei}(x,t)&=& -2\gamma_{e}\dot I_{ei}(x,t)-\gamma_e^2I_{ei}(x,t)+{\Gamma}_e(t) \gamma_e e(N_{ei}^{\beta}S(V_e(x,t)+p_{ei}(t))),\\ \ddot I_{ie}(x,t)&=& -(\gamma_{i}+\tilde{\gamma}_{i})\dot I_{ie}(x,t)-\gamma_i\tilde{\gamma}_iI_{ie}(x,t)+ {\Gamma}_i(t) \tilde{\gamma}_i e^{\gamma_i/\gamma_i^0}(N_{ie}^{\beta}S(V_i(x,t)),\\ \ddot I_{ii}(x,t)&=& -(\gamma_{i}+\tilde{\gamma}_{i})\dot I_{ii}(x,t)-\gamma_i\tilde{\gamma}_iI_{ii}(x,t)+ {\Gamma}_i(t) \tilde{\gamma}_i e^{\gamma_i/\gamma_i^0}(N_{ii}^{\beta}S(V_i(x,t)),\\ \dot{{\Gamma}_e} (t)&=&\frac{{\Gamma}_e^{rest}-{\Gamma}_e (t)}{\tau_e^{rec}}-p_e^{dep} S (V_e (x,t)) {\Gamma}_e (t),\\ \dot{{\Gamma}_i} (t)&=&\frac{{\Gamma}_i^{rest}-{\Gamma}_i (t)}{\tau_i^{rec}}-p_i^{dep} S (V_i (x,t)) {\Gamma}_i (t),\\ \psi_{lk}(V_k(x,t)) &=& \frac{[V_{lk}^{eq}-V_k(x,t)]}{|V_{lk}^{eq}-V_{k}^{r}|}, \ \ k = e,i;\ \ l = e,i. \end{array} $$
(11)

2.2 Parameter values

In this subsection, we give some illustrations about how to set the newly introduced parameters (Fam,γi, \(\tau _e^{rec},\tau _i^{rec}\)) in our work.

Modeling impaired synaptic transmission

To characterize impaired synaptic transmission in AHE, we follow the idea in the bursting Liley model of including synaptic depression (Bojak et al. 2015), which means that the postsynaptic peak amplitudes Γe and Γi decrease as a function of presynaptic firing rates and recover with time constants \(\tau _e^{rec}\) and \(\tau _i^{rec}\) (i.e. Eq. (7)). We set baseline values of \(\tau _e^{rec}\) to 500ms and \(\tau _i^{rec}\) to 250ms, in agreement with the physiological range of 250ms to 1000ms (Tsodyks and Markram 1997). According to the work of Ruijter et al. (2017), the impaired synaptic transmission will induce \(\tau _e^{rec}\) and \(\tau _i^{rec}\) that are dramatically increased. Therefore, \(\tau _e^{rec}\) and \(\tau _i^{rec}\) are varied from their baseline to their maximum value. When varying these parameters in our experiments, because excitatory synapses are believed to recover more slowly than inhibitory synapses (Khazipov et al. 1995), we allow a larger range for \(\tau _e^{rec}\) [500 20000]ms than for \(\tau _i^{rec}\) [250 2500]ms, as in Ruijter et al. (2017).

Modeling elevated neuronal excitability and enhanced postsynaptic inhibition

To model the effect of elevated neuronal excitability, we increased the resting value of maximum EPSP (\({\Gamma }_e^{rest}\)) through the parameter “Fam”. Note that, as shown in Eq. (7), Γe is reduced because of the impaired synaptic transmission and may recover with time constant \(\tau _e^{rec}\) to its baseline value. While through the parameter Fam, it may increase above its baseline value, reflecting increased neuronal excitability. We set the magnitude order of Fam to the same values used in the work of Ruijter et al. (2017) in modeling HIE.

To model enhanced gamma-aminobutyric acid and glycine-mediated postsynaptic inhibition, we followed the approach of Bojak and Liley (2005), which modeled effects of anesthesia with GABAA agonists (e.g. propofol). The baseline value of the synaptic rate constant (\(\gamma _i^0\)) is 0.065ms− 1, which agrees with the physiological range of 0.01ms− 1 to 0.5ms− 1 (Ruijter et al. 2017). The magnitude order of 𝜖i is chosen according to Izumi et al. (2013). The postsynaptic potential decay rate γi can be calculated by Eq. (10).

2.3 Particle-filter-based parameter optimization method

In order to verify that the proposed model is able to match some characteristics of EEGs in AHE patients (AHE-EEGs), we developed a procedure for tuning the model parameter values. Therefore, with the constructed AHE-CM, this subsection introduces a model parameter optimization method based on particle filtering (PF-POM), which aims to help the model reproduce a key feature of clinical AHE-EEGs, namely the distribution of inter-TPW intervals (ITIs).

First, we describe the feature that we extract from AHE-EEGs. Triphasic waves (TPWs), also known as generalized periodic discharges, are a common pattern of brain activity in AHE-EEGs, consisting of epileptiform discharges repeating at relatively regular intervals. Figure 3a illustrates a 30s EEG segment recorded from a patient with AHE. The pink columns correspond to TPWs annotated by a semi-automatic annotation tool, Neurobroswer (Jing et al. 2016). The rate at which specified events occur (i.e. frequency) is of interest clinically, because the patterns of periodic discharges that occur at higher frequencies are believed to be potentially harmful to patients and may warrant treatment with anti-seizure drugs (O’Rourke et al. 2016). The intervals between consecutive TPWs can be used to characterize the occurring rate of TPWs: the rate is the inverse of the interval between TPWs. Given J TPWs in an AHE-EEG signal S, we can obtain a sequence of inter-TPWs intervals, denoted \(\mathcal {I}= \{I_1, I_2, \cdots , I_{J-1}\}\), where Ij represents the interval (in seconds) between the k th and the (j + 1)th TPWs. Then the frequency histogram of \(\mathcal {I}\) with M equally sized bins is defined as the extracted feature, denoted by

$$ \begin{array}{@{}rcl@{}} {\textbf{F}_\textbf{1}}=({P}_1,{P}_2,\cdots, {P}_M) \end{array} $$
(12)

where Pi denotes the probability of \(\mathcal {I}\) in the i th bin. Figure 3b shows the frequency histogram of ITIs from the EEG of Fig. 3a.

Fig. 3
figure 3

An AHE-EEG segment and extracted features

In the following, we present the model parameter optimization method based on particle filtering (PF-POM) to match the extracted feature F1. Let S be an AHE-EEG signal and V (Θ) be the output of AHE-CM given the parameter vector Θ. Denote by F1(S), F1(V ) the corresponding extracted feature vectors, We then define the fitness function in terms of F1 as follows:

$$ \begin{array}{@{}rcl@{}} L = \frac{1}{\sqrt{2 \pi} \sigma_{0}} e^{- \frac{d^{2}}{2 \sigma_{0}}} \end{array} $$
(13)

where d represents the Bhattacharyya distance between F1(S) and F1(V ) (Kailath 1967). Next, we apply particle filtering (PF) (Salmond and Birch 2001) to find the optimal solution Θ of the optimization problem

$$ \begin{array}{@{}rcl@{}} \max_{\varTheta} L. \end{array} $$
(14)

Next, suppose that there are N particles in the PF (that is, Θ1,⋯ ,ΘN), then we define the measurement at the k th iteration as

$$ \begin{array}{@{}rcl@{}} C_{k} = \log (\sum\limits_{n=1}^{N} L({\varTheta}_{n})), \end{array} $$
(15)

and apply

$$ \begin{array}{@{}rcl@{}} |C_{k+1}-C_{k}| < \epsilon \end{array} $$
(16)

as the stopping criterion. Here, 𝜖 is a given threshold. Furthermore, in our proposed method, all the parameters are initialized based on a uniform distribution in a large range since there is no prior knowledge. Therefore, a large amount of particles have to be supposed in PF, and hence, the computation cost becomes huge. Under such situation, we propose an improved approach to initialize parameter vector Θ so as to improve the efficiency of PF. Specifically, the parameter space is first separated into a number of sub-spaces, and one subspace is selected on which the feature of model output is close enough to the feature of given EEG signal. Then all the parameters are initialized on the selected subspace. With this approach, a much smaller number of particles is needed in the optimization.

The whole procedure of PF-POM procedure is illustrated in Fig. 4.

Fig. 4
figure 4

The procedure of particle-filter-based parameter estimation method

3 Experiments and results

This section explores the behaviors of our proposed model AHE-CM in 7 AHE patients.

3.1 AHE-EEG Data

The patients whose data were analyzed in this study were hospitalized at the Massachusetts General Hospital (MGH), and were encephalopathic during the EEG recordings. We selected 30-min scalp EEGs from seven AHE patients. These were selected from longer recordings to be relatively free of non-physiological artifacts. Moreover, they were chosen to coincide with times of maximal alertness. That is, as part of routine medical care, the EEG technologist stimulated each patient in attempt to ensure the patient was as awake as possible (although TPW EEG patterns are not compatible with normal levels of consciousness, i.e. these patients were all encephalopathic). Each of EEG segment contains 18 channels with a sampling rate of 128Hz. Details of AHE-EEGs are shown in Table 1, including gender, age and diagnosis. In our simulation, 0.5Hz high-pass and 60Hz notch filters are applied to de-noise the data before further analysis. All triphasic waves in each AHE-EEG were annotated manually in NeuroBroswer. Of note, TPWs are generally synchronous between hemispheres, and to a good approximation appear in all channels simultaneously. Therefore in annotating the timing of TPWs, we assigned a single time to each TPW across all channels.

Table 1 The details of AHE-EEGs

3.2 Performance verification

In this subsection, we study the behaviours of our AHE-CM in response to changes in key parameters. We then present results of tuning the AHE-CM parameters using PF-POM to model the observed periodicity in AHE EEGs.

B1) Performance verification of three added mechanisms :

Here we study model behaviors in response to changes of key parameters, and illustrate the effects of three extra mechanisms added to the Liley model. The four parameters \(\tau _{e}^{rec}, \tau _{i}^{rec}, F_{am}, \gamma _{i}\), which are employed in the three mechanisms are considered the key parameters in the proposed AHE-CM. All other parameters in the model are set to their nominal values in Liley and Bojak (2005), summarized in Table 2. The external input pee is generated randomly based following prior literature, by sampling from a Gaussian distribution with mean 3460s− 1 and standard deviation 1000s− 1; pei is constant (5070s− 1) (Ruijter et al. 2017). We first focus on studying qualitatively what kind of model outputs are produced by different combination of key parameters. In all simulations, EEG signals of 50s duration were generated; the first 10s were ignored to exclude transient effects. The Matlab code used for the model simulations is provided in https://github.com/jill-Song/AHE-code.

Table 2 The parameters and their nominal values in AHE-NCM

The 7 types of simulated signals of AHE-CM are categorized according to the mean value of the inter-TPWs intervals (M-ITIs) in the simulated EEG segment (shown in Table 3). In Fig. 5a, we define a contrast between the 7 types of model outputs and their labels. The model output with label 1 represents a “low voltage” pattern. Labels 2 to 7 exhibit periodic discharges of increasing frequencies. Figure 5b illustrates the results under 9 different parameter settings, where each pair (Fam,γi) is taken from (3,1.5,0.8) × (0.065,0.032,0.014). In each case, \(\tau _{e}^{rec}\) varies from 500 to 20000 with step-size 100, and \(\tau _{i}^{rec}\) varies from 250 to 2500 with step-size 50. That is, each graph depicts 195 × 45 labels of model outputs. From Fig. 5b, it can be seen that higher frequency periodic discharges occur for larger values of (Fam,γi), and smaller frequency discharges occur in the plots in the right panels with lower values of these parameters. On the other hand, in a graph with fixed Fam and γi, the discharges increase in frequency (label numbers increase) as \(\tau _{e}^{rec}\) decreases and as \(\tau _{i}^{rec}\) increases. These trends emerges very clearly in “graph (3)” where almost all patterns/labels occur.

Table 3 Determination of labels
Fig. 5
figure 5

a A contrast between 7 types of model outputs and their labels; b the distribution of model output labels under 9 different cases where (Fam,γi) ∈ (3,1.5,0.8) × (0.065,0.032,0.014) (here, \(\tau _{e}^{rec} (500:100:20000), \tau _{i}^{rec} (250:50:2500)\)); c color bar of 7 types of model outputs

We next examine one special case (as shown in Fig. 6d) in detail to illustrate the effects of adding three extra mechanisms added to the baseline Liley model. Fig. 6 illustrates the outputs of four different models, each with one of the additional mechanism added in. In Fig. 6a, the output of the baseline Liley model is shown, where all parameters are set to their nominal values (see Table 2). Figure 6b illustrates the output of Liley model with the first mechanism added, where the postsynaptic potential amplitude Γ is determined by Eq. (7) with \({\varGamma }_{k}^{rest} = 0.71 (k\in \{e,i\}), \tau _{e}^{rec} = 6000, \tau _{i}^{rec} =1000\). We see that periodic waves begin to appear. The periodicity becomes more evident in Fig. 6c, as the second mechanism is added, that is, when Γ is determined by both (7) and (8); in this illustration Fam = 0.8. Finally, the output of AHE-CM is obtained by adding all of three mechanisms, shown in Fig. 6d. Here, except for the estimated value of Γ as mentioned above, the decay rate constant γi is further calculated by Eq. (10). Interestingly, although reproducing the morphology of TPWs was not a goal of our modeling work, the close up in Fig. 6d shows that the output of the AHE-CM does provide an approximation of the morphology of TPWs. Each of the three red dots in close up of the waveform corresponds to one of the three phases of a TPW.

Fig. 6
figure 6

The effects of adding three extra mechanisms added to the baseline Liley model

B2) Performance verification of AHE-CM combining with PF-POM :

Next, we verify the ability of the proposed PF-POM method to infer the parameters of AHE-CM. We do this in simulated EEGs (generated by the AHE-CM model), because for these we know the true values for the underlying parameters. These true values can be served as a ground truth.

For simplicity, we consider only two key parameters \(\tau _{e}^{rec}, \tau _{i}^{rec}\). We set Fam = 0.8,γi = 0.032, and all other parameters are set to their be nominal values in Table 2. According to the mentioned previously, the ranges of \(\tau _{e}^{rec}\) and \(\tau _{i}^{rec}\) are suggested to be [500,20000]ms and [250,2500]ms. We first divide the parameter space into 5 sub-spaces by segmenting the interval of \(\tau _{e}^{rec}\) and keeping the interval of \(\tau _{i}^{rec}\) whole (see Table 4). Given an AHE-EEG signal S, we calculate the sequence of inter-TPW intervals \(\mathcal {I(S)}\) as well as its mean, denoted by \(mean(\mathcal {I(S)})\). The sub-space related to S is then selected according to the value of \(mean(\mathcal {I(S)})\) shown as in Table 4. With the selected sub-space, the total number of particles is set to be N = 35 in our simulations.

Table 4 Division and selection rule of subspaces

In our PF-POM, the feature F1 is defined to be the frequency of TPWs in AHE-EEGs. To illustrate this feature, Fig. 7 shows the frequency histogram of \(\mathcal {I}\) with respect to two signals (Sfast and Sslow) with different frequencies (fast and slow) of TPWs. In Fig. 7b, the frequency histogram of \(\mathcal {I} (S_{fast})\) is left-skewed normal distribution toward lower inter-TPW intervals, reflecting the higher average frequency of simulated TPWs in signal Sfast. By contrast, the histogram of \(\mathcal {I} (S_{slow})\) are more uniformly distributed and are concentrated at higher inter-TPW intervals, reflecting the slower average rate of TPWs in Sslow.

Fig. 7
figure 7

The feature F1 of two AHE-EEG signals (Sfast and Sslow)

We next verify the ability of PF-POM to estimate model parameters from simulated EEG data. Given parameters values \((\tau _{e}^{rec} , \tau _{i}^{rec})=(1100, 600)\), the model output (“simulated EEG”) is computed according to Eqs. (11). Applying the PF-POM yields estimates \((\tau _{e}^{rec})^{*}\) and \((\tau _{i}^{rec})^{*}\). Figure 8 illustrates the results for 50 trials, where the mean and standard variation of them are shown. To further verify the performance of PF-POM, we compare model output with the true underlying parameters to the model output using the estimated parameter values. In Fig. 9, the red curve shows the original simulated EEG signal (labeled as “ground truth”), and the green curve shows the model output with the optimal values determined by PF-POM (here, one of the results in 50 trials is randomly selected to create the green curve and labeled as “simulated”). The comparison illustrates that effectiveness of the proposed PF-POM.

Fig. 8
figure 8

The optimized values of \(\tau _{e}^{rec}\) and \(\tau _{i}^{rec}\) in 50 trails

Fig. 9
figure 9

Comparison between the original simulated EEG signal (labeled as “ground truth”) and the model output with the optimal values determined by PF-POM (labeled as “simulated”)

B3) Relation between features of AHE-EEGs and the mechanistic model of AHE :

In this section, we focus on the relation between the frequency of TPWs in real AHE-EEGs and the mechanisms underlying AHE in our computational model. We have seen in Fig. 5 that variation in TPWs’ rate depends mainly on \(\tau _{e}^{rec}\) and \(\tau _{i}^{rec}\). Especially, when Fam = 0.8,γi = 0.065, the much more clear variation in all TPW patterns can be observed. Therefore in what follows, we use PF-POM to optimize only \(\tau _{e}^{rec}\) and \(\tau _{i}^{rec}\) (Fam = 0.8,γi = 0.065), in the AHE-CM, and leave the values of the other variables at their nominal values.

In our analysis of AHE-EEG data from patients, each signal is divided into 20s EEG segments. Then given each AHE-EEG segment, we use PF-POM to estimate the values \(\tau _{e}^{rec},\tau _{i}^{rec}\) of an AHE-CM model that best match the data. We then use the estimated AHE-CM model generate a simulated EEG segment (i.e., output of AHE-CM). Table 5 shows the number of TPWs in AHE-EEGs (TA) and simulated EEGs (TS), the mean of ITIs in AHE-EEGs (MA) and simulated EEGs (MS), as well as the corresponding “errors” / differences. Comparing “No. of TPWs” in 30min-long AHE-EEGs and simulated EEGs, the maximum error is 0.0734 and the minimum error is 0.0322, obtained by \(\frac {|TA-TS|}{TA}\). Moreover, the errors between “mean of ITIs” in AHE-EEGs and simulated EEGs, |MAMS|, fall inside the range [0.01,0.06]. We thus conclude that the simulated EEGs resulting from our proposed approach “AHE-CM + PF-POM” have similar properties to AHE-EEGs with respect to periodicity of TPWs. Figure 10 illustrates a 20s AHE-EEG segment from “patient 1” and the simulated EEG segment from the corresponding AHE-CM model after parameter optimization. The pink columns correspond to the annotated TPWs. We observe that 30 TPWs are included in the AHE-EEG segment, whose mean of ITI is 0.6442 (Fig. 10a). The model with estimated parameters produces 29 TPWs with mean ITI 0.6679 (Fig. 10b). These results suggest that optimizing \(\tau _{e}^{rec}\) and \(\tau _{i}^{rec}\) indeed is able to qualitatively match the periodic discharge behavior of real AHE EEGs.

Table 5 Comparison results between AHE-EEG and simulated EEG
Fig. 10
figure 10

An AHE-EEG segment (20s) from “patient 1” and the simulated EEG segment by the proposed approach “AHE-NCM + PF-POM”

We next focus on characterizing the relation between the rate of TPWs in AHE-EEGs and the mechanisms underlying AHE. From the above experimental results, we select 9 out of 90 segments for each patient (shown in the Supplementary Material), and the corresponding mean IEI values and optimal parameter settings (\(\tau _{e}^{rec}\), \(\tau _{i}^{rec}\)) estimated for each segment. In Fig. 11, 63 points (9 × 7) are marked whose position corresponds to the optimal parameters determined by PF-POM and whose value is the mean of its ITIs (M-ITIs). We observe that EEG segments having comparatively small values of M-ITIs (i.e. high frequency of TPWs) locate at the bottom right corner of the graph (corresponding to small \(\tau _{e}^{rec}\) and large \(\tau _{i}^{rec}\)), and EEG segments are located at the upper-left of the graph having comparatively high values of M-ITIs (corresponding to small \(\tau _{i}^{rec}\) and large \(\tau _{e}^{rec}\)).

Fig. 11
figure 11

a) The distribution of mean of ITIs in a parameter space \(\tau _{e}^{rec} \times \tau _{i}^{rec}\); b) color bar of 7 types of model outputs

These results are plausible from a physiological point of view. Here, parameters \(\tau _{e}^{rec}\) and \(\tau _{i}^{rec}\) represent the recovery times for excitatory and inhibitory activities respectively. Therefore, the less the value of \(\tau _{e}^{rec}\) is, the more quickly recovery of excitatory activity will be, thus the faster the excitatory activity can resume - leading to higher frequency discharges. Similarly, the excitatory activity can also recover more quickly if the value of \(\tau _{i}^{rec}\) is larger. On the basis of the above analysis, we hypothesize that the discharge rate of TPWs in real AHE-EEGs is related to recovery times of excitatory and inhibitory neural populations.

4 Discussion

In this study we built a computational model that accounts, at least in part, for generalized periodic epileptiform discharges in the EEG of patients with acute hepatic encephalopathy (AHE), an EEG pattern known as “triphasic waves” (TPWs). Our model is based on the Liley model, augmented with three mathematically characterized mechanisms known to play a role in the encephalopathy that occurs in AHE, namely increased excitability, impaired synaptic transmission, and enhanced postsynaptic inhibition. We also proposed an approach to identify model parameter values that are able to quantitatively match a key characteristic of real EEGs in AHE patients, namely the periodicity of TPWs.

Generalized periodic discharges, including triphasic waves, also occur in contexts other than AHE. These include uremia, severe sepsis, baclofen toxicity, anoxic brain injyry, and other “toxic metabolic encephalopathies” (Kaplan and Sutter 2015; O’Rourke et al. 2016; Foreman et al. 2016). However, with one exception, the underlying physiology / pathophysiology of most of these conditions is more poorly understood than AHE. The exception is hypoxic ischemic encephalopathy (HIE). HIE has been modeled previously by Rujiter et.al., using the same modified Liley model. Ruijter et al identified three key mechanisms in acute HIE captured by the modified Liley model, namely: short-term synaptic depression, potentiation of excitatory neurotransmission, and altered synaptic inhibition (due to effect of propofol) into the “Bursting liley model”. We can see that these pathophysiological alterations are similar to the mechanisms that we have invoked for AHE: elevated neuronal excitability, impaired synaptic transmission secondary to reduced cellular bioenergetics and enhanced postsynaptic inhibition. Given the strong similarities between generalized periodic discharges in other forms of severe encephalopathy, we hypothesize that similar mechanisms will also be discovered to be in play in those conditions.

Note that the proposed model AHE-CM is a kind of mesoscopic model, which is a typical over-simplified method to characterize the brain discharge. And the AHE-EEGs applied in our work are recorded with the noninvasive electrodes placed along the scalp, where electrical potentials are smeared due to the existence of cerebrospinal fluid, skull and scalp, as well as contaminated due to a significant presence of environmental noise and artifacts. Under such situation, there must exist a big gap between the details of EEG waveforms in real AHE-EEGs and the model output themselves. Alternatively, our work accounts only for some, but not all, aspects of the EEG in patients with AHE. In particular, our aim was to account for certain properties of generalized periodic discharges seen in AHE, known as triphasic waves, specifically their frequency.

It is necessary to clarify that our model does not include spatial aspects of TPWs. In fact, we only simulated a single EEG channel. This is justified in part by the fact that EEG patterns in hepatic encephalopathy are typically spatially homogeneous. However, particular phenomena, such as bilateral synchronization of TPWs, anterior-posterior lag or gradient are not explained by our model. In order to illustrate these spatial characteristics of TPWs, the network-level neural computational models need to be constructed, which represent the interaction of multiple neural populations located in different cortical areas. Therefore, in the future study, the network-level neural computational modeling is a research frontier we are going to follow. It may not only be helpful to simulate morphology of TPWs similar to the real TPWs, but also may provide novel insight for understanding the arising of TPWs in AHE-EEGs.

5 Conclusion

The computational model proposed herein provides a mechanistic account, albeit partial, of the generalized periodic discharges seen in AHE, known as triphasic waves. Our model is based on three modifications of the well-studied Liley model that are believed central to brain dysfunction in AHE: increased neuronal excitability, impaired synaptic transmission, and enhanced postsynaptic inhibition. Then we introduced a model parameter optimization method based on particle filtering (PF-POM), by combining the feature extracted from AHE-EEGs, namely the distribution of inter-TPW intervals. Finally, we applied the proposed approach to EEG data from AHE patients, performing the following investigations: (1) verification of the ability of the three mechanisms added to the Liley model to produce periodic discharges of various frequencies; (2) performance of the ability of the PF-POM method to estimate the parameters of simulated EEGs generated by AHE-CMs; and (3) investigation of how features of real AHE EEGs relate to mechanistic processes and parameter values in the computational model. By combining model-driven and data-driven approaches, our approach not only reproduces important aspects of the EEG, but also suggests mechanisms underlying variation in EEG patterns in AHE. In particular, our model provides a mechanistic explanation for why more severe AHE results in TPWs of higher frequency.