Parametric Modeling and Deep Learning for Enhancing Pain Assessment in Postanesthesia

Objective: The problem of reliable and widely accepted measures of pain is still open. It follows the objective of this work as pain estimation through post-surgical trauma modeling and classification, to increase the needed reliability compared to measurements only. Methods: This article proposes (i) a recursive identification method to obtain the frequency response and parameterization using fractional-order impedance models (FOIM), and (ii) deep learning with convolutional neural networks (CNN) classification algorithms using time-frequency data and spectrograms. The skin impedance measurements were conducted on 12 patients throughout the postanesthesia care in a proof-of-concept clinical trial. Recursive least-squares system identification was performed using a genetic algorithm for initializing the parametric model. The online parameter estimates were compared to the self-reported level by the Numeric Rating Scale (NRS) for analysis and validation of the results. Alternatively, the inputs to CNNs were the spectrograms extracted from the time-frequency dataset, being pre-labeled in four intensities classes of pain during offline and online training with the NRS. Results: The tendency of nociception could be predicted by monitoring the changes in the FOIM parameters' values or by retraining online the network. Moreover, the tissue heterogeneity, assumed during nociception, could follow the NRS trends. The online predictions of retrained CNN have more specific trends to NRS than pain predicted by the offline population-trained CNN. Conclusion: We propose tailored online identification and deep learning for artefact corrupted environment. The results indicate estimations with the potential to avoid over-dosing due to the objectivity of the information. Significance: Models and artificial intelligence (AI) allow objective and personalized nociception-antinociception prediction in the patient safety era for the design and evaluation of closed-loop analgesia controllers.

M ODELING for control of anesthetic states is a potent tool accelerating the individualization path in personalized medicine while enabling optimal control algorithms being deployed in interdisciplinary applications [1].Efforts to objectively quantify the rather subjective pain sensation in communicating patients and to extract helpful information have existed for decades, but the breakthrough was delayed by a lack of trust and endorsement of technological progress [2].Recent developments in decision-support cyber-physical systems for drug delivery management and protocols motivate the need for closing the loop with feedback from a specific nociception monitor during the anesthetic state [3].In particular, inputoutput parametrizations increase the ability to predict pain for optimization in advanced control strategies such as predictive control, thereby mimicking clinical expertise and practice [4].Hence, mathematical models give new opportunities for the design and evaluation of closed-loop anesthesia controllers [5].Multiple control strategies have been proposed in literature for anesthesia [6], [7].However, modeling pain pathways did not capture the main focus of the systems and control community until only recently, the witness being the scarce literature reports on the topic: merely 31 relevant articles [8].Of the few mathematical modeling attempts, the seminal gate control theory of Melzack and Wall [9] was later revisited in the mathematical analysis of Britton and Skevington [10].Some attempts were further proposed by Xu et al. [11] and Cecchi et al. [12].Given the uncertainty, lack of labeled data and large physiological complexity, artificial intelligence computational tools such as machine learning algorithms can also detect the presence or absence of pain.
Machine learning emerged into pain research for its capability to process data sets largely available in medical applications [13], [14].Endorsed by dynamic physiological variability, automatic pain recognition outperforms traditional, rather subjective assessment tools.It employs a monitorization that is continuous, objective, and more sensitive to even slight variations in pain-related threshold levels.Publications focused on this research direction highly differ by the use of several paindescriptive features in machine learning algorithms to classify pain in different contexts -both in clinics and in day-to-day environment -for a multitude of pain/analgesia diagnostics [15], [16].Hitherto, many of the previous studies [14] have been exploratory on healthy adults and experimental pain stimulation, lacking validation significance in clinical contexts [17].We overcome this need by using data acquired in postoperative patients, where the personal subjective influences on pain experience are considered through the self-reported NRS.Moreover, in [14], 70% of all reviewed works have used facial expression as the modality for pain recognition, with electro-dermal activity (EDA) the second-most used that stands out with the best performance.Our dataset contains measurements of voltage and current signals, correlated to EDA.
Approaches to real-time data acquisition are of utmost importance in postoperative pain management as it has the potential to avoid under-and over-dosing of pain medicines [18].To this end, questions of great interest have been raised about the commonly used subjective patient-reporting tools, opioid prescriptions, postoperative pain management, and objective pain monitors based on surrogate endpoints [19], [20].Several objective monitors have emerged to improve the subjective standard methods to assess pain [21].A core topic has been the analgesia/nociception monitoring for opioid guidance, both peri-and postoperatively, inconclusive yet in terms of common use or preferred device in practice [22].Moreover, these are population-based solutions, yet one must acknowledge that patient-specificity is needed in personalized analgesia and anesthesia management.Lookup tables or ad-hoc drug infusion rates used in hospitals mainly rely on clinical judgment, often not accounting for the intra-patient nociception variability happening during surgery, which drives the analgesia state.In contrast, the variability is directly managed by personalized model-or AI-based methods, identified or retrained in real time.
In this study, mathematical modeling and deep learning classification of pain measured during postanesthesia care unit (PACU) recovery are used to determine whether the timefrequency analysis of electro-dermal activity maps better on to pain intensity self-reporting data.This work proposes a novel methodology for a parametric recursive identification of postoperative data using our previous physiological fractionalorder parametric model [23].Furthermore, this work explores the added value of using spectrographic-based CNNs for personalized classification/scaling of postoperative pain, through objective pain related 3D images.Online data processing is motivated by the changing states of the physiological system throughout PACU residence time, as post-surgical nocieption evolution is both a time-and a frequency-domain varying system.Our methodology involves online model adaptation, leading to model calibration per each patient over the postoperative period.Consequently, the online model identification and CNN retraining enable the predictions of variations in trending slopes of nociception-related signals in real time while being computationally friendly.The innovative step in the pain management methodology is that the recursive algorithm used for the data identification allows online adaptation of the parameter estimates.Additionally, the clinical data enables the exploitation of the medication information, for comparing the predictions of the estimated model evolution versus the actual golden standard NRS trend after the moment of receiving opioids.This model can then be included as part of a model-based control scheme where drug dosages can be optimized for each patient and in real-time.
The research hypothesis states that changes in identified parameters of parametric bioimpedance models or in EDA spectrogram-CNN classification are correlated with skin properties and postoperative pain, i.e., early predictions of variation in the nociception levels.Based on our prototype, we could extrapolate that the electrochemical events of nociceptive transmission can be pre-detected in the frequency response before they are cognitively perceived by a person [24].In this context, the NRS is a subjective demonstration of pain sensation.This article also investigates the effect of opioids on the models values.The end significance relies on the drug usage optimality, generating the novelty of research in terms of opioid intake linked to the measured analgesic effect.

A. Physiological Data From Postoperative Patients
The physiological data used in this work is available from our observational trial conducted on awakening, postoperative patients [25].For this work, we analyzed partial data from pain measurements from 12 patients monitored during the postoperative recovery period after general anesthesia, with their biometric details given in Table I.The pain was assessed continuously by the pain monitor for 140 minutes, and every 7 minutes the patients subjectively reported their pain using the golden standard in clinics, namely NRS.Standard care and medication were decided by the nurse.Our primary publication [25] has reported details on the entire study design and clinical investigation protocol and results.The study was approved by the Ethics Committee of Ghent University Hospital (EC/2017/1517, 2018, PI: M. Neckebroek), registered at clinicaltrials.gov(NCT03832764, 2019).Each patient has signed a written informed consent before enrolment.

B. Measurement System and Signal Processing
The time and frequency bioimpedance monitor device used for data acquisition during the clinical trial was the prototype Anspec-PRO (Ghent University, Ghent, Belgium) [24], approved for research by the Federal Agency for Medicines and Health Products Belgium (FAGG) no.AFMPS/80M0707, 2018.Once tested in an experimental setup on awake healthy subjects having thermally-and mechanicallyinduced acute pain [24], Anspec-PRO monitor has also been successfully validated to detect clinical postsurgical pain [25].
In postanesthesia pain, the incision-induced activity is characterized by distinct pharmacological and pathophysiological mechanisms compared to acute pain (felt at the moment of injury).Hence, the nociceptor activity is triggered by the conversion of the stimulus energy into an electrical signal and its transmission into the body, through the voltage-gated ion channels, nerve endings, etc.However, a noxious stimulus leads to action potentials in nociceptive fibers that propagate not only to the central nervous system but also antidromically into peripheral branches [26].These changes in the signalling pathways could be detected by measuring the bio-electrical-impedance.The core Anspec-PRO methodological principle is based on measuring the skin current and voltage signals after inducing a multiple-frequency voltage input (1) into skin [24], apriori designed having the form: where t is the time variable, A N f [V] represents the amplitude, φ N f [rad] the phase and ω N f = 2πf N f [rad/s] the angular frequency of each sinusoid.The multisine is then a sum of sinusoids having the number of frequencies N f = 1 . . .29, for the frequency range f = 100, 150 . . .1500 Hz linearly distributed over 29 points.The excitatory electrical signal is then modulated by the variations of the signaling conditions originating from nociception effects throughout the body and implicitly the skin.Three electrodes are placed on the patient's palm hand, where changes in electrical permeability are detected [27].As the skin tissue is frequency-dependent on the excitatory alternating electrical signal, the modeling of the biological response is empowered by the availability of the frequency response function from Anspec-PRO.Moreover, this frequency response presented as spectrograms endorses a CNN to enable feature extraction based on data-driven learning.
For converting the time vectors (i.e., multisine u(t) [V], current c(t) [C] and voltage x(t) [V] signals) in the frequency domain, the spectral power density function with modified averaged periodogram method is used [28].The measured data from one patient with a number of samples per minute N = 900.000samples had a sampling frequency F s = 15 kHz and a sampling time T s = 1/F s .It was divided into p sequences of equal length L = N/p, for a frequency resolution bandwidth of 50 Hz.The total measured data for one patient was then T m = N • 140[min] samples.To minimize the effect of leakage frequencies introduced by signal discontinuities, each discrete-time domain sequence u i (n), x i (n) and c i (n) was filtered by an appropriate windowing function w(n) (i.e., Blackman window filter), with the digital time t = nT s , n = 0 . . .N − 1 and the sequences i = 1 . . .p.The frequency components of the current and voltage signals were returned via the Fast Fourier Transform (FFT) for each discretized sequence U i (jω), X i (jω) and C i (jω).The sampled sequences had the angular frequency discretized to ω = 2πf T s = 2πk/N [rad/sample], with f = kF s [cycles/sample] the digital frequency and k = 0 . . .N − 1 the index of the frequency component in the FFT.After introducing a scaling factor B = 1/L L−1 k=0 ω 2 (k), the complex cross-spectrum function was applied to each modified periodogram P i , as follows: with X * i (jω), C * i (jω) the complex conjugated functions for the sequence i = 1 . . .p, and j = √ −1 the imaginary unit.U (jω) [V] denotes the offline designed excitatory input, X(jω) [V] is the actual voltage measured over the skin impedance and C(jω) [A] is the measured current running through the skin, all signals digital.The final estimate is then obtained by averaging over the modified periodograms P i : All signal processing was performed in Matlab-Mathworks.From here, the data was processed differently for each algorithm employed in this article as follows: 1) Modeling Data Preparation: Consequently, a vector of the complex skin impedance Ẑ(jω) was computed as the ratio of the cross-power spectrum of the measured signals: for each minute m = 1 . . .140 with the discrete-time angular frequency ω a vector containing the 29 excited frequencies from (1).Notice that both the known multisine excitation signal u(t) and the unknown nociception stimulus are inputs to the system to be characterized by a parametric model and its estimated coefficient values.The impedance vector was obtained from (4) every minute for each patient.For the entire postoperative period of the 140 monitored minutes, the described modified averaged periodogram method was repeated for each consecutive minute, resulting in a matrix of Ẑ(jω, t) for each patient.Before the recursive identification, the bioimpedance dataset Ẑ(jω, t) was mapped into 7-minutes moving windows: corresponding to the int th interval, int = 7 . . .140.The signal processing data interval uses a 7-minutes moving window to process data recursively and moves forward 1 minute of data at a time, therefore its content overlaps over the remaining past 6 minutes with the past estimation data segment.Fig. 1 illustrates the moving window algorithm, using ( 4) and ( 5) for the definitions of Ẑm (jω) and Ẑint (jω), while t 1→134 is representative for the regression vector calculated in (8).The data signal interval was chosen to incorporate 7 minutes because of the pain NRS reporting interval length.

2) Classification Data Preparation:
As the inputs of the CNN are spectrograms of the product of current and voltage signals, then the electrical power Ŵsec (jω) at skin level was calculated:

1) Model Formulation:
The frequency response data estimated with (4) can now be used to identify a parametric model.Our prior work demonstrated the potential of FOIMs in detecting and analyzing nociceptor stimulation followed by related tissue memory effects in awake and aware healthy individuals in [23] and to model transmission in signaling pathways [29].The physiological pain dynamics are directly linked to the electrical properties exhibited by a tissue (time and frequency variable systems) [26], which are captured as impedance measurements.
The lumped FOIM model proposed in [23] considers the core working principles of the nociception system.The nociceptive pathway starts with the transduction of noxious stimulation by nociceptors, following the transmission of the neural activity as action potentials along the peripheral sensory nerves.The transduction in surgical trauma also involves an inflammatory response, causing the depolarization of the nociceptor's membrane.Excitable membranes could be represented by a resistance-inductance-capacitance (RLC) circuit.The membranes can be thought as capacitors, i.e., the insulating lipid bilayers surrounded by conductive electrolyte solutions, while some ion channels can provide inductance-like properties [30].From here, the transfer of information throughout the spinal nociceptive circuits is under powerful inhibitory and facilitatory control.This pain modulation that is present only because the patients are awake, is highly dependent on the plasticity induced in the spinal nociceptive pathways, including the anti-and pronociceptive output from the brainstem's bidirectional control.Here, combinations of models essentially based on exponential and power-law functions are likely to represent the modulation of the electrical activity.Finally, the central perception processes the centrally transmitted pain-signaling activity, the patients being conscious.In our study, pain perception is present, as the patients were awake.
To summarize, the lumped FOIM model can be characterized as differ-integral (depending on the sign of the non-rational order), related to the physiological pathway of pain in awake postanesthesia patients.The proposed lumped mathematical model is then: where As this model is based on the physiological pathway of pain, some of the ongoing physiological processes may be impaired.Therefore, some of the terms in the equation might not always be included or sensitive to changes in tissue bioimpedance [23].Opioid administration is expected to affect the parameters values.
2) Identification Methods: The estimation technique used for fitting the bioimpedance dataset was the least squares estimator, implemented in a recursive computation of the parameters estimates for the FOIM model in (7).The search optimization problem was approached through adaptive heuristic search algorithms, namely the genetic algorithm (GA). 3

) Model Initialization -Genetic Algorithm:
To overcome the problem of arbitrary choice of the FOIM's parameters when first time estimated, the GA function ga in Matlab-Mathworks from the Global Optimization Toolbox was initially used for each patient.It solves stochastic global search optimization problems by repeatedly modifying a population of individual solutions.Over successive generations of elite retentions until stopping conditions are met, the algorithm produces the crossover and mutation children optimal set [31].
The initialization procedure started with the first 7-minutes averaged impedance data Ẑint7 (jω) (5) measured in PACU from the patient.Using 10 5 random iterations of the GA, the best-fitting vectors of FOIM parameters were estimated for each patient.Bounders were used for estimating the FOIM parameters, as follows: lower bound 0 for R, P, α 1−3 , and upper bound 1 for the fractional parameters α 1−3 .The model initialization was performed for each patient, resulting in an individually identified set of parameters.In order to choose the global best-fitting solution per patient, we calculated the goodness of fit (gof) of each optimal parameters vectors generated after each GA iteration.The gof values were represented as histograms, knowing to which set of parameters corresponds the gof.The parameters set with the highest incidence were considered for the model initialization in the online procedure for the same patient, having at least the gof<0.1.A fit value gof=0 indicates a perfect fit between the data and the estimated model outputs, giving a fitting percentage equal to (1-gof) × 100.

4) Online Parameters Estimation -Recursive Algorithm:
The online system identification methodology enabled continuously recalculating of the FOIM parameters each time new data became available.This is valuable for model identification in real-time during the monitoring period.For this work, the model was updated periodically, with reference to its past values.Specifically, from the 8th minute to the end of the monitoring period (int = 8 . . .140 moving windows), the impedance Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.ẐFOIM was estimated each minute using the recursive leastsquares system identification with the Levenberg-Marquardt non-linear algorithm, based on the previous data.The Matlab-Mathworks Optimization Toolbox was used for the least-squares estimator, which is one of the simplest estimation techniques, motivated by low numerical aspects of using the least-squares cost function minimization.
The recursive least-squares parameter estimator for fractional-order systems is detailed in Supplemental Text I.A, employing the following equations recalculated each time instant: where θ is the estimated parameter vector, P (t) the covariance matrix of θ(t), ϕ(t) the regression vector, y(t) the measured output, and 0.95 < λ < 1 the forgetting factor.

5) Statistics and Comparisons:
The primary aim of the study was to estimate the components of the model and test the hypothesis they can predict in real-time the changes in bioimpedance originating from surgical trauma.To facilitate comparisons across the model parameters and the self-reported NRS values at the same time points, estimated parameters were presented in boxplots corresponding to an interval of 7 minutes.An important analysis for motivating the individualized parametric optimization was the inter-patient variability.An analysis of variance (anova) was performed for each estimated parameter and the comparison between the patients was evaluated through the multiple comparison test (multcompare), detectable difference: p-value < 0.05.

D. Spectrographic-Based Classification Algorithm
A deep learning method (i.e., learning through pre-labeled inputs) is proposed: a CNN with a spectrogram input and one coded label, based on the self-reported NRS for training the CNN and for evaluating the prediction performance.

1) Training Algorithm:
The CNNs' training algorithm comprises the sequential steps of forward pass implementation, loss function calculation, backward pass implementation, and weight values update, completed during each iteration.The CNN architecture is depicted in Fig. 2 and detailed in the Supplemental Fig. 3. First, the input images pass across the entire network during the forward pass.Since the node weights and filter values were chosen at random when training began, there would be no obvious class preference in the output.Still unable to look at meaningful underlying features yet, the CNN cannot correctly classify the inputs.The loss function is then described as cross-entropy to calculate the difference between the predicted and actual classes.As the loss, which depends on the weight values, should be kept to a minimum, the weight values must be updated in the opposite direction of the gradient of the loss function, which is computed for each layer from the final layer to the first one (backward pass).Finally, to avoid becoming trapped in local minimums, the learning rate (or step size) is then selected suitably.
We tested two approaches aiming to classify in real-time the pain intensity experienced by new patients.The CNNs were evaluated offline and online in different combinations of the dataset, as presented in Supplemental Text II.
2) Offline Training and Testing: At this stage, the assumption was that a full postoperative dataset was available to process.The CNN was trained offline using different datasets: spectrograms generated for the 140 minutes monitoring period of the best/worst/all patients and the first 25%, 50%, 75% of this interval for all patients (to check the limitations of the prediction potential when less data is used for training).The spectrograms were generated every 5 s (respectively 20 s for the dataset containing all patients).The CNN was trained on the following labeled spectrograms, randomly chosen and equally obtained for each class: 336 (for worst patients), 420 (for best), 670 (for all), 756 (for 25% procedure), 1512 (for 50%), and 2000 (for 75%).The grouping of patients into 'best' or 'worst' was decided based on the correlation analysis between the NRS and the pain index calculated using Anspec-PRO data [25] (Supplemental Table I).
The training continued for 30 epochs, as the training data was used multiple times and then shuffled into new batches every epoch.The stochastic gradient descent iterative optimization was implemented with a 0.9 momentum and a learning rate of 0.0001.
The testing of the CNNs was performed on the patients not included in the training, hence on 10% from the training data corresponding to 'worst', 'best', and 'all patients' procedures, and on the remaining percentages for the 25%, 50%, and 75% procedures.For short training computation times, the pain-level estimation was based on a spectrogram generated every minute, leading to 140 pain estimates per patient.The images generated for 7 consecutive minutes received the same label (NRS) during the training, following the patient's reporting interval of 7 minutes from the clinical protocol.To lessen the influence of potential outliers, a moving average of 7 estimations was implemented.The offline procedure is summarized in Supplemental Fig. 4.
3) Online Retraining and Testing: Having available the 3D featured data, monitored continuously by Anspec-PRO device [24], the pain level could be estimated in real-time by an online analysis.To evaluate the ability of the AI system to personalize the pain prediction across patients, we used the offline trained architecture on the best patients dataset and retrained it online on the rest of the patients.Freezing layers 1 and 2 during retraining, the filter values remained fixed in the convolutional layer and only weights in the subsequent layers were updated.This step intended the network to use the already learned pain-related features and not become unfavorable sensitive to patient-specific features.The learning rate was lowered to 0.00001 to avoid the possible impact from individual corrupt spectrograms.For testing the online procedures, the pain was predicted using a spectrogram generated every 10 s, with a moving average of 30 s (to overcome high fluctuations).The CNN was retrained every 7 minutes, when the NRS was available from the patient for labeling the latest spectrograms and adding them to the training dataset.The online analysis is summarized in Supplemental Fig. 5, 2 procedures being tested: r Using cumulative data from all past spectrograms, gain- ing the advantage of training from a bigger dataset.For retraining, 10 random spectrograms per label from the new dataset were combined with 60 random spectrograms per label from the dataset recorded until that point.
r Using only the latest batch of spectrograms, instead of keeping all.Otherwise, this procedure is similar to the previous one, but the calibration of the CNN training set was done only on the latest interval.

4) Evaluation Metrics:
The comparison metrics are the receiving operating curves (ROC) and confusion matrices.ROCs are calculated using sensitivity (true positive predicted value rate TPR) and false-positive rate FPR=1-specificity: where true positive T P is the no. of correctly predicted occurrences of the specific class, positive P is the no. of the genuine occurrences of the class, true negative T N is the no. of correctly predicted absences of the class, negative N is the no. of genuine occurrences of different classes to the specific one.Given the quality of signals and limited dataset, any performance above 65% was considered successful.

A. Fitting Goodness of the Recursive Model Identification
The histograms resulting from the model ( 7) initialization procedure are illustrated in Fig. 3, depicting the underlying shape of the distribution of the goodness of fit gof for two of the patients.The goodness of fit ranged between 0.0015-0.13,with a mean value of 0.0338.The model initialization went forward using the 96.62% fitting.

B. Inter-Patient Variability Requires Personalization
To access the extent of person-to-person variability, the fitting parameters groups were analyzed and showed a significant difference per group.The small p-value indicates the group means are different, but the integral order parameters R, T D, T S, and P are shown in Fig. 4 to have similar means for 80% of the patients.However, this is not the case for the fractional-order parameters α 1−3 , having a different distribution over the entire

TABLE II MEAN VALUES (STANDARD DEVIATIONS ±SD) AND 95% CONFIDENCE INTERVALS (CI) OF THE FOIM IDENTIFIED PARAMETERS
(0,1) range.This is important for the assumption that populationbased models relying on means per group of patients are not able to differentiate between specific individuals.Hence, it requires a personalized approach, i.e., online parameter estimation for an adaptive model per patient.Statistical results are detailed in Table II, indicating a large standard deviation (SD).A patient-specific approach is therefore motivated against population-based models that concentrate on mean values mainly.The mean values of the estimated parameters T D and T S are in the same range, but with different signs.Recalling the FOIM model from (7), T D, T S = C −1 are analogue to the inverse of capacitance.Knowing that a capacitive reactance has the form of X C (ω) = −(ωC) −1 [Ω], then the terms T Ds −α 1 and T Ss −α 2 from (7) could be analysed in relation to it.A capacitive reactance represents the opposition to the change of voltage, probably the change of the biopotential difference generated by the membrane traumaevoked depolarization.Looking at the electrical formula of the capacitance C(t) = i(t) dv(t)/dt , the sign of C is negative if the derivative is negative, hence for v < 0, the graph decreases.A negative derivative means the voltage quantity is decreasing.The voltage has a negative slope during the membrane repolarization when the membrane is brought back to negative values after Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.depolarization within the action potential [32].This occurs when the system of cells returns to its rest state, i.e., when the nociception stimulation/sensitivity starts to decrease.Nevertheless, postsurgical pain has different pathophysiology.Hence, T D is no longer caused by active stimulation, but indirectly by peripheral and central sensitization.It provokes enhanced nerve spontaneous and evoked activity, hence the augmented neural response to postsurgical trauma occurs in parallel to the neural transmission.The T D term in our model may then represent both the sensitization and the ascending transmission pathways activity as well.In addition, the descending transmission is supposed to be modeled by the T S term.Following this, the FOIM terms (+)T D and (−)T S have different signs, as T S is assumed to model the decrease in voltage, hence the opposition to the voltage change, not generating anymore the membrane depolarization during nociceptive sensitization, i.e., T D.

C. Pain Evaluation by FOIM Parameters Faster Than NRS
Following the clinical investigation plan of the observational trial, when one NRS value was reported at intervals of 7 minutes for each patient, the identified parameters were interpreted at the same intervals.Accordingly, for a proper comparison, the variance analyses of each parameter were plotted against NRS in Figs. 5 and 6.The time lag between the self-reported NRS and the identified R, P parameters may be observed for one patient in Fig. 5. Notice that NRS values from intervals 2-4 equalling 0 did not mean zero pain, but the patient was brought asleep in PACU, i.e., no biased values were taken for NRS.For intervals 8, 14, and 17, the R values (left axis) tend to decrease earlier than the patient reports the NRS, represented in the figure by the red stars (right axis).Similarly, NRS trends are delayed in Fig. 6 when compared to the same parameter R, but also with α 2 parameter for other two different patients.This observation may indicate the delay of the subjective method using NRS in postoperative pain evaluation.By contrast, having at hand the pain-modifying impedance measured through Anspec-PRO allows online parametric identification during PACU stay.Hence, the nociception phenomena are assessed until the patient perceives it as pain, as some of the estimated parameters have shown to exhibit more sensitivity to the nociception than the total estimated impedance.However, a sensitivity analysis was not part of these preliminary results due to the low number of samples.
When looking at the surgery type the patients from Figs. 5 and 6 underwent, these were gynecology and urology (Table I), hence the same body location.Nevertheless, other patients having the same surgeries did not show a time lag between the same parameters and NRS.Thereby, no strong correlation could be identified between the surgery location and the parameters' sensitivity for the moment.It also suggests that not only the surgery type is important, but also other patient-specific characteristics.Since the impedance is highly dependent on the fat distribution throughout the body, the body mass index (BMI) would need more in-depth analysis.

D. Tissue Heterogeneity Follows NRS Trends
Having at hand the index of heterogeneity η applied in bioimpedance on a similar FOIM [33], [34], we inferred as well the dermal tissue heterogeneity, assumed to change when nociception occurs.The patient's fluid management would affect the electrochemical phenomena at skin level and postsurgical trauma-evoked hyperalgesia, motivating the heterogeneity index calculation.This has led to the notion that η should increase as the nociception transmission starts, following the sensory nervous system's process activation and sweat glands secretions [26].Consequently, η was calculated and represented every minute in comparison to the self-reported NRS, considered the evidence for our rationale.Indeed, observing Fig. 7, the heterogeneity index η follows the trend of NRS.Moreover, NRS Fig. 6.Variance analysis of the identified FOIM parameters against the self-reported NRS (red stars), R, and α 2 showing earlier than NRS the decreasing pain/nociception trends, on different patients (no.18,22).The long black arrow indicates the infusion of a strong opioid, while the short arrow stands for a light opioid infusion.Fig. 7. Heterogeneity index η calculated every minute and compared against the self-reported NRS (red stars), denoting to be correlated: η follows NRS, but NRS is frequently time-lagged (dashed black arrows).
Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply. is frequently time-lagged, as exemplified in Fig. 7 through the dashed black arrows, suggesting the ability of our method to avoid over-dosing through over estimation of sensory pain.

E. Offline Classification Distinguishes 4 Pain Levels
The offline algorithm was double-validated.First, the validation was performed on the training patients but excluding the precise training spectrograms.The CNN trained on 'best' patients obtained the highest accuracy of 56.55% and the lowest validation loss of 1.6, proving that the selection of the dataset was more appropriate than its dimension for this application.Moreover, the training time was under 3 minutes for this CNN, which is an essential aspect when using it in the real-time classification of pain intensity.The second task was testing the CNN for accuracy, using spectrograms from all patients or untrained patients.As expected, the CNN trained on 'all patients' achieved the highest test accuracy, 73.08%.The validation, test results an computational times of each procedure implemented for the offline estimation of pain levels are overviewed in Supplemental Table II.
To verify the feasibility of using CNNs for detecting pain levels, we tested whether the CNNs could distinguish between 4 levels of pain.Fig. 8(a) plots the TPR (or sensitivity) against the FPR (or 1-specificity), with the area under this curve (AUC) reported for indicating the quality of the prediction.With an AUC>0.88 for all classes shown in Fig. 8(a), the CNN trained on all patients outperformed the other CNNs.The same conclusion is supported by the confusion matrices.Fig. 8(b) denotes lower distributions outside the diagonal of the confusion matrix of the same CNN trained on all patients, showing a predominant correct classification of pain intervals, at the cost of using all patients' datasets.Furthermore, the correlation analysis between the NRS values reported by the patient and predicted by the same CNN obtained a good coefficient of determination (R 2 = 0.57), in Fig. 8(c).However, as the validation loss reported in Supplemental Table 2 was high, this network needs calibration if applied to new patients.

F. Online Predictions CNN Have Closer Trends to NRS
Two online procedures were proposed for retraining the CNN to investigate their potential use.The online procedure with the best performance in pain classification was the second one, obtaining AUCs>0.8 for all 4 classes and a main distribution within the confusion matrix across the diagonal, as illustrated in Fig. 9(c) and (d).In contrast to procedure 2, the first procedure easily confused little and medium pain, as shown in Fig. 9(a) and (b).If we consider how people describe pain based on their most recent experience, it seems that pain was better identified when compared to the most recent few minutes (7 in this example).The procedure with the highest degree of accuracy was the second one (Supplemental Table II), demonstrating that cumulative data was not necessary.As the computational time of the CNN in this application is crucial for the patient's safety, fast computation times of 10 s were obtained for each retraining step during the online procedure (Supplemental Text II.B).
Alternatively, the goal of online training was not to outperform offline training, the population-based classification, but rather to obtain an individualized classification for each patient.Consequently, the temporal trends were investigated.Fig. 10 reveals that online retraining of the CNN using procedure 2 achieved a more appropriate predicted-pain trend to the NRS, demonstrating a good approach.The differences in magnitude between the reported and predicted pain levels could be attributed to the subjective factors of the experienced pain versus its physiological surrogates.

A. Clinical Significance in Pain Prediction
Personalized and predictive models offer significant opportunities to improve nociception prediction through modeling and identification tools, relevant when done in real time.Linking the estimated parameters to pain evoked in awake patients or to opioid infusion in anesthesia, the medical staff has access to an objective assessment of nociception/anti-nociception balance.The proposed AI system is feasible for objective and individualized assessment of pain intensity.Based on the preliminary results, the proposed methodology successfully recognizes the pain-related electrical variability among 4 pain levels.The application of the FOIM and CNN in the postoperative clinical context is valuable since their potential real use is tested.Patient care may greatly benefit from the objectiveness and continuity of this methodology for pain assessment [35], [36].The subjectivity otherwise inherent in medical decision-making is minimized, evolving into automation that can improve the accuracy of diagnosis, provide personalized treatment options and streamline the healthcare industry overall.As findings pose questions regarding the extent of objectivity and reliability in nociception self-evaluation [37], AI implies reducing the risk for over-dosing when the predicted pain is observed to be lower than the reported one.
Even if several studies concluded that nociceptive stimulation causes a significant increase in the Bispectral index (BIS), the specificity of BIS in detecting pain is still unclear [38].Since BIS will be therefore of limited physiologic relevance for anti-nociception assessment during anesthesia [38], [39], using Anspec-PRO as a nociception monitor drives future development of interaction models to the analgesics' effect.

B Intrinsic Tracking of Opioids Effect
To study the effect of opioids in the mathematical model, the infusion starting time was indicated in Figs. 5 and 6 by black arrows on the R graph only.The impact of opioids on FOIM parameters was different, but R reacts negatively after opioid insertion.For this study, the quantitative analysis of the influence of dose changes in opioid titration on FOIM parameters could not be possible because no such data was monitored.Albeit this limitation, the preliminary indications on R changing after opioid infusion could be a starting point for a parametric sensitivity analysis.

C Implications for Drug-Infusion Control Systems
The prospects of the FOIM are mainly in anesthesia automation for the prediction of drug-to-effect dynamics in the optimization scheme.An example of adaptive model predictive control was proposed in [40] which integrates into the control algorithm the optimization of the required drug dose appropriate to deal with the estimated pain level (or equivalent drug concentration).The advantage of using FOIM over integer-order models is a minimal number of parameters to be identified, and also relatively great flexibility in capturing complex dynamics in the frequency domain, as a wide variability has been observed mainly in the fractional parameters.Even though the model identification was done using data from awake patients, this work represents the first step towards anesthesia, motivated by the availability of the self-reported pain level in order to compare and interpret the model's parameters in relation to the NRS-considered experience of pain.The lumped-parameter nociception model also reveals new opportunities to facilitate the pre-clinical evaluation of controllers in the form of in-silico test models, when the model is used to imitate the nociception process.Altogether, a wide range of clinical scenarios is available to be simulated, leading to confidence gained in the efficacy of model-based controllers, compared to rule-based controllers designed by iterative trial and error processes [41].
Beyond the regulatory loop, the models obtained from patient data can fill the gap in the patient simulator concerning the dynamic model for analgesia prediction [4].Supposing FOIM to intrinsically consider nociception effects, our proposed datadriven model of pain is possible to model surgical disturbance effects [42], hence minimizing uncertainties in a closed-loop Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.system [43].The identified FOIM can be then applied to the clinical disturbance profiles evoked by surgical stimuli to obtain a filtered noxious stimulation.Complementary to parametric models, the AI online algorithm demonstrates the performance to predict pain rise levels using the actual slope in NRS trends, subject to a projection of this derivative in the future.This forecasting is highly needed in the predictive mechanism for control systems to titrate analgesics earlier than the detection by feedback mechanisms.
The proposed algorithmic predictions of pain might be used as part of a decision-making support system in automatic anesthesia, as integrated into Fig.11.Due to the limited and corrupted dataset acquired from the patient, it is advisable to always employ both parametric models and deep learning.They offer complementary information to nociception assessment and in due course may serve as a component of decision aids for the analgesia component of anesthesia.The online setup aims to minimize patient model and disturbance uncertainties, hence analgesia could be directly linked to the effect of infused opioids.The underlying rationale is that surgical stimulus, resulting in nociception, will induce bio-electrical variability noticeable in the recursive identified parameters, and complementarily detectable by the online trained CNN procedure.Along with the correlation of the FOIM parameters with pain evaluators in PACU, the proposed model has also the potential to be calibrated before anesthesia induction and afterward recursively identified during maintenance, therefore denoting a relationship to opioid intake.The obtained fast computation times allow real-time executions (<3 minutes for offline training and 10 seconds for online retraining).

D Limitations
There are aspects of the model that may potentially be improved in future work, such as examining the time evolution of the parametric sensitivity in order to determine how changes in the model's response are caused by variations in its parameters.On the other hand, to identify the most influential parameters, a bigger patient population is needed.For this study, a virtual population could not be generated as a representation of the diversity of patients because of the early development stage of the model.In PACU, the surgical stimulus is absent, making identification and training more effective and reliable.To apply this in surgery, it is necessary to integrate the disturbance term in the real process transfer function (Supplemental Text I.B) [43].
The synergy between hypnotics and opioids acts as a nonlinear gain, which could be added after the FOIM model, leading to a Wiener type model.Such interactions are accounted for in the clinical pharmacokinetics-pharmacodynamic (PK-PD) surface models, but are only linked to the effect of hypnosis, i.e., BIS index [44].Since the effect of opioids could also be assessed, an interaction model is required by using specific hypnosis and analgesia levels assessment.
The major limitation in extending the applicability of AI into anesthesia is the necessity of a labeled dataset for training [45].To this adds the requirement of manifold labeled online data for achieving minimal training performance and accuracy.In this view, we establish that AI tools may be interesting under certain conditions, such as major surgeries (e.g., transplant, cardiac, etc.) [46], which provide the minimum dataset variability for online training to capture the patient specificity.Alternatively, patients undergoing long recovery periods are ideal candidates to deliver suitable data to fully explore and exploit the AI potential.

V. CONCLUSION
For objective pain estimation, this article investigated (i) a FOIM online identification, and (ii) a spectrogram-based deep-learning classification.A recursive parametric estimation algorithm was proposed for the online identification of a FOIM model on postoperative data acquired in awake patients with posttrauma nociception.Compared to the self-reported NRS trends, some estimated parameters show earlier than NRS the changes in nociception.Moreover, the tissue heterogeneity inferred from the FOIM parameters follows the NRS trends, assuming the electrochemical reactions evoked by nociception.Alternatively, this study reveals that employing AI is feasible to enhance personalized pain evaluation compared to the subjective NRS when trained on pain-related electrical images having time and frequency components.We found that retraining in real-time the network using the bioelectrical spectrograms of the patient anticipates and objectifies the increase or decrease of pain levels against the NRS reporting.
The clinical significance stems from the complementary use of parametric identification and deep learning with a focus on pain prediction than measurements only, and minimizing over-dosing risk compared to NRS.From a CNN trained on a population database, the retraining of the network using new NRS-labeled spectrograms from the actual patient may enable individualized objective pain prediction.Complementarily, the population modeling initialization using GA could emerge towards personalized estimation when identified by moving averaged window recursive least-squares algorithm.

Parametric
Modeling and Deep Learning for Enhancing Pain Assessment in Postanesthesia Mihaela Ghita , Member, IEEE, Isabela R. Birs , Member, IEEE, Dana Copot , Member, IEEE, Cristina I. Muresan , Senior Member, IEEE, Martine Neckebroek, and Clara M. Ionescu , Senior Member, IEEE Abstract-Objective: The problem of reliable and widely accepted measures of pain is still open.It follows the objective of this work as pain estimation through post-surgical trauma modeling and classification, to increase the needed reliability compared to measurements only.Methods: This article proposes (i) a recursive identification method to obtain the frequency response and parameterization using fractional-order impedance models (FOIM), and (ii) deep learning with convolutional neural networks (CNN) classification algorithms using time-frequency data and spectrograms.The skin impedance measurements were conducted on 12 patients throughout the postanesthesia care in a proof-of-concept clinical trial.Recursive least-squares system identification was performed using a genetic algorithm for initializing the parametric model.The online parameter estimates were compared to the self-reported level by the Numeric Rating Scale (NRS) for analysis and validation of the results.Alternatively, the inputs to CNNs were the spectrograms extracted from the time-frequency dataset, being pre-labeled in four intensities classes of pain during offline and online training with the NRS.Results: The tendency of I. INTRODUCTION

Fig. 1 .
Fig. 1.Moving window procedure of the monitored bioimpedance data dataset Ẑm (jω), advancing every minute m.At each current time t m , a corresponding bioimpedance interval Ẑint (jω) mapped into a 7-minutes window is available for the recursive identification.
for sec = 1 . . .140 • 60/5[seconds] the index of the measured second for which the power is calculated.The taxonomic classification used for pain intensities consisted of intervals instead of single values of NRS, due to the individual and subjective character of self-reported scales and pain threshold.The taxonomy represents 10 intensities of pain from the NRS between 0-10 arranged in 4 classes: No pain (NRS: 0-1), little pain (NRS: 2-3), medium pain (NRS: 4-6), and heavy pain (NRS: 7-10).
T D [F −1 ] denotes transduction, T S [F −1 ] transmission and P [H] indicates perception.The parameters T D and T S are analog to C −1 , where C [F] represents the electrical capacitance, while P is analog to electrical inductance L [H].The resistance R [Ω] has been added as a calibration factor (lower bound 0), and α 1 , α 2 , α 3 ∈ (0, 1).

Fig. 2 .
Fig. 2. Deep CNN structure.Data progresses from left to right: the spectrogram is inputted in the network, successively feature abstractions of the input data are mapped, finally achieving the output.The system outputs one of the 4 levels of pain intensity.The network is organized into several layers.

Fig. 3 .
Fig. 3. Histogram plots of the goodness of fit obtained from the FOIM identification using the initialization procedure of the first 7-minutes averaged frequency response.

Fig. 5 .
Fig. 5. Variance analysis of the identified FOIM parameters against the self-reported NRS (red stars), R, and P showin earlier than NRS the decreasing pain/nociception trends, exemplified for one patient (no.16).The long arrow indicates the infusion of a strong opioid, while the short arrow stands for a light opioid infusion.

Fig. 8 .
Fig. 8. Performance of one offline trained CNN (on all patients) in pain prediction.(a) The ROCs and AUCs are shown for each class of pain, following our non-binary taxonomic classification: Class 1: no pain (NRS: 0-1), Class 2: little pain (NRS: 2-3), Class 3: medium pain (NRS: 4-6), Class 4: heavy pain (NRS: 7-10).(b) The confusion matrix displays in each cell the number of observations and the percentage from the total.Diagonal and off-diagonal cells correspond to correctly and incorrectly classified spectrograms, respectively.The rows correspond to the predicted class (Output Class) and the columns correspond to the true class (Target Class).(c) Correlation between NRS predicted by the CNN and actual response reported by the patient.

Fig. 9 .
Fig. 9. Online training of CNNs performs better for procedure 2 (cumulative data) in terms of ROC curve (c) and confusion matrix (d), while procedure 1 (latest data) lacks the sensitivity for identifying classes 2 and 3 (little and medium pain).(a) and (b) CNN retrained using procedure 1 (with past cumulative data), (c) and (d) CNN retrained using procedure 2 (with lastest 7-minutes data).

Fig. 10 .
Fig. 10.Online predictions of retrained CNN have more specific trends to self-reported NRS than pain predicted by the population-trained CNN.The temporal trends of the predicted pain levels are compared to the patient-specific NRS values.

Fig. 11 .
Fig. 11.Proposed integration of the technological solution into computerized anesthesia to objectively predict the actual analgesia level.The optimization of such an automated system is complex and requires the patient model identified in real-time with actual data, after initialization through population-based relationships, complemented by AI tools retrained with patient-specific data and sent to the adaptive controller.