def empirical_covariance(X, assume_centered=False):
 X = np.asarray(X)
 if (X.ndim == 1):
  X = np.reshape(X, (1, (-1)))
 if (X.shape[0] == 1):
  warnings.warn('Only one sample available. You may want to reshape your data array')
 if assume_centered:
  covariance = (np.dot(X.T, X) / X.shape[0])
 else:
  covariance = np.cov(X.T, bias=1)
 if (covariance.ndim == 0):
  covariance = np.array([[covariance]])
 return covariance

def empirical_covariance ( X , assume_centered = False ) : X = np . asarray ( X ) if ( X . ndim == 1 ) : X = np . reshape ( X , ( 1 , ( - 1 ) ) ) if ( X . shape [ 0 ] == 1 ) : warnings . warn ( 'Only one sample available. You may want to reshape your data array' ) if assume_centered : covariance = ( np . dot ( X . T , X ) / X . shape [ 0 ] ) else : covariance = np . cov ( X . T , bias = 1 ) if ( covariance . ndim == 0 ) : covariance = np . array ( [ [ covariance ] ] ) return covariance
computes the maximum likelihood covariance estimator parameters x : ndarray .