def _(k): m[k] = self.beta1 * m[k] + (1 - self.beta1) * g[k] v[k] = self.beta2 * v[k] + (1 - self.beta2) * g[k]**2 mhat = m[k] * self.mhat_factors[i_epoch] vhat = v[k] * self.vhat_factors[i_epoch] theta[k] = theta[k] - self.alpha * mhat / \ mpc_math.sqrt(vhat) + self.epsilon
def g(j): W[i][j] = mpc_math.sqrt(M1[i][j])