# Modeling E-Behaviour, Personality and Academic Performance with Machine Learning
## 2 Methodology
### Long Short-Term Memory
Then, in Equations (18) through (23):\[\frac{\partial\mathbf{E}}{\partial\mathbf{W}}=\sum_{t=1}^{T}\frac{\partial \mathbf{E}}{\partial\mathbf{y}_{t}}\frac{\partial\mathbf{y}_{t}}{\partial \mathbf{h}_{t}}\frac{\partial\mathbf{h}_{t}}{\partial\mathbf{h}_{k}}\frac{ \partial\mathbf{h}_{k}}{\partial\mathbf{W}}, \tag{10}\]4 \[\frac{\partial\mathbf{E}}{\partial\mathbf{W}}=\sum_{t=1}^{T}\frac{\partial \mathbf{E}}{\partial\mathbf{y}_{t}}\frac{\partial\mathbf{y}_{t}}{\partial \mathbf{h}_{t}}\frac{\partial\mathbf{h}_{t}}{\partial\mathbf{h}_{k}}\frac{ \partial\mathbf{h}_{k}}{\partial\mathbf{W}}, \tag{10}\]5 (25) \[\frac{\partial\mathbf{E}}{\partial\mathbf{W}}=\sum_{t=1}^{T}\frac{\partial \mathbf{E}}{\partial\mathbf{y}_{t}}\frac{\partial\mathbf{y}_{t}}{\partial \mathbf{h}_{t}}\frac{\partial\mathbf{h}_{t}}{\partial\mathbf{h}_{k}}\frac{ \partial\mathbf{h}_{k}}{\partial\mathbf{W}}, \tag{10}\]6 (26) \[\frac{\partial\mathbf{E}}{\partial\mathbf{W}}=\sum_{t=1}^{T}\frac{\partial \mathbf{E}}{\partial\mathbf{y}_{t}}\frac{\partial\mathbf{y}_{t}}{\partial \mathbf{h}_{t}}\frac{\partial\mathbf{h}_{t}}{\partial\mathbf{h}_{k}}\frac{ \partial\mathbf{h}_{k}}{\partial\mathbf{W}}, \tag{10}\]7 (27) \[\frac{\partial\mathbf{E}}{\partial\mathbf{W}}=\sum_{t=1}^{T}\frac{\partial \mathbf{E}}{\partial\mathbf{y}_{t}}\frac{\partial\mathbf{y}_{t}}{\partial \mathbf{h}_{t}}\frac{\partial\mathbf{h}_{t}}{\partial\mathbf{h}_{k}}\frac{ \partial\mathbf{h}_{k}}{\partial\mathbf{W}}, \tag{10}\]8  
For an illustration, refer to \[\frac{\partial\mathbf{E}}{\partial\mathbf{W}}=\sum_{t=1}^{T}\frac{\partial \mathbf{E}}{\partial\mathbf{y}_{t}}\frac{\partial\mathbf{y}_{t}}{\partial \mathbf{h}_{t}}\frac{\partial\mathbf{h}_{t}}{\partial\mathbf{h}_{k}}\frac{ \partial\mathbf{h}_{k}}{\partial\mathbf{W}}, \tag{10}\]9 The LSTM had four main gates that responded to the values of four functions determined by \(\mathbf{f},\mathbf{i},\mathbf{c}\) and \(\mathbf{o}\), represented in Equations (18) through (21). With the input data matrix \(\mathbf{x}_{t}\) (data vector if \(B=1\)) concatenated with previous output matrix \(\mathbf{h}_{t-1}\) (vector if \(B=1\)), the flow of inputs and outputs from the various gates described in the LSTM equations interacted as follows:  
1. \(\mathbf{h}_{t-1}\) and \(\mathbf{X}_{t}\) were fed into the gate (or function) \(\mathbf{f}\), where the output \(\mathbf{f}_{t}\) laid in the open interval \((0,1)\). \(\mathbf{f}_{t}\) then interacted with previous cell state \(\mathbf{c}_{t-1}\) through element-wise multiplication \(\mathbf{\upbeta}\); thus, \(\mathbf{c}_{t-1}\) held an interim cell state, \(\mathbf{f}_{t}\mathbf{c}_{t-1}\). At this stage, \(\mathbf{f}_{t}\mathbf{c}_{t-1}\) represented a state that had forgotten some previous cell state data in \(\mathbf{c}_{t-1}\) that were captured as unimportant (note that importance was regulated by weight coefficients that were trained and stored in their respective weight matrices). 2. Whereas the forget gate \(\mathbf{f}_{t}\) focused on regulating the extent to which previous data were forgotten, the input gate \(\mathbf{i}_{t}\) focused on adding new data, scaled by their importance, or extent to which data should be added from the matrix comprised of \(\mathbf{h}_{t-1}\) and \(\mathbf{X}_{t}\). 3. The \(tanh\) gate obtained \(\mathbf{h}_{t-1}\) and \(\mathbf{X}_{t}\), but used the hyperbolic tangent \(tanh\) function to compute its outputs (between \(-1\) and \(1\)). 4. The result given by \(tanh\) and \(\mathbf{i}_{t}\) was then multiplied element-wise and further added (\(\mathbf{\upbeta}\)) to \(\mathbf{f}_{t}\mathbf{c}_{t-1}\), giving \(\mathbf{c}_{t}\), shown in Equation (20). 5. The output gate \(\mathbf{o}_{t}\) decided what values to output, given \(\mathbf{h}_{t-1}\) and \(\mathbf{X}_{t}\), and also computed its exposure to the following cell state based on trained importance. 6.