code: def _MStep(self, l, K, x, z_h1, pi_h1, p_h1, p_h, delta_i_j_s):
          
          for k in range(K):
              normconst = 0
              if l == 0: # only need to compute pi at first MM iteration
                  pi_h1[k] = np.sum(z_h1.T[k]) / len(z_h1)
              for j in range(self.m):
                  omega_k_j = EMMMixPLAggregator.omega(k, j, z_h1, x) # numerator
                  denom_sum = 0
                  for i in range(self.n):
                      sum1 = 0
                      for t in range(len(x[i])):
                          sum2 = 0
                          sum3 = 0
                          for s in range(t, self.m):
                              sum2 += p_h[k][EMMMixPLAggregator.c(x[i], s)]
                          for s in range(t, self.m + 1):
                              sum3 += delta_i_j_s[i][j][s]
                          sum1 += z_h1[i][k] * (sum2 ** -1) * sum3
                      denom_sum += sum1
                  p_h1[k][j] = omega_k_j / denom_sum
                  normconst += p_h1[k][j]
              for j in range(self.m):
                  p_h1[k][j] /= normconst
docs: Description:
              Internal function for computing the M-Step of the EMM algorithm,
              which is itself an MM algorithm.