Each row of a data matrix is a draw from a known multivariate Gaussian , but some entries are missing (marked np.nan), with a different missing pattern in each row. Fill every missing entry with its posterior mean given the observed entries of the same row, and report its posterior variance.
Implement mvn_impute(X_nan, mu, Sigma) returning (X_mean, X_var), two float arrays with the shape of X_nan:
X_mean[n, i] for a hidden is its conditional mean, and X_var[n, i] is the corresponding diagonal entry of the conditional covariance (the marginal posterior variance of that entry).X_mean and get variance in X_var.X_nan.