# Analyzing Student Behavioral Patterns in MOOCs Using Hidden Markov Models in Distance Education
## 3 Results
### Baum-Welch  
With the Forward-Backward algorithm, we calculate the scaled \(\alpha\) and scaled \(\beta\), which we use in the Baum-Welch algorithm in our methodology. The output of Baum-Welch is gamma and xi (\(\gamma\) and \(\xi\)). In the code, the variable \(\xi\) is obtained from the division of the calculated values of the numerator by the denominator. The numerator and denominator are derived from scaled \(\alpha\) and \(\beta\), the emission matrix, and the transition matrix. The \(a_{ij}\) and \(b_{jk}\) are called Lagrange Multipliers. With \(\gamma\) and \(\xi\), we can calculate the numerator and the denominator of the Lagrange Multipliers. The variable xi.all.t in the code is derived from the summation of the row elements (rowSums) of \(\xi\). The summation of the elements of each column of \(\gamma\) is represented by the variable bb in the implementation. Specifically, we divide the sum of the rows of \(\xi\) (xi.all.t) by the total sum of all values in xi.all.t, resulting in a row vector with nine elements (variable \(p\)). Next, we sum the values of \(\xi\) for the first column to obtain \(\gamma\). We then bind the values of \(\gamma\) according to the sum of the columns of \(\xi\). We determine a constant K which is the number of columns of the emission matrix. Then, we execute a loop K times, summing the columns of \(\gamma\). This gives us the value of bb. The corresponding mathematical expressions are shown below. We have mentioned above the relationship between \(\gamma\) and \(\xi\). The variable \(\gamma\) corresponds to the variable xi.all.t in our code. The variable \(p\) represents the normalization, i.e., the expected number of transitions, and is given by the following equation:  
\[p_{ij}=\frac{\sum_{t=1}^{T-1}\xi_{t}(i,j)}{\sum_{t=1}^{T-1}\gamma_{t}(i)}\]  
In our code, this is expressed as p = xi.all.t/sum(xi.all.t). Figure 6: Transition matrix among resources in Table 3.  
The variable \(k\) is the number of columns of Bi (emission matrix). The probability that the symbol (grade) \(o_{t}=l\) is achieved by the student \(t\) when the system is in the hidden state \(S_{j}\) is expressed as follows. We consider the ratio of the expected number of students in a hidden state \(S_{j}\) who are observing the symbol \(l\) (i.e., a certain grade) to the expected number of students who are in state \(S_{j}\). The ratio:  
\[\varphi_{j}(l)=\frac{\sum_{t=1,\sigma_{t}=l}^{T}\gamma_{t}(j)}{\sum_{t=1}^{T} \gamma_{t}(i)}\]  
is the variable bb, and its value is the sum of the columns of \(\gamma\). This value is 3.800804. In Figure 7, we can see the relationship between xi.all.t (summation of the row elements of \(\xi\)) and the Moodle resources. We use the Viterbi algorithm in order to find the most likely sequence of states given the observation sequence. In the cases of the occurrence of two successive hidden states, which in the transition matrix have a probability of zero, the Viterbi algorithm offers the solution. The problem being addressed is that the Viterbi algorithm takes transition probabilities as input. Some states have a stationary probability of zero, and a value of zero cannot be used as an argument in a logarithm function. The parameter \(\delta\) (represented as \"omega\" in the code) uses transition probabilities within a product expression, which is then transformed using a logarithm. As we have mentioned above, this approach enables the use of addition with large numbers instead of multiplying small numbers. In the recursion step of the experiments, we calculate the value of \(\delta\) (omega) for each student ID \(t\). In the last step, we find the maximum omega for the last student ID and all the hidden states. Afterwards, the algorithm computes the  
\[q_{T}^{*}=argmax\{\delta_{T}(forum\_discussion\_viewed)\dots\delta_{T}(wiki\_ page\_viewed)\}\]  
from the end to the beginning (T = 4037 to T = 1) which is also called backtracking. As a result, various probable hidden state sequences are being found.