# Graph-based Method for App Usage Prediction with Attributed Heterogeneous Network Embedding
## 3 Graph-Based App Usage Prediction
### Representation Learning  
The application prediction issue is related to future factors such as time and location, which will generate new temporal nodes constantly. Therefore, we use the _GATNE-I_ model proposed in [32] to capture both topological structures from different types of node, edge, and attributed information on the large attributed heterogeneous network for the representation learning. This model can handle nodes that are not seen during training that is suitable for App usage prediction because the future time is definitely new nodes never seen before. In the _GATNE-I_ model, the overall embedding of a certain node \(v_{i}\) on each edge type \(r\) is:  
\[v_{i,r}=h_{z}(x_{i})+\alpha_{r}M_{r}^{T}U_{i}a_{i,r}+\beta_{r}D_{z}^{T}x_{i}. \tag{2}\]  
\(x_{i}\) is defined as an attribute vector of the node \(v_{i}\) and \(h_{z}(x_{i})\) is a transformation function, whose role is to add its own characteristics to the final result and its base embedding for node \(v_{i}\). \(a_{i,r}\) is computed according to the self-attention mechanism [33] as the coefficients of a linear combination of vectors. \(D_{z}\) is a feature transformation matrix on \(v_{i}\)'s corresponding node type \(z\), designed for the purpose of new nodes isolated from all nodes in the existing graph. \(U_{i}\) is defined as a matrix, which integrates three types of edges' embedding of one node respectively in three sub-graphs so that every node's embedding in different sub-graphs can be calculated for each edge type during the model training process. The embedding of the three edges of each node is represented by the mean value of the attributes of a certain number of neighbor nodes corresponding to the three graphs. In this paper, there are three types of edges: application and time, application and location, application and the previous application, where we use edges separately in \"usedTime\" sub-graph, \"usedLocation\" sub-graph, \"precede\" sub-graph to express three types of relationships. Figure 2: An example attributed heterogeneous network for App usage prediction. express edge embedding of one node respectively in \"usedTime\" sub-graph, \"usedLocation\" sub-graph, \"precede\" sub-graph, and we use the mean of a fixed number of neighbors' embedding to represent edge embedding of one node in one type of sub-graph. In the future, the integration of all neighbor embedding or the multi-hop neighbor embedding can be used as one part of the embedding of the nodes for the propose of comparison. Thus, in Equation (2), \(U_{i}=(u_{i,t},u_{i,l},u_{i,p})\). Taking \"usedTime\" sub-graph as an example, due to only a connection between application and time, there is no link between application nodes or time nodes themself. Thus, the \(k\)-th level edge embedding \(u_{i,t}^{(k)}\in R^{s},(1\leq k\leq K)\) of time node \(v_{i}\) in the \"usedTime\" sub-graph is aggregated from neighbors' edge embeddings as:  
\[u_{i,t}^{(k)}=\sigma(W^{(k)}\cdot mean(\{u_{j,t}^{(k-1)},\forall v_{j}\in N_{i, t}\})), \tag{3}\]  
where \(N_{i,t}\) is the neighbors of time node \(v_{i}\) in the \"usedTime\" sub-graph and neighbors are application nodes. Attributes of time nodes reflect all applications used in a specific time. Similarly, the neighbors of App node in the \"usedTime\" sub-graph are application nodes. Attributes of App nodes reflect all the execution time of one application. Then, we define \(v_{i,t},v_{i,l},v_{i,p}\) as embedding of time, location and the previous App nodes in the \(i-th\) record. Through network embedding, three types of embedding of node \(v_{i}\) can be obtained:  
* \(v_{i,t}=\{v_{i,t}^{1},v_{i,t}^{2},...,v_{i,t}^{n}\}\), in \"usedTime\" sub-graph
* \(v_{i,l}=\{v_{i,l}^{1},v_{i,l}^{2},...,v_{i,l}^{n}\}\), in \"usedLocation\" sub-graph
* \(v_{i,p}=\{v_{i,p}^{1},v_{i,p}^{2},...,v_{i,p}^{n}\}\), in \"precede\" sub-graph  
where \(v_{i,t}^{n}\) represents the \(n-th\) element in the vector \(v_{i,t}\), and \(v_{i,l}^{n}\), \(v_{i,p}^{n}\) do so.