You are on page 1of 12

J. Med. Biol. Eng.

(2015) 35:833–844
DOI 10.1007/s40846-015-0095-7

ORIGINAL ARTICLE

ECG-based Mental Stress Assessment Using Fuzzy Computing


and Associative Petri Net
Hsiu-Sen Chiang1

Received: 8 April 2015 / Accepted: 15 July 2015 / Published online: 18 November 2015
 Taiwanese Society of Biomedical Engineering 2015

Abstract Medical reports suggest that long-term stress Keywords Electrocardiogram (ECG)  Mental stress 
can directly or indirectly lead to mental disorders and Heart rate variability  Fuzzy theory  Associative Petri net
cardiovascular disease. However, many people frequently
ignore their stress symptoms and fail to take remedial
action before developing serious psychological or physio- 1 Introduction
logical health problems. Many previous studies have used
electrocardiograms (ECG) to evaluate mental stress. Drastic changes to the social environment in the past few
However, ECG pattern recognition presents difficulties years have created conditions that have significantly
because the time-varying morphology is subject to physi- increased mental tension in individuals [1]. While moder-
ological conditions and the presence of noise. Therefore, ate levels of mental stress can help people focus their
how to achieve effective noise reduction and accurately attention, and thus enhance learning and work efficiency,
determine an individual’s exposure to mental stress under excessive stress can seriously impact physical and psy-
various conditions is a recurring issue in engineering and chological health [2]. Long-term exposure to mental stress
medical research. Heart rate variability is assessed using leads to feelings of exhaustion [3]. The human body sends
time- and frequency-domain analyses. To accurately detect out physiological warnings or generates symptoms in
mental stress, this research adopts both time and frequency response. Ignoring these symptoms leaves both the nervous
domains, two aspects of physiological characteristics. In and immune systems increasingly susceptible to damaging
this study, a rule-based reasoning model is created for conditions or disease, including cardiovascular disease,
mental stress assessment by combining fuzzy and asso- depression, cancer, and neurological disease [4, 5]. In
ciative Petri net methodologies. It can serve as a basis for addition, excessive mental stress is one of the main causes
clinical diagnosis and quickly measure the subject’s mental of emotional instability or suicide [6]. This raises the
condition and reduce subjective errors. Performance eval- importance of stress relief and management. However,
uation using Physionet’s stress recognition database shows most people are unaware of or disregard their excessive
that the proposed approach compares well with data mining physical and mental stress because of overly busy work
methods and other proposed methods. Moreover, a proto- schedules or because they are accustomed to being under a
type mental stress assessment system is proposed to help certain degree mental stress, leaving them indifferent to
users understand their mental condition. these physiological warning signals, thus allowing contin-
ued deterioration until the damage may be irreversible [7].
Currently, diagnosis of psychological stress was mostly
performed in a hospital using rating scales [8, 9]. This
& Hsiu-Sen Chiang involved completing questionnaires, which is time-con-
hschiang@nutc.edu.tw suming and prone to errors due to subjectivity. An elec-
1 trocardiogram (ECG) records the voltage change generated
Department of Information Management, National Taichung
University of Science and Technology, 129 Sanmin Road while the heart tissue contracts and expands and can reflect
Sec. 3, Taichung 40401, Taiwan one’s mental and physical conditions in real time. Many

123
834 H.-S. Chiang

studies related to the assessment of mental stress have shown in Fig. 1. Among ECG components, the QRS
analyzed ECG data to obtain biological parameters such as complex group is a significant wave because it contains the
heart rate variability (HRV) and autonomic nervous system highest R peak, which can be used to quickly and precisely
(ANS) activity [10]. ECG signals, however, are not steady calculate the HRV value [23].
and contain a lot of noise. As such, even if the same The HRV analysis method mainly deals with the time
instrument is used on the same person, the generated ECG and frequency domains. All of the indicators obtained after
signals can vary significantly at different points in time and analysis reflect physiological characteristics and informa-
under different physical conditions, easily resulting in tion related to mental stress [24–26]. The time-domain
measurement errors [11, 12]. analysis is used to calculate the heart beat interval to
Therefore, when applying ECG signals in the diagnosis generate various indicator values, including mean value,
of mental stress, it is necessary to take the following points standard deviation, square and root mean square, differ-
into consideration: (1) how to effectively eliminate noise ential, and ratio, all of which can be used to assess mental
and retrieve personal physiological parameters without loss stress. Frequency-domain analysis is used to calculate the
of information, (2) how to provide users with timely power spectral density (PSD) of the heart beat interval to
warnings of the onset of excessive mental stress and estimate power distribution within the overall signal fre-
reminders of how to deal with it, and (3) how to provide quency range [27, 28]. ANS response in the frequency
timely and objective clinical assessments of the degree of domain of ECG signals can be primarily divided into three
mental stress. This study combines various approaches, frequency bands, namely very low frequency (VLF) (from
such as singular value decomposition (SVD), fuzzy theory, the regulation of the distal vasomotor tone, which is related
and the associative Petri net (APN), to develop a non-in- to temperature regulation), low frequency (LF) (which is
vasive, rapid, and objective mental stress assessment model related to the baroreceptor reflex and blood pressure reg-
to assist doctors in making clinical diagnoses and to ulation), and high frequency (HF) (which is related to
develop a prototype mental stress warning system to pro- respiration). Variance and power ratios for the changes in
vide users with real-time alerts regarding the onset of energy at these three frequency bands are calculated to
excessive mental stress. assess ANS regulation [17, 29].

2.2 Related Works


2 Literature Review
Pagani et al. [30] used the short-term R–R interval and
2.1 Heart Rate Variability cardiovascular systolic blood pressure in their spectral
analysis to investigate how mental stress influences the
Mental stress is an abstract, subjective phenomenon and ANS and the circulatory system. They found that the VLF
cannot be measured directly. Relative mental stress, how- energy was higher than usual when the subject was under
ever, can be analyzed and assessed through changes of unusual stress. Satish et al. [31] investigated large intestine
physiological response. Some physiological parameters, activity and cardiovascular pressure change by changing
such as HRV and ANS activity, have been found to be the temperature of the hands to control physical and mental
highly sensitive to external stimulation and changes and are stress. Leor-Librach et al. [32] administered cardiac stim-
thus useful for the diagnosis of mental stress [13–15]. ulants in mice to induce controlled increased heart rates
The ANS is composed of two major parts, namely the and to investigate the correlation between the changes to
sympathetic nervous system and the parasympathetic ner-
vous system. It is responsible for reflecting and managing
physical changes inside the human body related to the
external environment [16]. Mental stress gives rise to
unstable and negative emotions, such as anxiety, anger, and
dissatisfaction, affecting the ANS and resulting in
increased or decreased activity in the sympathetic and
parasympathetic nervous systems, which is manifested in
the heart rhythm [17–20]. HRV is the small cyclic differ-
ence between consecutive heart rate intervals as a result of
ANS regulation under the sinus rhythm and reflects the
balance between the sympathetic and parasympathetic
nervous systems [21, 22]. The HRV value is the R–R
interval calculated on the basis of the ECG wave peaks, as Fig. 1 R–R interval

123
ECG-based Mental Stress Assessment Using Fuzzy Computing… 835

Fig. 2 Example of stress test


data. Recognition of stress test
scenario in driving

the VLF amplitude among HRV signals and sympathetic electromyogram, GSR, and Respiratory rate. These ECG
nervous system excitement. Shusterman and Barnea [33] signals were filtered through a 0.5 s mean filter and
studied the correlation between body surface temperature, resampled at 15.5 Hz.
vascular changes, and the activity of the sympathetic ner- For the SRAD dataset, stress was induced through three
vous system with three indicators (HRV, epidermal tem- consecutive scenarios, namely with the subject at rest,
perature change, and distal vasomotor nerve activity) under driving on a city road, and driving on a freeway. The entire
conditions of mental stress and biofeedback. They found experiment, including all three scenarios, lasted around
that the degree of sympathetic nervous system activity can 65–93 min. During a stress induction experiment, subjects
be used to measure mental stress. Based on HRV analysis, were first instructed to relax in the car for 15 min with their
many scholars have successfully identified different mental eyes closed to help them enter a stress-free (or low-stress)
stress states by applying the wavelet transforms to filter out state, and then drive the car on a city road for approxi-
noise and by combining several categorization approaches, mately 12–15 min. During the test, the test subject was
such as fuzzy neural networks (FNN) and k-nearest asked to remain fully focused on the heavy traffic, which
neighbor (KNN) [13, 34]. The pupil diameter ratio, pupil appears to induce a high-stress state. After leaving the city,
constriction rate, blood pressure, and HRV have been used the subject engaged in freeway driving for around
to detect mental condition [35]. A self-designed fuzzy filter 7–10 min. The wide, straight lanes, and relatively light
method was used to filter noise in individual parameters, traffic put the subject in a medium-stress state. The subject
and was applied with the fuzzy support vector machine to then followed the same path from the freeway back to the
identify mental stress states. One study [36] applied fuzzy city road and then the garage, where they rested for 15 min
logic to the calculation of galvanic skin response (GSR) and completed the stress experiment. The SRAD scenario
and heart rate to identify mental stress states. Window is shown in Fig. 2.
detrended fluctuation analysis was used to calculate the
energy of the R–R sequence within a particular time win- 3.2 Singular Value Decomposition
dow, which was then used to determine the mental stress
state [37]. When ECG signals are retrieved, they contain noise due to
external factors, and often include current noise from the
instrument itself, static electricity noise generated when
3 Materials and Methods electrodes contact human skin, and baseline drift [39].
Prior studies have found that most noise processing
This section briefly describes our research methods, methods can effectively remove signal noise, but issues
including signals processing, HRV analysis, membership related to high calculation cost, signal distortion, and
function generation, and the detection of mental condition symmetrical imbalance remain. SVD can effectively
using the proposed APN. decompose signals into their individual components while
retaining important characteristics, and thus is frequently
3.1 Dataset used to remove noise during signal processing. SVD is
calculated as [40]:
This study uses the stress recognition in automobile drivers X
S¼U VT ð1Þ
(SRAD) dataset from the Physionet database [38]. The
dataset is composed of 16 consecutive logs, each used to where S is an m 9 n matrix, U is an m 9 m orthogonal
P
record multiple pieces of physical information for a single matrix, V is an n 9 n orthogonal matrix, and is an
healthy subject undergoing stress tests, including ECG, m 9 n diagonal matrix:

123
836 H.-S. Chiang

2 3
a1  0 the onset position of the QRS complex has been
X 6 . .. .. 7 detected. The comparison continues and the max-
¼ 4 .. . . 5 ð2Þ
imum value found is where the R peak is located.
0  an
Step 4 When the R peak is found, the maxi value in
T Eq. (7) should be updated immediately. The
First, the cross product of the S S matrix is calculated to
P
obtain the eigenvalue (singular value) matrix and the Filter_Parameter can be set to be 2, 4, 8, or
eigenvector V-matrix. The eigenvalue is then divided by 16. The maxi value is updated using Eq. (8) and
the eigenvector value to obtain the U-matrix. Once the U, First_max is updated using Eq. (9).
P
, and V matrices are obtained, Eq. (3) is used to calculate First max  maxi
the sum of mean singular values. A singular value smaller maxi ¼  maxi ð8Þ
Filter Parameter
than the mean is reset to 0. n is the quantity of singular
First max ¼ Height of R peaks point
values and a is the singular value after conversion.
Pi  n  Height of QRS onset ð9Þ
ai if ai  Avg; a0i ¼ 0
Avg ¼ i¼1 0 ð3Þ Step 5 After the maxi value has been updated, the threshold
n else ai ¼ ai
is re-calculated using Eq. (7) and then the location
Then, Eq. (4) is used to re-calculate and obtain the new of the next R peak is detected. The detection process
singular value. repeats until all signals have stopped.
2 0 3
a1    0
X 0
6 7
¼ 4 ... . . . ... 5 ð4Þ 3.4 Fast Fourier Transform
0
0    an
0
The fast Fourier transform (FFT) algorithm computes the
0
X 0 discrete Fourier transform (DFT) of a sequence, or its
S ¼U V ð5Þ
inverse that converts a signal from its time domain to a
Finally, post-calculation matrices are re-combined to representation in the frequency domain. The Cooley–Tukey
produce the filtered signal matrix, as in Eq. (5). FFT is adopted in this paper. The DFT is defined by the
Eq. (10), where x(n) is the original signal and x0, ...., xN-1 are
3.3 R Peak Detection Method complex numbers.
XN1 j2pkn
X ðkÞ ¼ xðnÞe N n ¼ 0; 1; 2; 3; . . .; N  1 ð10Þ
For HRV analysis, the maximum slope method is adopted n¼0
to detect the R peak of ECG signals and obtain the R–R By calculating the PSD, one can quickly obtain the power
interval [41]. This method offers high precision and speed, size of ECG signals at different bands in order to obtain the
with minimal calculation cost, and can be used in real-time physiological characteristics. According to the Wiener–
detection. The detection process is described as follows: Khinchin theorem, the power spectral density Sxx(f) of the
Step 1 The Slope(n) at each signal point X[n] is obtained function with discrete values x(n), is shown in Eq. (11). The
with the first-order derivative: Eq. (12) is the discrete autocorrelation function of x(n).
Being a sampled and discrete-time sequence, the spectral
SlopeðnÞ ¼ 2X ðn  2Þ  X ðn  1Þ þ X ðn þ 1Þ
density is periodic in the frequency domain.
þ 2X ðn þ 2Þ
kX
¼1
ð6Þ
Sxx ð f Þ ¼ Rxx ðkÞej2pkf ð11Þ
Step 2 The detection threshold is set. The threshold k¼1

parameter can be 2, 4, 8, or 16. maxi is the Rxx ðkÞ ¼ Eð xðnÞx ðn  kÞÞ ð12Þ
maximum slope. The default is the maximum
slope among the first 250 points (peaks) of the
ECG signals. The threshold is calculated using: 3.5 Minimize Entropy Principle Approach
Threshold Parameter
Slope Threshold ¼ The minimize entropy principle approach (MEPA) creates
16 the fuzzy membership function by applying information
 maxi ð7Þ
entropy. Through MEPA, data are divided into different
Step 3 The threshold is compared with Slope(n) at each segments using the interval partition method. The mini-
signal peak; when the slope of two consecutive mized information entropy method is then used to assess
peaks is greater than the set threshold, it means that the degree of information entropy within each specific data

123
ECG-based Mental Stress Assessment Using Fuzzy Computing… 837

interval. The interval partition of the minimum information 3.6 Associative Petri Net
entropy can be determined from this assessment [42, 43].
For example, to find a partition threshold line xi within a The APN is a modified Petri-net-based structure that
certain dataset interval [a, b], divide the dataset into two combines the Apriori algorithm with association rules [44].
segments [a, a ? x] and [a ? x, b]. To find the most The APN is a directional graph that includes three types
appropriate partition threshold line with MEPA, a partition of node, namely (1) place, which assumes an approximately
threshold line is created at every point within the dataset circular shape and describes or represents a state; (2) sup-
interval [a, b], where data categories and patterns differ. In port, which assumes a square shape and represents the
this way, the set of a partition threshold line X, xi [ X can threshold of association between an antecedent and a con-
be obtained. Equations (13), (14), and (15) are then applied sequence, and is used to assess whether the association
to calculate the entropy value obtained for the threshold between two places exists; and (3) transition, which assumes
line xi created at each point where data categories differ. the shape of a long bar and contains an association function
The threshold line of the minimum entropy is the deter- G (also referred to as the certainty function (CF)) to convert
mined partition line. The partition line xpri determined for the relationship between different antecedents and conse-
Stage 1 is referred to as the partition line (PRI), which can quences to an appropriate indicator between zero and one.
divide the whole data section into two segments, [a, a ? x] The APN theory primarily focuses on describing dynamic
and [a ? x, b]. These two segments are respectively called processes. As such, its implementation emphasizes ‘‘enable’’
Segment f and Segment g. The entropy for each value of x and ‘‘fire’’, that is, enabled transition nodes. When a state
in the region between a and b is expressed as [42]: changes, inference is enabled to reflect different conditional
states and further explore the influence on, and degree of
EðxÞ ¼ f ðxÞEf ðxÞ þ gðxÞEg ðxÞ ð13Þ
association of antecedents with, consequences. The APN can
Ef ðxÞ ¼ ½f1 ðxÞ þ ln f1 ðxÞ þ f2 ðxÞ þ ln f2 ðxÞ ð14Þ be expressed mathematically and graphically, and can be
defined as a 13-tuple, as shown in Fig. 3.
Eg ðxÞ ¼ ½g1 ðxÞ þ ln g1 ðxÞ þ g2 ðxÞ þ ln g2 ðxÞ ð15Þ
In an APN, all propositions are represented by a place and
f ðxÞ þ gðxÞ ¼ 1 ð16Þ proposition authenticity is indicated with a token. The
association degree between two propositions can be indi-
where fk(x) and gk(x) respectively represent the conditional
cated with transitions and the CF value. The consequence
probability of class k samples in [a, a ? x] and [a ? x, b].
proposition in the association production rule (APR) is
A value of x that gives the minimum entropy is the optimal
affected by all the connecting antecedent propositions. The
threshold value. Estimated fk(x), gk(x), f(x), and g(x) values
APN model consists of five APR types, each with its own
are calculated as follows:
computing method [44]. Thus, the reasoning process
nk ðxÞ þ 1 requires different operation and calculating methods based
fk ðxÞ ¼ ð17Þ
nðxÞ þ 1 on the characteristics of the various APRs. The different
Nk ðxÞ þ 1 antecedents are input places, and a unique computing
gk ðxÞ ¼ ð18Þ method is used to consider the CF between places and
NðxÞ þ 1
transitions to thus infer the possible value of a consequence.
nðxÞ In light of the association degree between antecedent
f ðxÞ ¼ ð19Þ
n propositions and consequence propositions, this study
gðxÞ ¼ 1  f ðxÞ ð20Þ applies the association rule idea in data mining to APN.
The Apriori algorithm for association rules [45] can be
where nk(x) is the number of class k samples located in [a, used to find the association among interesting items
a ? x], n(x) is the total number of samples located in [a, IT = {i1, i2,…, im} in a given dataset D containing a set of
a ? x], Nk(x) is the number of class k samples located in database transactions. An association rule can be indicated
[a ? x, b], N(x) is the total number of samples located in through A ? B, in which A , IT, B , IT, and A \ B = /
[a ? x, b], and n is the total number of samples in [a, b]. . The support means that the association rule A ? B in
To continue dividing the segments, it is necessary to dataset D contains the ratio of A [ B, indicated as s. The
create the threshold line xsec for Stage 2. In Segment [a, confidence means that the association rule A ? B in
a ? x], the partition threshold line xsec1 can be determined dataset D contains both the ratios of A and B when A is
following the same steps used during the Stage 1 parti- upheld; confidence is indicated as c. The support and
tioning. Similarly, the partition threshold line xsec2 can also confidence are respectively calculated as:
be determined for Segment [a ? x, b]. Based on the MEPA
ideas, it is possible to minimize the data entropy in the SupportðA ) BÞ ¼ PðA [ BÞ ð21Þ
segment [43]. ConfidenceðA ) BÞ ¼ PðB=AÞ ð22Þ

123
838 H.-S. Chiang

APN = (P, T , S , C , D, Λ, Γ, I , O, α , β , G, W )
Fig. 3 Definition of associative
Petri net

where
P = {p1 , p2 ,....... pn } is a finite set of places,

T = {t1 , t 2 ,.......ti } is a finite set of transitions,

S = {s1 , s 2 ,.......s m } is a finite set of supports,

C = {c1 , c2 ,.......ci } is a finite set of confidences,

D = {d1 , d 2 ,.......d n } is a finite set of propositions,

Λ = {τ 1 ,τ 2 ,.......τ m } is a finite set of thresholds of the supports,

Γ = {γ 1 , γ 2 ,.......γ i } is a finite set of thresholds of the confidences,


P T D = φ, P = D

I : T → P∞ is an input function, a mapping from transitions to bags of places,


O : T → P∞ is an output function, a mapping from transitions to bags of places,
α : P → [0,1] is an association function, a mapping from places to real values
between zero and one,
β :P→D is an association function, a bijective mapping from places to
propositions,
G : T → [0,1] is an association function which assigns a real value between zero to
one to each transition
W : S → [0,1] is an association function which assigns a real value between zero to
one to each support.

When the association rule satisfies the minimum support If all of pj [ I(ti), a(pj) C k, sm C sm, and ci C ci, k, sm,
and confidence thresholds sm, sm [ [0,1] and ci, ci [ [0,1], ci [ [0,1] are activated, the transition ti is enabled and the
respectively, the rule is considered interesting. These token passes through all support places from the input
thresholds can be set according to the user’s experience or places and transits to each output place. By connecting
by subject matter experts. If the values of the support and related places and giving the transition an appropriate CF,
confidence are higher than their thresholds s and c, tran- one can obtain the APN reasoning model that expresses the
sition is enabled and the CF and the corresponding confi- association among professional knowledge.
dence (CF = ci) are calculated using Eq. (22); otherwise,
no association exists and the corresponding confidence is 0
(CF = 0): 4 Experimental Procedures

ci ; if sm  sm ; ci  ci The experimental procedure for mental stress assessment is
Gðti Þ ¼ ð23Þ
0; if sm  sm ; or ci  ci divided into three stages. Stage 1 covers data preprocessing
where ci is the confidence value, ci is a threshold of the and includes the retrieval of stress segments containing
confidence, sm is the support value, and sm is a threshold of ECG signals, the filtering of external noise, and the
the support. removal of the signal band. Stage 2 is feature extraction,

123
ECG-based Mental Stress Assessment Using Fuzzy Computing… 839

which includes R peak detection and time- and frequency- Table 1 Descriptions of features
domain analysis. The final stage covers reasoning of mental Features Description
condition, in which the MEPA and the APN are used to
detect the degree of mental stress. MEAN Mean of R–R interval
SDNN Standard deviation of R–R interval
4.1 Data Sampling and Filtering RMSSD Root mean square of R–R interval
NN50 Number of R–R intervals differing
A total of 16 SRAD datasets were obtained from the Physionet by [ 50 ms from adjacent intervals
database. From each dataset, we obtained a total of 27 stress pNN50 NN50 count divided by total number
of all NN intervals
segments, equally divided among low-, medium-, and high-
VLF power Very-low-frequency heart rate power
stress segments. The length of the retrieved segment was
LF power Low-frequency heart rate power
1 min. To avoid influence from delayed onset of stress in
HF power High-frequency heart rate power
subjects due to scenario transition, retrieval of each stress
Total power Total power
segment begins with the central time interval. For example, the
total time interval for low stress in the Drive05 log is 0–908 s, Normalized LF LF power/(Total power-VLF power) 9 100 %
so the segment from 181 to 240 s is retrieved. For a few logs Normalized HF HF power/(Total power-VLF power) 9 100 %
that do not include the final low stress segment, the previous LH/HF Ratio of low-to-high frequency power
segment was retrieved. A total of 144 low stress segments, 144
medium stress segments, and 144 high stress segments were
retrieved for a total sample size of 432 segments. the time-domain features by calculating the R–R interval
Because instruments record external noise along with sequence; (iv) transform the time-domain signals into the
ECG signals, the original signals were quite noisy. Filter- frequency domain through FFT; and (v) analyze the dis-
ing with SVD produced more easily identifiable wave- tribution of the heart beat interval power at various fre-
forms, as shown in Fig. 4. To obtain the QRS band where quencies through PSD and obtain frequency-domain
the R peak is located, a Butterworth high-pass filter was features for individual bands. To identify features most
used to remove unnecessary bands. closely associated with mental stress, the information gain
(IG) method was used to reduce the number of features
4.2 Feature Extraction from 12 to 9. Experimental results show that the APN
feature reduction model provides performance advantages.
Feature selection is important for enhancing the perfor-
mance of mental stress detection. After administering a 4.3 Mental Stress Reasoning
detailed survey, we used the 12 features listed in Table 1 to
construct our prototype. The feature extraction process was The MEPA is used to create the fuzzy membership func-
as follows: (i) find the signal peak using the maximum tion by calculating the entropy of all features for various
slope method, using default values for the Threshold_Pa- degrees of mental stress. The fuzzy membership function
rameter and the Filter_Parameter; (ii) obtain the R–R for each feature is established through trapezoidal and tri-
interval sequence through R peak detection; (iii) measure angular fuzzy functions, as shown in Fig. 5. The response
status and criteria for each feature for different degrees of
mental stress are given a linguistic value and a membership
degree corresponding to the propositions and the degree of
truth of the input place in the APN.
As shown in Fig. 6, the structure of our APN model for
mental stress detection is constructed by integrating dif-
ferent types of APR, features of physiological parameters,
and the fuzzy membership function. Our APN model has
five inputs, four middle states, and one final state. All the
degrees of truth and states of the input places in the APN
are obtained from the membership functions. The degree of
truth of each middle place can be obtained using the CF
calculated using Eq. (23). An APN reasoning algorithm
from Shih et al. [45] is used to detect the degree of mental
stress. The most probable degree of mental stress is then
Fig. 4 Comparison of ECG signals before and after filtration obtained under the condition of all physiological features.

123
840 H.-S. Chiang

1 of sij and cij are set to 0.05 and 0.02, respectively. The
reasoning example of our APN for the degree of mental
0.5 stress is as follows:
Step 1 From starting places p1, p2, p4: Places p1, p2,
0 and p4 are starting places and b(p1) = d1,
199.5 249.5 273
b(p2) = d2, b(p4) = d4 are three propositions
⎧1 x < 199.5
⎪ of starting places. IRS(ps) = {p3, p5}.
Low CFL ( x ) = ⎨ 249.5 − x
⎪⎩ 50 199.5 ≤ x < 224.5
Step 2: In descendant place pi, pi [ IRS(ps), s = 1, 2,
⎧ x − 199.5 224.5 ≤ x < 249.5
4; i = 3, 5.
⎪⎪ 50 APsi = {p1, p2, p4} and all transitions are
NN50 Median CFM ( x ) = ⎨
⎪ 273 − x 249.5 ≤ x < 261.25
enabled. Places p1, p2, and p4 aexist since
⎩⎪ 23.5 (a(ps) C k) and all the values of the support
⎧ x − 249.5 261.25 ≤ x < 273 and confidence are greater than thresholds s

High CFH ( x ) = ⎨ 23.5 and c (i.e. ssi C ssi = 0.05 and csi -
⎪⎩1 x > 273
C csi = 0.02, s = 1, 2,4; i = 3, 5). Tokens
Fig. 5 Fuzzy membership function of NN50 are moved from p1, p2 to p3 and from p4 to p5.
Since the antecedent portion or consequence
portion of APRs between p1, p2, p4 and p3, p5,
As illustrated in Fig. 6, our proposed APN model for the belongs to types 4 and 1, respectively, the
degree of mental stress reasoning has nine characteristics reasoning functions are the ‘‘Max’’ and ‘‘No’’
and one final state. Three characteristics, namely operators, respectively [44]. The degrees of
pNN50(x5), Normalized LF(x10), and LH/HF(x12), are truth of proposition of places p3 and p5 are:
deleted, since the information they provide is insufficient
for mental stress detection. For example, assume that five g ¼ aðpi Þ ¼ Maxfaðps Þ 
input characteristics [x2, x3, x4, x8, x11] of the HRV char- csi js ¼ 1; 2; 4; i ¼ 3; 5g; then
acteristics from the ECG signal are [0.981, 1.231, 268.3, aðp3 Þ ¼ Maxfaðp1 Þ 
0.992, 547.654]. From the membership functions, we can c13 ; aðp2 Þ  c23 g
obtain the membership degrees and the linguistic values of
¼ Maxf0:786  0:733; 1:0  0:884g
these HRV characteristics as [M, M, H, L, L] and [0.786,
1.0, 0.892, 0.93, 1.0], respectively. Then, a(p1) = 0.786, ¼ 0:884aðp5 Þ ¼ faðp4 Þ  c45 g
a(p2) = 1.0, a(p4) = 0.892, a(p6) = 0.93, and a(p8) = 1.0 ¼ f0:892  0:862g ¼ 0:768
are a mapping from places p1, p2,p4, p6, and p8 to their real Therefore; aðpi ji ¼ 3; 5Þ ¼ f0:884; 0:768g:
values, obtained by using the membership function. p1, p2,
and p4 are starting places, where k [ 0 indicates that the Step 3 At descendant place pj, pj [ IRS(pi), i = 3, 5,
proposition exists and k = 0 indicates that the proposition 6; j = 7.
does not exist. Let b(p1) = d1, b(p2) = d2,… b(p9) = d9 APij = {p3, p5, p6} and all transitions are
and d1, d2,…, d9 be nine propositions of HRV character- enabled. Places p3, p5, and p6 exist since
istics, as shown in Table 1. Let place p10 be a goal place, (a(pi) C k). All the values of the support and
d10 be the proposition of goal place p10, and a(p10) be the confidence are greater than thresholds s and c.
degree of truth of d10. Assume that all the threshold values (i.e. sij C sij = 0.05 and cij C cij = 0.02,

Fig. 6 Reasoning model for


degree of mental stress
classification

123
ECG-based Mental Stress Assessment Using Fuzzy Computing… 841

i = 3, 5, 6; j = 7). Tokens are moved from 5 Results and Discussion


p3, p5, p6 to p7. Since the antecedent portion
or consequence portion of APRs between p3, SRAD datasets from the Physionet database were used to
p5, p6 and p7 belongs to type 4, the reasoning evaluate the performance of the proposed APN model for
function is the ‘‘Max’’ operator. The degree of the detection of mental stress. A total of 432 samples were
truth of proposition at place p7 is: used for both training and testing for comparison with other
g ¼ aðpi Þ ¼ Maxfaðpi Þ data mining methods, namely decision tree (C4.5), neural
network (NN), support vector machine (SVM), Bayes net,
 cij ji ¼ 3; 5; 6; j ¼ 7g; then
and naı̈ve Bayes (NB), running on Weka and MATLAB
aðp7 Þ ¼ Maxfaðp3 Þ  c37 ; aðp5 Þ 2012a (see Table 2). Moreover, the proposed APN model
 c57 ; aðp6 Þ  c67 g was evaluated using the following performance measures:
¼ Maxf0:884  0:852; 0:768  0:785; 0:93 true positive (TP) rate (sensitivity) (= TP/(TP ? FN)), true
 0:827g ¼ 0:769 negative (TN) rate (specificity) (= TN/(FP ? TN)), false
positive (FP) rate (= FP/(FP ? TN)), and false negative
Therefore; aðpj jj ¼ 7Þ ¼ f0:769g:
(FN) rate (= FN/(TP ? FN)). Accuracy is defined as fol-
lows: (TP ? TN)/(TP ? FP ? FN ? TN). The F-measure
Step 4 At descendant place pk, pk [ IRS(pj), j = 7, 8; combines precision TP/(TP ? FP) and recall TP/
k = 9. APij = {p7, p8} and all transitions are (TP ? FN) on the prediction of the positive class (F-
enabled. Places p7, p8 exist since (a(pj) C k). measure = 2 9 precision 9 recall/precision ? recall). A
All the values of the support and confidence higher F-measure value indicates that the model performs
are greater than thresholds s and c. (i.e. better on positive class balancing of FP and FN. G-mean is
skj C sjk = 0.05 and cjk C cjk = 0.02, j = 7, the product of the prediction accuracy levels for both
8; k = 9). Tokens are moved from p7, p8 to pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
classes, which is TN=ðTN þ FPÞ  TP=ðTP þ FN Þ. As
p9. Since the antecedent portion or conse-
shown in Table 2, C4.5 has higher TN rate and precision
quence portion of APRs between p7, p8 and p9
rate than those of APN ? IG. C 4.5, Bayes net and
belongs to type 4, the reasoning function is
APN ? IG have good accuracy rates in detecting mental
the ‘‘Max’’ operator. The degree of truth of
stress. The proposed APN ? IG generally outperforms
proposition at place p7 is:
    other data mining methods in terms of sensitivity, recall
g ¼ a pj ¼ Maxfa pj  cjk jj ¼ 7; 8; k ¼ 9g; rate, F-measure, G-mean, and accuracy. Other measure-
then aðp9 Þ ¼ Maxfaðp7 Þ  c79 ; aðp8 Þ  c89 g ments also provided good results. Therefore, it can be
¼ Maxf0:769  0:987; 1:0  0:824g concluded that the proposed APN model is effective for
detecting mental stress states.
¼ 0:824Therefore; aðpk jk ¼ 9Þ ¼ f0:824g:
Table 3 summarizes other reported mental stress
assessment results obtained with video coding and ques-
Step 5 At descendant place pg, since pg = p10 is the
tionnaires [19], principal component analysis [46], corre-
goal place, place p9 exists (a(pk) C k) and all
lation-based feature selection combined with C4.5, SVM,
the values of the support and confidence are
NB, and k-nearest-neighbor (KNN) [47], and feature-based
greater than thresholds s and c. The transitions
transformation and KNN [48]. The method introduced by
are enabled (i.e. skg C skg = 0.05 and ckg -
Healey and Picard [19] produces the highest accuracy but
C ckg = 0.02, k = 9; g = 10). There is only
its implementation is time-consuming and is subject to
one successful reasoning path into goal place
subjective errors and hence is not suitable for real-time
p10. Since the APRs between p9 and p10
testing. The present method not only provides satisfactory
belong to type 1, the reasoning function is the
test accuracy but also allows for rapid and objective mea-
‘‘No’’ operator. Token are moved from p9 to
surements, making it suitable for use as an auxiliary
p10 and the degree of truth is:
    diagnostic tool in clinical settings.
a pg ¼ fa pg  ckg jk ¼ 9; g ¼ 10g; then
aðp10 Þ ¼ faðp9 Þ  c910 g ¼ 0:824  1:0
¼ 0:824 6 Conclusion

Finally, we can obtain the degree of truth proposition d10 as In Fig. 7 shows an off-line prototype mental stress diag-
0.824. Thus, we can assess a person’s degree of mental nosis system that uses Bluetooth to integrate an ECG
stress (high mental stress state in this example). detector with mobile computing devices to realize real-time

123
842 H.-S. Chiang

Table 2 Performance of various classification methods


Method TP (%) TN (%) FP (%) FN (%) Precision rate (%) Recall rate (%) F-measure G-mean Accuracy

C4.5 96.18 91.67 8.33 3.82 95.85 96.18 0.960 0.939 0.947
NN 92.36 88.89 11.11 7.64 94.33 92.36 0.933 0.906 0.912
SVM 91.32 65.97 34.03 8.68 84.29 91.32 0.877 0.776 0.829
Bayes net 96.18 89.58 10.42 3.82 94.86 96.18 0.955 0.928 0.940
NB 61.81 89.58 10.42 38.19 92.23 61.81 0.740 0.744 0.711
APN 93.06 71.53 28.47 6.94 86.73 93.06 0.898 0.816 0.859
APN ? IG 97.22 90.97 9.03 2.78 95.56 97.22 0.964 0.940 0.951
TP true positive, TN true negative, FP false positive, FN false negative

Table 3 Comparison with other research


Classification Dimension reduction Accuracy (%) Authors

Video coding and questionnaires; continuous – 97 Healey and Picard [19]


correlations analysis
C4.5, SVM, NB, and KNN Principal component analysis (PCA) 68.31 Deng et al. [46]
C4.5, SVM, NB, and KNN Correlation-based feature selection (CFS) 85 Deng et al. [47]
KNN Feature-based Transformation algorithm 88.28 Wang et al. [48]
MEPA and APN Information gain (IG) 95.1 Proposed method

Fig. 7 Architecture of mental


stress detection system

and continuous mental stress monitoring. When the stress In this study, SVD, MEPA, and APN were combined to
value reaches a certain threshold, the system sends an alert generate a mental stress assessment model. The proposed
along with stress relief recommendations according to the model addresses signal noise and instability, and precisely
present stress level. We expect it will help patients to identifies the degree of mental stress. In HRV analysis, the
reduce the likelihood of developing serious mental illness model uses time- and frequency-domain characteristic
or chronic disease as a result of long-term high stress. variables. This model helps to provide immediate diagnosis

123
ECG-based Mental Stress Assessment Using Fuzzy Computing… 843

for mental stress by retrieving patients’ current ECG sig- nervous system in learning and memory. European Journal of
nals, thus limiting the impact of subjectivity. Pharmacology, 405, 225–234.
18. Drolet, G., Dumont, E. C., Gosselin, I., Kinkead, R., Laforest, S.,
& Trottier, J. F. (2001). Role of endogenous opioid system in the
Acknowledgments The author would like to express his sincere regulation of the stress response. Progress in Neuro-Psy-
appreciation for the financial support from the National Science chopharmacology & Biological Psychiatry, 25, 729–741.
Council of Taiwan (grant NSC 100-2410-H-025-005). 19. Healey, J. A., & Picard, R. W. (2005). Detecting stress during
real-world driving tasks using physiological sensors. IEEE
Transactions on Intelligent Transportation Systems, 6, 156–166.
References 20. Von Borell, E., Langbein, J., Despres, G., Hansen, S., Leterrier,
C., Marchant-Forde, J., et al. (2007). Heart rate variability as a
1. Sharma, N., & Gedeon, T. (2012). Objective measures, sensors measure of autonomic regulation of cardiac activity for assessing
and computational techniques for stress recognition and classifi- stress and welfare in farm animals: A review. Physiology &
cation: A survey. Computer Methods and Programs in Biome- Behavior, 92, 293–316.
dicine, 108, 1287–1301. 21. Zickmann, B., Hofmann, H. C., Pottkämper, C., Knothe, C.,
2. Buckle, J. (2003). Clinical aromatherapy: Essential oils in Boldt, J., & Hempelmann, G. (1996). Changes in heart rate
practice (pp. 228–246). New York: Churchill Livingstone. variability during induction of anesthesia with fentanyl and
3. Kopin, I. J., Eisenhofer, G., & Goldstien, D. (1988). Sympa- midazolam. Journal of Cardiothoracic and Vascular Anesthesia,
thoadrenal medullary system and stress. Advances in Experi- 10, 609–613.
mental Medicine and Biology, 245, 11–23. 22. Stein, P. K., Hagley, M. T., Cole, P. L., Domitrovich, P. P.,
4. Block, J. P., He, Y., Zaslavsky, A. M., Ding, L., & Ayanian, J. Z. Kleiger, R. E., & Rottman, J. N. (1999). Changes in 24 hour heart
(2009). Psychosocial stress and change in weight among US rate variability during normal pregnancy. American Journal of
adults. American Journal of Epidemiology, 170, 181–192. Obstetrics and Gynecology, 180, 978–985.
5. Nielsen, N. R., Zhang, Z. F., Kristensen, T. S., Netterstrom, B., 23. Achten, J., & Jeukendrup, A. E. (2003). Heart rate monitoring:
Schnohr, P., & Gronbak, M. (2005). Self reported stress and risk Applications and limitations. Sports Medicine, 33, 517–555.
of breast cancer: Prospective cohort study. British Medical 24. Burger, A. J., Charlamb, M., & Sherman, H. B. (1999). Circadian
Journal, 331, 548–550. patterns of heart rate variability in normals, chronic stable angina
6. Freeman, J. B., Garcia, A. M., Fucci, C., Karitani, M., Miller, L., and diabetes mellitus. International Journal of Cardiology, 71,
& Leonard, H. L. (2003). Family-based treatment of early-onset 41–48.
obsessive-compulsive disorder. Journal of Child and Adolescent 25. Niskanen, J. P., Tarvainen, M. P., Ranta-aho, P. O., & Kar-
Psychopharmacology, 13, 71–80. jalainen, P. A. (2004). Software for advanced HRV analysis.
7. K. S. Yoo and W. H. Lee (2011) Mental stress assessment based Computer Methods and Programs in Biomedicine, 76, 73–81.
on pulse photoplethysmography, IEEE 15th International Sym- 26. Thayer, J. F., Yamamoto, S. S., & Brosschot, J. F. (2010). The
posium on Consumer Electronics Electronics, 323–326 relationship of autonomic imbalance, heart rate variability and
8. Ramirez, A. J., Graham, J., Richards, M. A., & Gregory, W. M. cardiovascular disease risk factors. International Journal of
(1996). Mental health of hospital consultants: the effects of stress Cardiology, 141, 122–131.
and satisfaction at work. The Lancet, 347, 724–728. 27. Hayes, M. H. (1996). Statistical digital signal processing and
9. Prosser, D., Johnson, S., Kuipers, E., Szmukler, G., Bebbington, modelling. New York: John Wiley & Sons.
P., & Thornicroft, G. (1997). Perceived sources of work stress 28. Dorukl, A., Turkbay, T., Yelbo, Z., Ciyiltepe, M., Iyisoy, A.,
and satisfaction among hospital and community mental health Sutcigil, L., & Ozflahin, A. (2008). Autonomic nervous system
staff, and their relation to mental health, burnout and job satis- imbalance in young adults with developmental stuttering. Bulletin
faction. Journal of Psychosomatic Research, 43, 51–59. of Clinical Psychopharmacology, 18, 274–281.
10. Okada, Y., Yoto, T. Y., Suzuki, T., Sakuragawa, S., Sakakibara, 29. Saul, J. P. (1990). Beat-to-beat variations of heart rate reflect
H., Shimoi, K., & Sugiura, T. (2013). Wearable ECG recorder modulation of cardiac autonomic outflow. News in Physiological
with acceleration sensors for monitoring daily stress. Journal of Sciences, 5, 32–37.
Medical and Biological Engineering, 33, 420–426. 30. Pagani, M., Rimoldi, O., Pizzinelli, P., Furlan, R., Crivellaro, W.,
11. Tikkanen, P. E., Sellin, L. C., Kinnunen, H. O., & Huikuri, H. V. Liberati, D., et al. (1991). Assessment of the neural control of the
(1999). Using simulated noise to define optimal QT intervals for circulation during psychological stress. Journal of the Autonomic
computer analysis of ambulatory ECG. Medical Engineering & Nervous System, 35, 33–42.
Physics, 21, 15–25. 31. Satish, S. C., Rao, M. D., Renae, A. H., Jerry, M. S., & Mindi, J.
12. Übeyli, E. D. (2007). ECG beats classification using multiclass C. (1998). Psychological and physical stress induce differential
support vector machines with error correcting output codes. effects on human colonic motility. American Journal of Gas-
Digital Signal Processing, 17, 675–684. troenterology, 93, 985–990.
13. Chandola, T., Britton, A., & Brunner, E. (2008). Work stress and 32. Leor-Librach, R. J., Eliash, S., Kaplinsky, E., & Bobrovsky, B. Z.
coronary heart disease: what are the mechanisms? European (2003). Very low-frequency heart rate variability wave amplitude
Heart Journal, 29, 640–648. and sympathetic stimulation-characterization and modeling.
14. Kumar, M., Weippert, M., Vilbrandt, R., Kreuzfeld, S., & Stoll, IEEE Transactions on Biomedical Engineering, 50, 797–803.
R. (2007). Fuzzy evaluation of heart rate signals for mental stress 33. Shusterman, V., & Barnea, O. (2005). Sympathetic nervous
assessment. IEEE Transactions on Fuzzy Systems, 15, 791–808. system activity in stress and biofeedback relaxation. IEEE
15. Ranganathan, G., Rangarajan, R., & Bindhu, V. (2012). Estima- Engineering in Medicine and Biology Magazine, 24, 52–57.
tion of heart rate signals for mental stress assessment using neuro 34. Karthikeyan, P., Murugappan, M., & Yaacob, S. (2011). ECG
fuzzy technique. Applied Soft Computing, 12, 1978–1984. signals based mental stress assessment using wavelet transform.
16. Langley, J. N. (1921). The autonomic nervous system, Part I. Proceedings of the 2011 IEEE International Conference on
Cambridge: W. Heffer and Sons. Control System, Computing and Engineering, pp. 258–262.
17. Croiset, G., Nijsen, M. J., & Kamphuis, P. J. (2000). Role of 35. Mokhayeri, F., & Akbarzadeh-T, M. R. (2011). Mental stress
corticotrophin releasing factor, vasopressin and the autonomic detection based on soft computing techniques. Proceedings of

123
844 H.-S. Chiang

IEEE International Conference on Bioinformatics and Biomedi- 42. Christensen, R. (1980). Entropy minimax sourcebook volume III:
cine, pp. 430–433. Computer implementation. Lincoln, Massachusetts: Entropy
36. De Santos Sierra, A., Sanchez Avila, C., Bailador del Pozo, G., & Limited.
Guerra Casanova J. (2011). Stress detection by means of stress 43. Ross, T. J. (2010). Fuzzy logic with engineering applications.
physiological template. Proceedings of the 2011 Third World Hoboken: John Wiley & Sons Ltd.
Congress on Nature and Biologically Inspired Computing, 44. Shih, D. H., Chiang, H. S., & Lin, B. (2007). A generalized
pp. 131–136. associative petri net for reasoning. IEEE Transactions on
37. Adnane, M., Jiang, Z., Mori, N., & Matsumoto, Y. (2011). An Knowledge and Data Engineering, 19, 1241–1251.
automated program for mental stress and apnea/hypopnea events 45. Agrawal, R., Imielinski, T., & Swami, A. (1993). Database
detection. Proceedings of the 2011 7th International Workshop mining: A performance perspective. IEEE Transactions on
on Systems, Signal Processing and their Applications, pp. 59–62. Knowledge and Data Engineering, 5, 914–925.
38. Physionet Dataset: Stress Recognition in Automobile Drivers 46. Deng, Y., Hsu, D. F., Wu, Z. & Chu, C. H. (2012a). Feature
(2015). http://physionet.nlm.nih.gov/pn3/drivedb/. selection and combination for stress identification using correla-
39. Friesen, G., Jannett, T., Jadallah, M., Yates, S., Quint, S., & tion and diversity, pervasive systems. Proceedings of the 12th
Nagle, H. (1990). A comparison of the noise sensitivity of nine International Symposium on Algorithms and Networks,
QRS detection algorithms. IEEE Transactions on Biomedical pp. 37–43.
Engineering, 37, 85–98. 47. Deng, Y., Wu, Z., Chu, C. H., & Yang, T. (2012b). Evaluating
40. Jung, W. H., & Lee, S. G. (2012). An R-peak detection method feature selection for stress identification. Proceedings of the IEEE
that uses an SVD filter and a search back system. Computer 13th International Conference on Information Reuse and Inte-
Methods and Programs in Biomedicine, 108, 1121–1132. gration, pp. 584–591.
41. So, H. H., & Chan, K. L.(1997). Development of QRS detection 48. Wang, J. S., Lin, C. W., & Yang, Y. T. (2013). A k-nearest-
method for real-time ambulatory cardiac monitor. Proceedings of neighbor classifier with heart rate variability feature-based
IEEE 19th Annual International Conference. Engineering in transformation algorithm for driving stress recognition. Neuro-
Medicine and Biology Society, pp. 289–292. computing, 116, 136–143.

123

You might also like