def encode_mean(data, natparam, recogn_params): nn_potentials = recognize(recogn_params, data) (_, gaussian_stats), _, _, _ = local_meanfield(natparam, nn_potentials) _, Ex, _, _ = gaussian.unpack_dense(gaussian_stats) return Ex
def get_component(niw_natparam): neghalfJ, h, _, _ = gaussian.unpack_dense(niw_natparam) J = -2 * neghalfJ return np.linalg.solve(J, h), np.linalg.inv(J)
def encode_mean(data, natparam, recogn_params): nn_potentials = recognize(recogn_params, data) (_, gaussian_stats), _, _, _ = local_meanfield(natparam, nn_potentials) _, Ex, _, _ = gaussian.unpack_dense(gaussian_stats) return Ex
def get_component(niw_natparam): neghalfJ, h, _, _ = gaussian.unpack_dense(niw_natparam) J = -2 * neghalfJ return np.linalg.solve(J, h), np.linalg.inv(J)
def check_params(natparam): natparam2 = pack_dense(*unpack_dense(natparam)) assert np.allclose(natparam, natparam2)
def check_params(natparam): natparam2 = pack_dense(*unpack_dense(natparam)) assert np.allclose(natparam, natparam2)