class_docstr: Maximum likelihood covariance estimator.
  
  Read more in the :ref:`User Guide <covariance>`.
  
  Parameters
  ----------
  store_precision : bool, default=True
      Specifies if the estimated precision is stored.
  
  assume_centered : bool, default=False
      If True, data are not centered before computation.
      Useful when working with data whose mean is almost, but not exactly
      zero.
      If False (default), data are centered before computation.
  
  Attributes
  ----------
  location_ : ndarray of shape (n_features,)
      Estimated location, i.e. the estimated mean.
  
  covariance_ : ndarray of shape (n_features, n_features)
      Estimated covariance matrix
  
  precision_ : ndarray of shape (n_features, n_features)
      Estimated pseudo-inverse matrix.
      (stored only if store_precision is True)
  
  n_features_in_ : int
      Number of features seen during :term:`fit`.
  
      .. versionadded:: 0.24
  
  feature_names_in_ : ndarray of shape (`n_features_in_`,)
      Names of features seen during :term:`fit`. Defined only when `X`
      has feature names that are all strings.
  
      .. versionadded:: 1.0
  
  See Also
  --------
  EllipticEnvelope : An object for detecting outliers in
      a Gaussian distributed dataset.
  GraphicalLasso : Sparse inverse covariance estimation
      with an l1-penalized estimator.
  LedoitWolf : LedoitWolf Estimator.
  MinCovDet : Minimum Covariance Determinant
      (robust estimator of covariance).
  OAS : Oracle Approximating Shrinkage Estimator.
  ShrunkCovariance : Covariance estimator with shrinkage.
  
  Examples
  --------
  >>> import numpy as np
  >>> from sklearn.covariance import EmpiricalCovariance
  >>> from sklearn.datasets import make_gaussian_quantiles
  >>> real_cov = np.array([[.8, .3],
  ...                      [.3, .4]])
  >>> rng = np.random.RandomState(0)
  >>> X = rng.multivariate_normal(mean=[0, 0],
  ...                             cov=real_cov,
  ...                             size=500)
  >>> cov = EmpiricalCovariance().fit(X)
  >>> cov.covariance_
  array([[0.7569..., 0.2818...],
         [0.2818..., 0.3928...]])
  >>> cov.location_
  array([0.0622..., 0.0193...])
class_docstr_tok: ["Maximum","likelihood","covariance","estimator",".","Read","more","in","the",":","ref",":","`","User","Guide","<","covariance",">","`",".","Parameters","--","--","--","--","--","store_precision",":","bool",",","default=True","Specifies","if","the","estimated","precision","is","stored",".","assume_centered",":","bool",",","default=False","If","True",",","data","are","not","centered","before","computation",".","Useful","when","working","with","data","whose","mean","is","almost",",","but","not","exactly","zero",".","If","False","(","default",")",",","data","are","centered","before","computation",".","Attributes","--","--","--","--","--","location_",":","ndarray","of","shape","(","n_features",",",")","Estimated","location",",","i.e",".","the","estimated","mean",".","covariance_",":","ndarray","of","shape","(","n_features",",","n_features",")","Estimated","covariance","matrix","precision_",":","ndarray","of","shape","(","n_features",",","n_features",")","Estimated","pseudo-inverse","matrix",".","(","stored","only","if","store_precision","is","True",")","n_features_in_",":","int","Number","of","features","seen","during",":","term",":","`","fit","`",".","..","versionadded",":",":","0.24","feature_names_in_",":","ndarray","of","shape","(","`","n_features_in_","`",",",")","Names","of","features","seen","during",":","term",":","`","fit","`",".","Defined","only","when","`","X","`","has","feature","names","that","are","all","strings",".","..","versionadded",":",":","1.0","See","Also","--","--","--","--","EllipticEnvelope",":","An","object","for","detecting","outliers","in","a","Gaussian","distributed","dataset",".","GraphicalLasso",":","Sparse","inverse","covariance","estimation","with","an","l1-penalized","estimator",".","LedoitWolf",":","LedoitWolf","Estimator",".","MinCovDet",":","Minimum","Covariance","Determinant","(","robust","estimator","of","covariance",")",".","OAS",":","Oracle","Approximating","Shrinkage","Estimator",".","ShrunkCovariance",":","Covariance","estimator","with","shrinkage",".","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","from","sklearn.covariance","import","EmpiricalCovariance",">",">",">","from","sklearn.datasets","import","make_gaussian_quantiles",">",">",">","real_cov","=","np.array","(","[","[",".8",",",".3","]",",","...","[",".3",",",".4","]","]",")",">",">",">","rng","=","np.random.RandomState","(","0",")",">",">",">","X","=","rng.multivariate_normal","(","mean=","[","0",",","0","]",",","...","cov=real_cov",",","...","size=500",")",">",">",">","cov","=","EmpiricalCovariance","(",")",".fit","(","X",")",">",">",">","cov.covariance_","array","(","[","[","0.7569","...",",","0.2818","...","]",",","[","0.2818","...",",","0.3928","...","]","]",")",">",">",">","cov.location_","array","(","[","0.0622","...",",","0.0193","...","]",")"]
docstr: Compute the Mean Squared Error between two covariance estimators.
  
  Parameters
  ----------
  comp_cov : array-like of shape (n_features, n_features)
      The covariance to compare with.
  
  norm : {"frobenius", "spectral"}, default="frobenius"
      The type of norm used to compute the error. Available error types:
      - 'frobenius' (default): sqrt(tr(A^t.A))
      - 'spectral': sqrt(max(eigenvalues(A^t.A))
      where A is the error ``(comp_cov - self.covariance_)``.
  
  scaling : bool, default=True
      If True (default), the squared error norm is divided by n_features.
      If False, the squared error norm is not rescaled.
  
  squared : bool, default=True
      Whether to compute the squared error norm or the error norm.
      If True (default), the squared error norm is returned.
      If False, the error norm is returned.
  
  Returns
  -------
  result : float
      The Mean Squared Error (in the sense of the Frobenius norm) between
      `self` and `comp_cov` covariance estimators.
docstr_tok: ["Compute","the","Mean","Squared","Error","between","two","covariance","estimators",".","Parameters","--","--","--","--","--","comp_cov",":","array-like","of","shape","(","n_features",",","n_features",")","The","covariance","to","compare","with",".","norm",":","{","``","frobenius","''",",","``","spectral","''","}",",","default=","''","frobenius","''","The","type","of","norm","used","to","compute","the","error",".","Available","error","types",":","-","'frobenius","'","(","default",")",":","sqrt","(","tr","(","A^t.A",")",")","-","'spectral","'",":","sqrt","(","max","(","eigenvalues","(","A^t.A",")",")","where","A","is","the","error","``","(","comp_cov","-","self.covariance_",")","``",".","scaling",":","bool",",","default=True","If","True","(","default",")",",","the","squared","error","norm","is","divided","by","n_features",".","If","False",",","the","squared","error","norm","is","not","rescaled",".","squared",":","bool",",","default=True","Whether","to","compute","the","squared","error","norm","or","the","error","norm",".","If","True","(","default",")",",","the","squared","error","norm","is","returned",".","If","False",",","the","error","norm","is","returned",".","Returns","--","--","--","-","result",":","float","The","Mean","Squared","Error","(","in","the","sense","of","the","Frobenius","norm",")","between","`","self","`","and","`","comp_cov","`","covariance","estimators","."]
code: def error_norm(
      self, comp_cov, norm="frobenius", scaling=True, squared=True
  ):
      """Compute the Mean Squared Error between two covariance estimators.
  
      Parameters
      ----------
      comp_cov : array-like of shape (n_features, n_features)
          The covariance to compare with.
  
      norm : {"frobenius", "spectral"}, default="frobenius"
          The type of norm used to compute the error. Available error types:
          - 'frobenius' (default): sqrt(tr(A^t.A))
          - 'spectral': sqrt(max(eigenvalues(A^t.A))
          where A is the error ``(comp_cov - self.covariance_)``.
  
      scaling : bool, default=True
          If True (default), the squared error norm is divided by n_features.
          If False, the squared error norm is not rescaled.
  
      squared : bool, default=True
          Whether to compute the squared error norm or the error norm.
          If True (default), the squared error norm is returned.
          If False, the error norm is returned.
  
      Returns
      -------
      result : float
          The Mean Squared Error (in the sense of the Frobenius norm) between
          `self` and `comp_cov` covariance estimators.
      """
      # compute the error
      error = comp_cov - self.covariance_
      # compute the error norm
      if norm == "frobenius":
          squared_norm = np.sum(error**2)
      elif norm == "spectral":
          squared_norm = np.amax(linalg.svdvals(np.dot(error.T, error)))
      else:
          raise NotImplementedError(
              "Only spectral and frobenius norms are implemented"
          )
      # optionally scale the error norm
      if scaling:
          squared_norm = squared_norm / error.shape[0]
      # finally get either the squared norm or the norm
      if squared:
          result = squared_norm
      else:
          result = np.sqrt(squared_norm)
  
      return result
  
file_path: catboost/contrib/python/scikit-learn/py3/sklearn/covariance/_empirical_covariance.py
imports: import warnings
  import numpy
  from scipy import linalg
  from ..None import config_context
  from ..base import BaseEstimator, _fit_context
  from ..metrics.pairwise import pairwise_distances
  from ..utils import check_array
  from ..utils._param_validation import validate_params
  from ..utils.extmath import fast_logdet
label_desc: Use image node_id 6 for calling the EmpiricalCovariance obj's underlying member method code with example usage: obj.error_norm(comp_cov, norm, scaling, squared) and returns: result