Está en la página 1de 22

Automatic Sleep Classification using

Fuzzy Logic
By Jaime Barragan

Abstract
Sleep disorders affect more than 40 millions in America. For the diagnostic and
evaluation of the most of these disorders, it is needed a hypnogram chart which consists
of classifying the sleep stages on 6 different stages from the body signals previously
obtained from the polysomnogram study.

Introduction
The 6 different sleep stages, which are classified in 30-second periods known as
epochs and graphed on the hypnogram, are: Awake (AWK), Stage 1 (S1), Stage 2 (S2),
Stage 3 (S3), Stage 4 (S4), and Rapid Eye Movement (REM). The signals, extracted from
the polysomnogram, utilized to obtain these sleep stage are: Electroencephalogram
(EEG), Electrooculugram (EEG), and Electromiogram (EMG). The sleep stages are
manually sorted following these rules (R&K scoring):

AWK: Its brain activity is composed by more of 50% of alpha waves (8 -13 Hz), eye
movement (EOG) and high muscular activity (EMG)
S1: Its brain activity is composed by more of 50% of theta waves (4 – 8 Hz), and
medium muscular activity (EMG)
S2: Its brain activity has a theta waves background with the presence of K-complexes
(abrupt variance in brain activity) and low muscular activity.
S3: Its brain activity is characterized from 20% to 50% delta waves (0.5 to 4 Hz) and
low muscular activity.
S4: Brian activity is composed by more than 50% of delta waves and slow muscular
activity.
REM: Ocular activity is big in this sleep stage, but its brain activity is not determined
by a specific sleep wave.
Experimental Procedure
A fuzzy system is implemented to classify the sleep stages. This system is based
on the rules to manually classify the stages. The procedure follows these steps:
1. Data Acquisition: Data is acquired from 6 different patients.
2. Feature extraction: Percentage of the power of the relative band is obtained.
Also EOG and EMG thresholds are selected.
3. Fuzzification: Percentages of the EEG signal in the different bands are
transformed to fuzzy values.
4. Rule based system. Rules are implemented based on the R&K scoring.
5. Defuzzification: The probability of been on each of the 3 sleep stages and a
subgroup of other 3 sleep stages is obtained.
6. Final classification: The sleep stage is determined by selecting the stage with
the most probable stage with the combination of the EOG and EMG switches if
the subgroup of stages is the most probable.

Data Acquisition
The data was obtained from 6 patients of the data bank provided by
http://www.physio.net/ website.

Fuzzification
4 signals are considered inputs of the fuzzy system: the power percentages of
delta waves, theta waves, alpha waves, and beta waves. Each of these waves is fuzzified
applying the following classes.
Rules
A total of 34 classes are implemented based on the R&K scoring.
• For AR1(9 rules):
IF beta is “high” THEN AR1 is "high”
IF beta is “medium” THEN AR1 is "medium”
IF beta is “low” THEN AR1 is "low”
IF alpha is “high” THEN AR1 is "high”
IF alpha is “medium” THEN AR1 is "medium”
IF alpha is “low” THEN AR1 is "low”
IF delta is “high” THEN AR1 is "low”
IF delta is “medium” THEN AR1 is "medium”
IF delta is “low” THEN AR1 is "high”
• For S2 (8 rules):
IF beta is “high” THEN S2 is "medium”
IF alpha is “high” THEN S2 is "medium”
IF alpha is “medium” THEN S2 is "high”
IF alpha is “low” THEN S2 is "medium”
IF theta is “high” THEN S2 is "high”
IF theta is “medium” THEN S2 is "medium”
IF theta is “low” THEN S2 is "low”
IF delta is “high” THEN S2 is "low”
• For S3 (9 rules):
IF beta is “high” THEN S3 is "low”
IF alpha is “high” THEN S3 is "low”
IF alpha is “medium” THEN S3 is "medium”
IF theta is “high” THEN S3 is "high”
IF theta is “medium” THEN S3 is "high”
IF theta is “low” THEN S3 is "low”
IF delta is “high” THEN S3 is "medium”
IF delta is “medium” THEN S3 is "high”
IF delta is “low” THEN S3 is "medium”
• For S4 (8 rules):
IF beta is “low” THEN S4 is "medium”
IF alpha is “high” THEN S4 is "low”
IF theta is “high” THEN S4 is "medium”
IF theta is “medium” THEN S4 is "high”
IF theta is “low” THEN S4 is "medium”
IF delta is “high” THEN S4 is "high”
IF delta is “high” THEN S4 is "high”
IF delta is “medium” THEN S4 is "medium”
IF delta is “low” THEN S4 is "low”
Defuzzification
The fuzzy system is compound of 4 outputs: Stage 2 (S2), Stage 3 (S3), Stage 4
(S4) and the Awake, REM, and Stage 1 (ARS1) group. The defuzzification procedure
used on each input is the centroid defuzzification based on the following classes:

Final Classification
This procedure is applied to select the sleep stage in the case that the most
probable output be ARS1 group. For this classification, the following logic statements are
considered:
IF ARS1 AND EMG(activity) THEN Awake
ELSE IF ARS1 AND EOG(activity) THEN REM
ELSE Stage 1

Results
a) Ideal data:
The system was designed and tested using real data. These real data is
composed by randomly generated features. Then this data is classified by the
fuzzy system. The system accuracy was 98.3%.
b) Real data:
The system was evaluated using features extracted from the EEG, EOG, and
ECG signals. The result accuracy was 51.5%. The features extracted varied a
lot from the ones specified on the R&K scoring. On the following image, the
energy in the alpha wave must represent from 5 to 50% of the signal.
Conclusions
• Considering ideal data, the fuzzy logic system design is a very good tool to
represent R&K scoring.
• Human intervention is possible when similar stages characteristic are found;
this is possible because the probability of each output is computed.
• Better features are needed since the one computed from the energy bands
aren’t complaining the R&K scoring.
Automatic Sleep Stage
Classification

By Jaime Barragan
Outline
• Introduction
• Motivation
• Approach
• Data Acquisition
• Fuzzification
• Rule-based system
• Defuzzification
• Result
• Conclusion
Introduction
One night of Sleep behavior, hypnogram,
is computed in 30-second epochs
observing Electroencephalogram (EEG),
Electroculugram (EOG), and
Electromiogram (EMG). These signals and
other are recorded on the
polysomnogram diagnostic procedure.
Introduction
• Rechtschaffen and Kales (R&K) scoring:
Sleep Signals Activity Band Bandwidth
Stage Delta 0.5-4
Wake EMG, Alpha & Beta waves Theta 4-8
Stage 1 Theta >50%, Alpha <50% Alpha 8-12
Stage 2 Theta, K Complex, Low EMG Beta 12-45
Stage 3 Theta,20%<Delta<50%, EEG
signal in EOG, Lower EMG.
Stage 4 Delta>50%, Lowest EMG.
REM EOG, Alpha & Beta waves
Motivation
• “From 50 million to 70 million Americans
experience chronic sleep disorders, while
millions more are sleep-deprived”
[http://news.xinhuanet.com]

• Sleep classification: Manual process by


sleep specialist.
Approach
• Obtain features from EEG (Energy band), EOG
(threshold) and EMG (threshold) signals.
• Fuzzification of features (beta, alpha, theta,
delta).
• Ideal case: Apply “IF-THEN” rules directly from
R&K scoring.
• Difuzzification on percentage of 4 stages (ARS1,
S2, S3, and S4).
• Apply threshold if ARS1.
Data Acquisition
• EEG, EOG, and EMG signals; and Sleep
stage classification of 5 patients acquired
from physionet.org.
• Threshold: EOG(mean) > 5.0 mV and
EMG(mean) > 3.4mV
• Features:

Power Energy Band


RPEB = x100
Total Power Content
Fuzzification
• Each feature (beta, alpha, theta and delta)
is mapped into 3 classes (low, medium
and high) that describe the percentage of
each wave on the EEG signal.
“IF-THEN” Rules
• For AR1(9 rules):
outputAR1.addRule(rulebh,"high");
outputAR1.addRule(rulebm,"medium");
outputAR1.addRule(rulebl,"low");
outputAR1.addRule(ruleah,"high");
outputAR1.addRule(ruleam,"medium");
outputAR1.addRule(ruleal,"low");
outputAR1.addRule(ruledh,"low");
outputAR1.addRule(ruledm,"medium");
outputAR1.addRule(ruledl,"high");
IF-THEN” Rules
• For S2 (8 rules):
outputS2.addRule(rulebh,"medium");
outputS2.addRule(ruleah,"medium");
outputS2.addRule(ruleam,"high");
outputS2.addRule(ruleal,"medium");
outputS2.addRule(ruleth,"high");
outputS2.addRule(ruletm,"medium");
outputS2.addRule(ruletl,"low");
outputS2.addRule(ruledh,"low");
“IF-THEN” Rules
• For S3 (9 rules):
outputS3.addRule(rulebh,"low");
outputS3.addRule(ruleah,"low");
outputS3.addRule(ruleam,"medium");
outputS3.addRule(ruleth,"high");
outputS3.addRule(ruletm,"high");
outputS3.addRule(ruletl,"low");
outputS3.addRule(ruledh,"medium");
outputS3.addRule(ruledm,"high");
outputS3.addRule(ruledl,"medium");
“IF-THEN” Rules
• For S4 (8 rules):
outputS4.addRule(rulebh,"low");
outputS4.addRule(ruleah,"low");
outputS4.addRule(ruleth,"medium");
outputS4.addRule(ruletm,"high");
outputS4.addRule(ruletl,"medium");
outputS4.addRule(ruledh,"high");
outputS4.addRule(ruledm,"medium");
outputS4.addRule(ruledl,"low");
Defuzzification
• Each output (AR1, S2, S3, S4) is
representing by a 3 classes (low, medium
and high) that describe the percentage of
each stage on the sleep epoch.
• Centroid Defuzzification
• Finally, if the resulting stage is AR1, the
next rule is applied:
IF EMG(high) THEN AWK, ELSE
{IF EOG(high) THEN REM, ELSE S1}
Defuzzification
Results
• For an ideal case:
Accuracy = 98.3% (196,68211 correct of 20,000,000)
• For patient values case:
Accuracy = 51.5*% (220 correct of 427)
*It continues improving while tuning up input classes
definition.

Alpha Band
Conclusions
• Fuzzy logic adapts very well to the R&K
scoring system because it is very based
on human appreciation.
• Obtaining the probability of each stage
increment the robustness of the system
because when 2 outputs percentage are
similar, the system would request human
intervention.
• Better features are needed.
Thank you!!!

También podría gustarte