## 5 EEG-Based Multidimensional Emotion Recognition Model
### Partial Fluctuation Pattern Quantification Algorithm  
The partial fluctuation pattern quantification (PFPQ) algorithm is applied to discover the criteria rules of recognition of EEG-based emotions. The pseudo code of PFPQ is shown at Algorithm 2.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Definition** \\ \hline _MN_ & The matched number of PFP sequences. \\ _Acc_ & The accumulation of intensity values in matched PFP sequences. \\ _Den_ & The ratio of the _MN_ to the number of PFP sequences. \\ _Rep_ & The repetitive rate of the same matched rules. \\ _Pol_ & The occurred rate of matched polynomial rules. \\ \(Int_{i}\) & Intensity value of _ith_ matched PFP sequence. \\ _IIm_ & The number of PFP in signal. \\ _Mx_ & The maximum length in criterial rule. \\ _Sm_ & The number of same matched PFP sequences. \\ _MIj_ & The number of matched PFP sequences with combination length of \(j\). \\ \hline \hline \end{tabular}
\end{table}
Table 4: Parameters in Calculation of PFP Features.  
```
1:Input:
2 EG signals as \(ES\)
3:Output:
4:Criteria rule for recognition of emotions as RR and PFP features as PFPs
5:Begin
6:forc = 0, \(c\) < 32, \(c\)++ do
7:Transform \(ES_{c}\) with Wavelet transform into 4 bands as \(WES_{c}\);
8:for\(i\) = 0, \(i\) < 4, \(i\)++ do
9: Detect wave crest and trough of \(WES_{c,i}\) as \(WCT_{c,i}\);
10: Transform \(WCT_{c,i}\) according to the amplitude to A-E as \(AE_{c,i}\);
11:\(RE_{c,i}=AE_{c,i}\)_split(\"E\");
12:Build tree structure of \(RE_{c,i}\) based on frequency as \(RETree_{c,i}\);
13: Set support threshold as \(st_{c,i}\), confidence threshold as \(ct_{c,i}\);
14:for\(k\) = 0, \(k\) < length(\(RETree_{c,i}\)), \(k\) ++ do
15: Search sequence on tree structure as _seq_, and frequency of _seq_ as _seq_;
16:if\(seq\) > \(st_{c,i}\) then
17:\(RR\) += [_seq,seq_];
18: Add next tree node to _seq_ as _seq-nod_, the frequency of seq-nod as _find_;
19:if\(\textit{fnot}>ct_{c,i}\)then
20:\(AR\) += [_seq-nod_, _find_];
21:endif
22:endif
23:endfor
24:\(RR\) += \(AR\);
25:\(sr\) = new array[9];
26:for\(p\) = 0, \(p\) < length(\(RR\)), \(r\)++ do
27:if length (\(RR_{p}\)) == 1 then
28: Label \(RR_{p}\) as \"Representative\" rule;
29:else do Calculate emotional similarity of \(RR_{p}\) as _es_;
30:if\(\varepsilon\)s matches threshold value in \(sr\)then
31: Label \(RR_{p}\) as subcategory of similar rule;
32:endif
33:endif
34:endfor
35:PFPs = new array [];
36: Joint \(RE_{c,i}\) as a bidimensional hash set of combined sequences \(CSS\);
37:for\(s\) = 0, \(s\) < length(\(CSS\)), \(s\)++ do
38:for\(r\) = 0, \(r\) < length(\(RR\)), \(r\)++ do
39:for\(s\) = 0, \(ss\) < length(\(CSS[s]\)), ss++ do
40:if\(CSS[s][ss]\) == \(RR_{r}[0]\) then
41:\(MN\)++;
42:\(Acc\) + \(RR_{r}[1]\);
43:\(MR[s]\) += [\(RR_{r}[0]\)]
44:if\(CSS[s][ss]\) in \(MR\) then
45:\(Sm\)++;
46:endif
47:endif
48:endif
49:endfor
50:endfor
51:\(Den\) = (2*MN)/((2*length(\(RE_{c,i}\)) - length(\(CSS\))) * (length(\(RE_{c,i}\)) - length(\(CSS\)) + 1));
52:\(Rep\) = \(Sm\)/\(MN\);
53:\(Pol\) = (\(MN\)-\(MR[0]\))/\(MN\);
54:PFPs = [_MN_, _Acc_, _Den_, _Rep_, _Pol_]
55:endfor
56:return\(RR\)
```  
**Algorithm 2. PFPQ**