{'fraction_non_alphanumeric': 0.027861069465267365, 'fraction_numerical': 0.009870064967516242, 'mean_word_length': 4.88265556099951, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Information of Epileptic Mechanism and its Systemic Change-points in a Zebrafish's Brain-wide Calcium Imaging Video Data

The epileptic mechanism is postulated as that an animal's neurons gradually diminish their inhibition function coupled with enhanced excitation when an epileptic event is approaching. Calcium imaging technique is designed to directly record brain-wide neurons activity in order to discover the underlying epileptic mechanism. In this paper, using one brain-wide calcium imaging video of Zebrafish, we compute dynamic pattern information of the epileptic mechanism, and devise three graphical displays to show the visible functional aspect of epileptic mechanism over five inter-ictal periods. The foundation of our data-driven computations for such dynamic patterns relies on one universal phenomenon discovered across 696 informative pixels. This universality is that each pixel's progressive 5-percentile process oscillates in an irregular fashion at first, but, after the middle point of inter-ictal period, the oscillation is replaced by a steady increasing trend. Such dynamic patterns are collectively transformed into a visible systemic change-point as an early warning signal (EWS) of an incoming epileptic event. We conclude through the graphic displays that pattern information extracted from the calcium imaging video realistically reveals the Zebrafish's authentic epileptic mechanism.


INTRODUCTION
Epilepsy is a neurological disorder in the brain characterized by recurrent, unprovoked seizures. As the most common type of epilepsy, idiopathic epilepsy has no identifiable cause. Nowadays, idiopathic epilepsy is still not preventable. To better prevent epilepsy, it is essential to understand the underlying mechanism that the central nervous system (CNS) change leads to epileptic seizure. However, this seemingly natural research direction has not prevailed in literature.
Early works on epileptic seizure prediction are mainly based on Electroencephalography (EEG) data. For example, Rogowski et al. [17] applied autoregressive model on 8-channel EEG signal recorded from 12 epileptic patients and claimed the trajectory of some prediction coefficients during pre-seizure period could predict epileptic seizures by several seconds. Salant et al. [18] detected EEG changes using multivariate spectral estimation on 2-channel EEG signal and used coherence and pole trajectories to predict epileptic seizures. Some other studies tried to predict epileptic seizure using spike occurrence rates in the EEG [9][10][11][12]. As an example, Le Van Quyen [15,16] later developed dynamical similarity index and found decrease in dynamical similarity, compared to a pre-ictal reference constant, before seizures.
While these studies only focus on pre-ictal period, not inter-ictal period, Navarro [14] showed that similarity measure drops more frequently in pre-ictal period than inter-ictal period. Aschenbrenner et al. [1] also found that there is no significant difference in dimension drop between pre-ictal and inter-ictal period. On the other hand, many research work explored the localized epileptic channels [4,6,7,12,13] and showed that the remote channels could carry relevant information about epileptic seizures. Using EEG recordings from a small group of patients with mesial temporal lobe epilepsy, people could predict seizure onset around 20 minutes in advance, but recording EEG signal requires continuous and invasive intracranial recordings. EEG recordings are only from limited number of channels, the underlying neuron network is hard to capture. Hence, it is curial to systemically study the epileptic mechanism to identify and predict the epileptic seizure.
Generally, the epileptic mechanism is heuristically postulated as that a large number of neurons experience decreasing inhibitions and increasing excitations simultaneously on the road to an epileptic event. However, there is no existing visible evidence on such mechanistic characteristics reported in literature yet. Meanwhile, if epileptic event is a collective behavior of neurons in CNS, epileptic mechanism should be better manifested through large number of neurons, rather than a small number of channels. Further aforementioned analysis methodologies are primarily based on modeling the EEG time series, instead of focusing on extracting authentic information pertaining to the epileptic mechanism. To address those problems, one recent advance in brain-wide calcium imaging has made possible to graphically reveal collective patterns of epileptic mechanism. Particularly, the calcium imaging technologies are equipped with higher sampling rate than functional magnetic resonance imaging (fMRI), and produce a more precise brain-wide imaging than limited number of EEG electrodes.
In this paper, we study the epileptic mechanism using a zebrafish's brain-wide calcium imaging video data. The larval fish is immersed in a drug that induced epileptic event, mimicking epilepsy. The high-speed confocal microscopy is used to image larval zebrafish. In contrast with EEG recording from limited number of channels, the calcium imaging video data is capable of monitoring brain-wide network activity using non-invasive monitor. We first reduce the video data dimension using K-variance method. Upon each selected pixel, we devise a progressive quantile-statistics to show individual pixel's mechanistic patterns while an epileptic event is approaching. Then we accordingly encode the calcium fluorescence intensity time series into a digital series as a way of re-normalizing all time series data. This is one essential step for graphically revealing epileptic mechanism on the overall global scale.
We then aggregate digital encoded recording from each pixel into a matrix. This matrix representation clearly and naturally demonstrates the evolving systemic patterns from the beginning to the end of inter-ictal period. We then compute all local linear trends upon all pixels' progressive quantile-statistics along the temporal axis within each inter-ictal period via a moving window. Finally, we develop an algorithm to collectively summarize all local trends into a time series that could successfully reveals a critical systemic change-point, and then predict the onset of next epileptic event.
The remainder of the paper is organized as follows: We introduce the data set and data processing in Section 2. We present our methodologies in Section 3. In Section 4, we show results to validate our findings. We conclude this paper in Section 5.

DATA PROCESSING
In this section, we first introduce the video data, then present Kvariance method to reduce the dimension of the data, and show the two key components: progressive quantile statistic to reveal pixel-wise epileptic patterns and digital encoding to standardize calcium fluorescence intensities.

Data
The epileptic mechanism is heuristically postulated as that a large number of neurons experience decreasing inhibitions and increasing excitations simultaneously on the road to an epileptic event. Biologically, neurons convey information using spikes [8]. To measure neural activities, medical imaging technologies are developed to create visual representations of the interior of a body for clinical analysis and medical intervention [2,3]. Particularly, two-photon imaging of calcium indicators, which is designed to show the calcium status of an isolated cell, are used for monitoring the neuronal activity in hundreds of distinct neurons [5,19]. To study the epileptic mechanism, we use a zebrafish's brainwide calcium imaging video data from Epilepsy Research Laboratory at University of California, San Francisco. To collect the imaging data, a well characterized seizure induction protocol, Pentylenetetrazol (PTZ), is used in the experiment. PTZ is a common convulsant agent to induce epileptic seizures. The larval fish is immersed in PTZ to mimic epilepsy. The high-speed confocal microscopy is used to image larval zebrafish, and electrical discharge is recorded by calcium fluorescence intensity (CFI). As an example, one frame of the video data is shown in Figure 1. In contrast with EEG recording from limited number of channels, this data is capable of monitoring brain-wide network activity using non-invasive monitor.
The frame rate of the video data is 6.7Hz, and there are 2000 frames in total. The resolution for each frame is 256 * 256. Thus, the video consists of 2 16 pixel-specific CFI time series.

Dimension Reduction
Our Zebrafish's brain-wide calcium imaging video data contains total 2000 frames of 256 * 256 images. Among 256 * 256 pixel-specific time series, we observe two main types of pixels based on their CFI trajectories. Figure 2 shows two distinct CFI trajectories. Panel (a) of Figure 2 shows a CFI series of one pixel taken from the body part of zebrafish, and panel (b) shows a CFI trajectory of one pixel taken from the brain of zebrafish. The location of those two pixels are marked in Figure 1. The CFI trajectory in panel (a) has nearly no fluctuation between spikes, and only spikes can be clearly seen. In other word, CFI series like panel (a) only reflects epileptic seizures. On the other hand, the CFI in panel (b) not only reflects epileptic events, but also gives out high fluctuation across each inter-ictal segment.
Two types of CFI series share one common feature: spikes that indicate epileptic seizures. The difference is the fluctuation during inter-ictal segments, which is essential to reveal the connectivity among neurons in CNS. The fluctuation between epileptic seizures can be used to discover interacting relations with other pixels and the dynamic mechanism leading to epileptic seizure. For the purpose CFI series of non-informative pixels could be used as a basis for partitioning and separating inter-ictal segments from whole time series. We randomly pick up ten pixels from zebrafish body. Then we build empirical distribution of its CFI for each pixel, and choose 70 t h percentile as a cut-off point. Time points with intensity greater than 70 t h percentile are labeled as epileptic seizure. Then we decide the overall epileptic seizure time based on consensus voting. Totally we have five inter-ictal segments since we combine the three consecutive spikes as the 4 t h epileptic seizure and treat the last segment as inter-ictal segment.
To pick up informative pixels, we develop a K-variance method. 15 pixels from zebrafish body are randomly picked up and partitioned into five inter-ictal segments. Intensity variance for each pixel during five inter-ictal segments For inter-ictal segment j, the mean of 15 variances v i j , i = 1, · · · , 15 is taken as the baseline V j . Then we go through the CFI series of all 256 * 256 pixels, and partition them into 5 inter-ictal segments, calculate intensity variance, and compare with the baseline for each segment. If variances for all segments are greater than   16 CFI series (marked with k = 1). The dimension of data is reduced to 2948 CFI, and the target area is narrowed down to the brain of zebrafish instead of the whole body.
To get a even smaller target area, we increase the lower bound V j to k * V j , j = 1, · · · , 5. With greater k, less pixels are collected as informative, and target area is narrowed down to the optic tectum. Figure 3 shows the number of pixels that are picked up using K-variance algorithm. When k is increased to 10, we have 696 informative pixels, and our target areas mainly focus on spinal trigeminal (SpV) neurons and Neuropil.

Progressive Quantile Statistics
Inhibition and excitation functionality of neurons are represented by CFI values in our video data. High intensity value indicates excitation while low value shows inhibition. As one pixel in optic tectum possibly involves more than one neuron, the inhibition and excitation that we discuss in this paper are meant to be surrogates of the biological ones. When neuron system experiences intense inhibition, less neurons are active around one pixel at time t, which result in its CFI value is more likely to be low, or even in the trough overall. Therefore, we use a trough or a relatively low value of CFI as a surrogate for a pixel experiencing inhibition at time t, while a peak or a high value for excitation.
To discover the decreasing inhibition and increasing excitation mechanics, we propose to use a progressive quantile statistics. For i th pixel, we have a CFI series S i (t), 0 < t < T , recorded from t = 0 to a time point t, where t = 0 is the beginning of inter-ictal segment, and T is the end of inter-ictal segment, which is also the onset of next epileptic seizure. Let D i (t) be the cumulative empirical distribution of S i (t), and we use D −1 i (0.05|t) to denote empirical 5% quantile of D i (t) at time t. Figure 4 shows a typical trajectory of D −1 i (0.05|t) in our epilepsy setting. The initial bumpy period actually occurs in both epilepsy and control setting. On one hand, this is because the time is too short for D −1 i (0.05|t) to be stable around the beginning of inter-ictal segments. On the other hand, D −1 i (0.05|t) being dragged down during bumpy period is due to functioning inhibition, which produces low CFI value.
After the bumpy period, if inhibition and excitation function of neuron system works concordantly, as in the control setting, we would expect to see that the progressive D −1 i (0.05|t) converges to a constant value. This is indeed confirmed in control fish settings, as reported in the companion biological report. If the system gradually loses inhibition and gains only excitation, then the cumulative D i (t) would has more high value coming in but no low value, which would result in an increasing D −1 i (0.05|t). This is actually the case of epilepsy setting as shown in Figure 4.
The progressive quantile statistic D −1 i (0.05|t) trajectory is coherent with the mechanistic pattern leading to an epileptic event during inter-ictal segments. Based on this pattern formation, we could conclude that the 696 pixels are all informative for this zebrafish's epileptic mechanism.

Digital Encoding
Among 696 pixels, the range and scale of CFI series are really different. To standardize CFI series, we apply a digital encoding scheme on CFI series as following. For each pixel, we compute empirical distribution of the intensity series, partition the histogram into 3 sub-regions, and encode 3 sub-regions in a monotonic fashion as shown in Figure 5 (a). We choose to encode raw CFI series into 3-digit coding {1, 2, 3}. The intensities that are less than its lower 5% quantile in CFI series is coded as 1 in our digital coding, intensities that are greater than its upper 5% quantile, that is 95% percentile, is coded as 3, and the rest of intensities falling between lower and upper 5% quantiles are coded as 2.
Our triplet-encoding not only standardize all CFI series, but also retain information of inhibition and excitation mechanics within each pixel-wise CFI series. As shown in Figure 5 panel (b), the tripletencoding could capture peak and trough, which represent excitation and inhibition. Thus, each pixel's CFI series is transformed into a triplet-encoding sequence for five inter-ictal periods.

METHODS
In this section, we first aggregate the digital encoding series of 696 pixels to discover the underlying epileptic mechanism, then detect the systemic change-point based on the changing pattern in CNS during inter-ictal period. Based on the systemic change-points, we develop an algorithm to predict the next epileptic seizure event.

Digital Encoding Series Aggregation
To explore the common pattern that all informative pixels share, we aggregate 696 digital encoded sequences into a heatmap. Specifically, we index the pixels, and each row in the heatmap represents the digital encoded series for one pixel. The streaming imaging data shown in Figure 1 is summarized into a matrix. The vertical axis is the pixel index and the horizontal axis shows the CFI change in time domain. As shown in Figure 6, we conduct the aggregation for five inter-ictal segments. From the heatmaps of different segments, we have several observations: • There are clearly two different parts in all five heatmaps, upper part and lower part. According to the pixel arrangement, the lower part are from the left half of tectum, and the upper part are from the right half of tectum. With respect to temporal axis, both parts of tectum share similar patterns of blue and yellow dots. With respect to spatial axis, the neuron activities are somehow staggered between left and right part of tectum. • The aggregation pattern of yellow dots implies synchrony among nearby neurons. • The blue-dot-clouds are more intense during the beginning half of inter-ictal segment, and gradually disappear when next epileptic seizure is coming.
The third systemic pattern is proved very informative in next section.

Systemic Change-point Detection
As revealed in the heatmaps, more blue dots are around the first half of the inter-ictal segments but gradually disappear in the later half of segments. One way to summarize this pattern is to count blue dots along the temporal axis. Figure 7 shows the blue points count series for five segments. All five count series share a common feature, they all have recurrent cycles in the first half segment but their cyclic pattern seems to disappear afterward. The clear pattern difference between the first and second half of inter-ictal segments manifests the neuron system has changed. At the meantime, in each inter-ictal period, the disappearance of recurrent cycles of blue points count strongly indicates that there is a systemic changepoint involved, and the change-point is located in the middle of the period. If we could detect the systemic change-point, then we would be able to predict next epileptic seizure.

Epileptic Seizure Prediction
To predict a change-point for a time series, we apply progressive type of statistics, such as D −1 i (0.05|t), the progressive quantile series. In section 2.3, we show the pattern for D −1 i (0.05|t) pixel-wise. For the majority of pixels, their progressive quantile series would result in an increasing trend after systemic change-point. To capture such pattern change of progressive quantile series among 696 pixels, we implement local linear regression with a moving window to measure increase and decrease trend of quantile series. Specifically, Hence, for each 696 pixel, its progressive quantile series D −1 i (0.05|t) is transformed into a trend series {−1, 0, 1}. Then we aggregate 696 trend series in a heatmap, as shown in Figure 8 panel (b). The heatmap again shows that the majority of decrease trend appears in the beginning of inter-ictal segment and gradually disappears. To summarize this pattern change, we calculate the increase(decrease) proportion in time domain, which is the number of pixels that have positive(negative) regression slope over 696 pixels. The panel (a) of Figure 9 shows that the overall decrease trend could form cyclic pattern during the first half inter-ictal segment and the cyclic pattern gradually disappears approaching next epileptic event. We could observe similar results for increase trend. The disappearing cyclic pattern for increase(decrease) trend manifests that the system has changed. Therefore, one reasonable method for detecting the systemic change-points is to trace the time point when the increase or decrease trend loses its cyclic pattern.
To accurately detect the systemic change-point, we compute the increase to decrease ratio, as shown in panel (b) of Figure 9. The increase to decrease ratio indeed enlarges the contrasting difference of cyclic pattern change. Figure 9 panel (b) shows that there is a dramatical spike in the middle of inter-ictal period. This spike rightly indicates the systemic change-point. Before the high spike, the ratio has slight fluctuations occasionally. However, after the high spike, the ratio is no longer stable. It strongly fluctuates and forms multiple significant spikes. To successfully locate the high spike, we calculate three standard deviations of the mean of ratio series for five segments, and set the average 582 as the threshold. Thus, our predicted systemic change-pointT SC P is the time point when the increase to decrease ratio series first reach 582.
Once the systemic change-point can be predicted, it is feasible to predict epileptic seizure. Based on blue points count series in Figure  7, we know that the systemic change-point T SC P is estimated in the middle of the inter-ictal period, which means we could predict epileptic event time T by 2 * T SC P . The increase to decrease ratio gives the estimated systemic change-pointT SC P , then 2 * T SC P is our predicted time for next epileptic eventT .

RESULTS
To evaluate the prediction performance of systemic change-point T SC P , one way is to check if the system actually changes after the change-point. To do so, we markT SC P andT on the ratio series and digital encoding heatmap for another inter-ictal segment, segment 2, in Figure 10. The ratio series in panel (a) has nearly no fluctuations before predicted change-pointT SC P , but forms dramatic spikes afterwards. The patterns of ratio series before and afterT SC P are clearly different. The heatmap in Figure 10 panel (b) also shows the pattern difference before and after predicted change-point. As we can observe in the heatmap, there are alternate blue and yellow points beforeT SC P , but blue points gradually disappear while the intensity of yellow points gradually become higher afterT SC P . Figure 10 also shows the epileptic seizure prediction result, with predicted event timeT and true event time T marked on ratio series and digital encoding heatmap. In general, our predicted event time is 2.24 seconds (4.82 % of the segment length) earlier than the actual event time. The prediction results for all inter-ictal segments are summarized in Table 1. The predicted systemic change-pointsT SC P and predicted event timeT are marked on the blue points count series in Figure 11 as well.

CONCLUSION
Techniques of data driven computing and graphic display are devised to coherently represent systemic patterns of epileptic mechanism based on one Zebrafish's brain-wide calcium imaging video. Our data-driven computing via the pixel-specific progressive quantile process successfully extracts authentic information content that   is pertinent to the target epileptic mechanism. This aspect is rather distinct to classic modeling methodologies developed for analyzing EEG data.
Such a progressive quantile statistics then motivates a triplet digital encoding scheme to renormalize all selected informative pixels' calcium intensity time series into digital sequences. Within each inter-ictal period, all digital sequences collectively reveal the clear systemic patterns of wax and wane of inhibition and excitation along the temporal axis. Very importantly a systemic change-point is observed evidently. Such a visible change-point during the evolving processes of troughs and peaks of original calcium intensities belonging to all pixels could be rather difficult to visualize due to their volatility in values and in ranges.
Further we discover that the increasing and decreasing trends of progressive quantile series also collectively recover the systemic patterns of triplet-digital encoding sequences within each inter-ictal period. We then devise a systemic change-point estimation, which, as an early warning signal, can capture rather well the arrival time of incoming epileptic events. Throughout this paper, the graphic displays constantly play a central role of fostering understanding of information contained in the video data. Such understanding not only can help biologists and neuroscientists to discover new insights, but also help computing scientists to be sure that right information contents are extracted.