def _class_cov(X, y, priors=None, shrinkage=None):
 classes = np.unique(y)
 covs = []
 for group in classes:
  Xg = X[(y == group), :]
  covs.append(np.atleast_2d(_cov(Xg, shrinkage)))
 return np.average(covs, axis=0, weights=priors)

def _class_cov ( X , y , priors = None , shrinkage = None ) : classes = np . unique ( y ) covs = [ ] for group in classes : Xg = X [ ( y == group ) , : ] covs . append ( np . atleast_2d ( _cov ( Xg , shrinkage ) ) ) return np . average ( covs , axis = 0 , weights = priors )
compute class covariance matrix .