#NEWLINE# def _estimate_log_gaussian_prob_tied( X , means , covariances ) : #NEWLINE# #INDENT# "Estimate the log Gaussian probability for 'tied' covariance.\n\n    Parameters\n    ----------\n    X : array-like, shape (n_samples, n_features)\n\n    means : array-like, shape (n_components, n_features)\n\n    covariances : array-like, shape (n_features, n_features)\n\n    Returns\n    -------\n    log_prob : array-like, shape (n_samples, n_components)\n    " #NEWLINE# ( n_samples , n_features ) = X . shape #NEWLINE# n_components = means . shape [ 0 ] #NEWLINE# log_prob = np . empty ( ( n_samples , n_components ) ) #NEWLINE# try : #NEWLINE# #INDENT# cov_chol = linalg . cholesky ( covariances , lower = True ) #NEWLINE# #UNINDENT# except linalg . LinAlgError : #NEWLINE# #INDENT# raise ValueError ( 'The algorithm has diverged because of too few samples per components. Try to decrease the number of components, or increase reg_covar.' ) #NEWLINE# #UNINDENT# cv_log_det = ( 2.0 * np . sum ( np . log ( np . diagonal ( cov_chol ) ) ) ) #NEWLINE# for ( k , mu ) in enumerate ( means ) : #NEWLINE# #INDENT# cv_sol = linalg . solve_triangular ( cov_chol , ( X - mu ) . T , lower = True ) . T #NEWLINE# log_prob [ : , k ] = np . sum ( np . square ( cv_sol ) , axis = 1 ) #NEWLINE# #UNINDENT# log_prob = ( ( - 0.5 ) * ( ( ( n_features * np . log ( ( 2.0 * np . pi ) ) ) + covariances ) + log_prob ) ) #NEWLINE# return log_prob