# Multi-Hypergraph Neural Networks for Emotion Recognition in Multi-Party Conversations
## 3 Methodology  
### Hypergraph Definition  
A hypergraph is defined as \(HG=(V,E)\), where \(V=\{v_{1},v_{2},\ldots,v_{N}\}\) is a node set, and \(E=\{HE_{1},HE_{2},\ldots,HE_{N}\}\) is a collection of hyperedges. A hyperedge \(HE_{m}\) is a subset of the node set \(V\), that is, the node set belonging to hyperedge \(HE_{m}\) is a subset of \(V\). The structure of a hypergraph HG can also be represented by an incidence matrix A, with entries defined as in Equation (1):  
\[A_{ij}=\begin{cases}0,&v_{i}\
otin HE_{j},\\ 1,&v_{i}\in HE_{j}\end{cases} \tag{1}\]We use \(X=\{x_{1},x_{2},\ldots,x_{N}\}\) to denote the attribute vector of nodes in the hypergraph. So, the hypergraph can also be represented by \(HG=(A,X)\). In this paper, we use matrix M to store the relative position weight of an utterance in the hypergraph. The structure of matrix M is similar to that of the incidence matrix A. Each row in M corresponds to a hyperedge, and the non-zero items in each row represent the utterance node in this hyperedge. The size of the non-zero items is related to the positions between nodes in the hyperedge. In the following, we use \(HG=(M,X)\) to represent the hypergraph.  
**Vertices.** Each utterance in a conversation is represented as a node \(v_{i}\in V\). Each node \(v_{i}\) is initialized with the utterance embeddings \(h_{i}\). We update the embedding representations of vertices via hypergraph convolution.  
**Hyperedge.** Since each hyperedge is generated based on a specific current utterance, we need to calculate the influences of other utterances on the current utterance, and these influences will be weakened according to the relative position between the utterances. We set the position weight of the current utterance to 1, and the position weight of the remaining utterances gradually decreases with the relative distance. See Algorithm 1 for the specific process of hypergraph and hyperedge construction.  
```
0: the dialogue \(\{h_{1},h_{2},\ldots,h_{N}\}\), speaker identity \(p(\cdot)\), and context window \(w\).
0:\(SSHG,NSHG\).
1:\(X\leftarrow\{h_{1},h_{2},\ldots,h_{N}\}\)
2:\(M_{SSHG},M_{NSHG}\leftarrow\emptyset,\emptyset\)
3:for all\(i\in[1,N]\)do
4:\(M^{i}_{SSHG},M^{i}_{NSHG}\leftarrow\{0,0,\ldots,0\},\{0,0,\ldots,0\}//\) N zero in total
5:\(w_{p},w_{f},\) count \(i-w,i+w,0\)\(/\)\(/\)\(w_{p},w_{f}\in[1,N]\)
6:\(M^{i}_{NSHG}[i]\gets 1\)
7:for\(j=w_{p}\); \(<=w_{f}\); \(j++\)do
8:if\(p(h_{i})=p(h_{j})\)then
9:\(M^{i}_{SSHG}[j]\gets 1/(1+\mathbf{abs}(i-j))\)
10: count++
11:elseif\(p(h_{i})!=p(h_{j})\) and \(count=0\)then
12:\(M^{i}_{NSHG}[j]\gets 1/(1+\mathbf{abs}(i-j))\)
13:endif
14:endfor
15:endfor
16:\(SSHG\leftarrow(M_{SSHG},X)\)
17:\(NSHG\leftarrow(M_{NSHG},X)\)
18:return\(SSHG,NSHG\)
```  
**Algorithm 1** Constructing a Hypergraph  
We designed two kinds of hypergraphs--one is speaker-specific hypergraph (SSHG), and the other is a non-speaker-specific hypergraph (NSHG). The hyperedges in the SSHG are speaker-specific hyperedges (SSHEs). We selected some utterances in the context window to add to the SSHEs, and the speaker of these utterances was the same as the speaker of the current utterance. The hyperedges in the NSHG were non-speaker-specific hyperedges (NSHEs). We take the past utterance of the speaker of the current utterance as a selective constraint and selected some utterances in the context window to add to the NSHEs. The speakers of these utterances were different from the speaker of the current utterance.