def _bound_state_log_lik(X, initial_bound, precs, means, covariance_type):
 (n_components, n_features) = means.shape
 n_samples = X.shape[0]
 bound = np.empty((n_samples, n_components))
 bound[:] = initial_bound
 if (covariance_type in ['diag', 'spherical']):
  for k in range(n_components):
   d = (X - means[k])
   bound[:, k] -= (0.5 * np.sum(((d * d) * precs[k]), axis=1))
 elif (covariance_type == 'tied'):
  for k in range(n_components):
   bound[:, k] -= (0.5 * _sym_quad_form(X, means[k], precs))
 elif (covariance_type == 'full'):
  for k in range(n_components):
   bound[:, k] -= (0.5 * _sym_quad_form(X, means[k], precs[k]))
 return bound

def _bound_state_log_lik ( X , initial_bound , precs , means , covariance_type ) : ( n_components , n_features ) = means . shape n_samples = X . shape [ 0 ] bound = np . empty ( ( n_samples , n_components ) ) bound [ : ] = initial_bound if ( covariance_type in [ 'diag' , 'spherical' ] ) : for k in range ( n_components ) : d = ( X - means [ k ] ) bound [ : , k ] -= ( 0.5 * np . sum ( ( ( d * d ) * precs [ k ] ) , axis = 1 ) ) elif ( covariance_type == 'tied' ) : for k in range ( n_components ) : bound [ : , k ] -= ( 0.5 * _sym_quad_form ( X , means [ k ] , precs ) ) elif ( covariance_type == 'full' ) : for k in range ( n_components ) : bound [ : , k ] -= ( 0.5 * _sym_quad_form ( X , means [ k ] , precs [ k ] ) ) return bound
update the bound with likelihood terms .