# Identifying Human Daily Activity Types with Time-Aware Interactions
## 3 Methods
### Identify HATs  
The unique capability of graphs enables capturing the structural relations among posts, thereby allowing us to harvest more insights compared with analyzing post texts in isolation. As shown in Figure 1, a heterogeneous graph module can be formed by taking the words, posts, dates, and users as nodes and the interactions between them as edges. Through the three types of interactions defined in Sections 3.1-3.3, we can get the \"user-post-word\" graph. The number of nodes in the graph is the number of posts (dataset size) plus the number of unique words (vocabulary size) and the number of users. Then, the \"user-date-word\" graph module can be built by replacing the post nodes in the \"user-post-word\" graph with the date nodes. The built \"user-post-word\" graph and \"user-date-word\" graph can be defined as \(G_{post}=\left(V_{post},E_{post}\right)\) and \(G_{date}=\left(V_{date},E_{date}\right)\), respectively, where \(V\) and \(E\) are the sets of nodes and edges. Recently emerging GCN [25] model can capture the local features and classify nodes in graphs effectively, which is a multiple layer neural network that generally operates a graph network and generates embedding vectors for nodes based on the properties of their neighbor nodes. It has made a significant improvement in node classification and provides a new opportunity to achieve our task. Thus, the local and global node co-occurrence can be explicitly modeled. Meanwhile, the relation between four types of nodes (users, posts, dates, and words) can be modeled. As a result, human activity types can be examined from local and global factors. In this paper, the built graphs (\"user-post-word\" graph under text view and \"user-date-word\" graph under time view) are fed into a multi-view activity GCN (TG-HAGCN) as illustrated in Figure 2. Thus, the identification of human activities in a post can be regarded as a node classification task. The TG-HAGCN model contains two GCN modules, which are used to process \"user-post-word\" graph and \"user-date-word\" graph respectively. Then, for the post embeddings and date embeddings obtained by the two GCN modules, this model uses a gating mechanism to fuse them. At last, the fused embeddings are fed to a Softmax classifier for predicting HATs. The model defines \(X\in R^{m\times m}\) as a feature matrix containing \(n\) nodes with their feature vectors and \(m\) as the dimension of the feature vectors. The initial features of date nodes are their corresponding date vectors. Specifically, each date vector is encoded by four parts: 4-digit season, 12-digit month, 1-digit working day, 1-digit weekend day, and 7-digit week, where each part is represented by a one-hot vector. The initial feature vectors of words and users for GCN input is random initialized. The initial features of post nodes are the mean value of all the words they contain. The GCN modules capture information from neighbor nodes, which are two-layer GCNs and can be defined as follows:  
\[L^{(j+1)}=\rho\Big{(}\widetilde{A}L^{(j)}W_{j}\Big{)}, \tag{4}\]  
where \(j\) is the layer number and \(L^{(0)}=X;\widetilde{A}=D^{-\frac{1}{2}}AD^{\frac{1}{2}}\) is the symmetric normalized adjacency matrix; \(A\) is the adjacency matrix of graph \(G\) whose diagonal elements are 1; \(D\) is the degree matrix of \(G\), where \(D_{ii}=\sum\limits_{j}A_{ij}\); \(W_{j}\in R^{m\times k}\) is a weight matrix; and \(\rho\) is an activation function. By taking \"user-post-word\" graph \(G_{post}\) and \"user-date-word\" graph \(G_{date}\) as the input of two-layer GCN, the embeddings of post nodes and date nodes, \(L_{post}\) and \(L_{date}\), can be obtained, respectively. \[ \begin{split} L_{post}&=f_{post\_mask}\Big{(} \widetilde{A}_{G_{post}}ReLU\Big{(}\widetilde{A}_{G_{post}}X_{G_{post}}W_{0}^{ G_{post}}\Big{)}W_{1}{}^{G_{post}}\Big{)}\,\\ L_{date}&=f_{date\_mask}\Big{(}\widetilde{A}_{ G_{date}}ReLU\Big{(}\widetilde{A}_{G_{date}}X_{G_{date}}W_{0}^{G_{date}}\Big{)}W_{1} {}^{G_{date}}\Big{)}\,\end{split}