

def _increment_dense_diagonal_precision(X, mean_vector, covariances, n, graph, n_features, n_features_per_vertex, dtype=np.float32, n_components=None, bias=0, verbose=False):
    precision = np.zeros((n_features, n_features), dtype=dtype)
    if verbose:
        print_dynamic('Allocated precision matrix of size {}'.format(bytes_str(precision.nbytes)))
        vertices = print_progress(range(graph.n_vertices), n_items=graph.n_vertices, prefix='Precision per vertex', end_with_newline=False)
    else:
        vertices = range(graph.n_vertices)
    for v in vertices:
        i_from = (v * n_features_per_vertex)
        i_to = ((v + 1) * n_features_per_vertex)
        edge_data = X[:, i_from:i_to]
        m = mean_vector[i_from:i_to]
        (_, covariances[v]) = _increment_multivariate_gaussian_cov(edge_data, m, covariances[v], n, bias=bias)
        precision[i_from:i_to, i_from:i_to] = _covariance_matrix_inverse(covariances[v], n_components)
    return (precision, covariances)

dataset/ETHPy150Open menpo/menpo/menpo/model/gmrf.py _increment_dense_diagonal_precision/original