class_docstr: Maximum likelihood covariance estimator.
  
  Read more in the :ref:`User Guide <covariance>`.
  
  Parameters
  ----------
  store_precision : bool
      Specifies if the estimated precision is stored.
  
  assume_centered : bool
      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
  ----------
  covariance_ : 2D ndarray, shape (n_features, n_features)
      Estimated covariance matrix
  
  precision_ : 2D ndarray, shape (n_features, n_features)
      Estimated pseudo-inverse matrix.
      (stored only if store_precision is True)
class_docstr_tok: ["Maximum","likelihood","covariance","estimator",".","Read","more","in","the",":","ref",":","`","User","Guide","<","covariance",">","`",".","Parameters","--","--","--","--","--","store_precision",":","bool","Specifies","if","the","estimated","precision","is","stored",".","assume_centered",":","bool","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","--","--","--","--","--","covariance_",":","2D","ndarray",",","shape","(","n_features",",","n_features",")","Estimated","covariance","matrix","precision_",":","2D","ndarray",",","shape","(","n_features",",","n_features",")","Estimated","pseudo-inverse","matrix",".","(","stored","only","if","store_precision","is","True",")"]
docstr: Compute the Mean Squared Error between two covariance estimators.
  
  Parameters
  ----------
  comp_cov : array-like, shape = [n_features, n_features]
      The covariance to compare with.
  norm : str
      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
      If True (default), the squared error norm is divided by n_features.
      If False, the squared error norm is not rescaled.
  squared : bool
      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
  -------
  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",",","shape","=","[","n_features",",","n_features","]","The","covariance","to","compare","with",".","norm",":","str","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","If","True","(","default",")",",","the","squared","error","norm","is","divided","by","n_features",".","If","False",",","the","squared","error","norm","is","not","rescaled",".","squared",":","bool","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","--","--","--","-","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, shape = [n_features, n_features]
          The covariance to compare with.
      norm : str
          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
          If True (default), the squared error norm is divided by n_features.
          If False, the squared error norm is not rescaled.
      squared : bool
          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
      -------
      The Mean Squared Error (in the sense of the Frobenius norm) between
      `self` and `comp_cov` covariance estimators.
      """
      from scipy import linalg
  
      # 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
  
imports: import inspect
  import operator
  import os
  import warnings
  from contextlib import contextmanager
  from io import StringIO
  from math import log
  from pprint import pprint
  import numpy
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