class_docstr: Base class for inverse covariance estimators.
  
  Provides initialization method, metrics, scoring function,
  and ebic model selection.
  
  Parameters
  -----------
  score_metric : one of 'log_likelihood' (default), 'frobenius', 'spectral',
                'kl', or 'quadratic'
      Used for computing self.score().
  
  init_method : one of 'corrcoef', 'cov', 'spearman', 'kendalltau',
      or a custom function.
      Computes initial covariance and scales lambda appropriately.
      Using the custom function extends graphical model estimation to
      distributions beyond the multivariate Gaussian.
      The `spearman` or `kendalltau` options extend inverse covariance
      estimation to nonparanormal and transelliptic graphical models.
      Custom function must return ((n_features, n_features) ndarray, float)
      where the scalar parameter will be used to scale the penalty lam.
  
  auto_scale : bool
      If True, will compute self.lam_scale_ = max off-diagonal value when
      init_method='cov'.
      If false, then self.lam_scale_ = 1.
      lam_scale_ is used to scale user-supplied self.lam during fit.
  
  Attributes
  ----------
  covariance_ : 2D ndarray, shape (n_features, n_features)
      Estimated covariance matrix
  
      This can also be a len(path) list of
      2D ndarray, shape (n_features, n_features)
      (e.g., see mode='path' in QuicGraphLasso)
  
  precision_ : 2D ndarray, shape (n_features, n_features)
      Estimated pseudo-inverse matrix.
  
      This can also be a len(path) list of
      2D ndarray, shape (n_features, n_features)
      (e.g., see mode='path' in QuicGraphLasso)
  
  sample_covariance_ : 2D ndarray, shape (n_features, n_features)
      Estimated sample covariance matrix
  
  lam_scale_ : (float)
      Additional scaling factor on lambda (due to magnitude of
      sample_covariance_ values).
class_docstr_tok: ["Base","class","for","inverse","covariance","estimators",".","Provides","initialization","method",",","metrics",",","scoring","function",",","and","ebic","model","selection",".","Parameters","--","--","--","--","--","-","score_metric",":","one","of","'log_likelihood","'","(","default",")",",","'frobenius","'",",","'spectral","'",",","'kl","'",",","or","'quadratic'","Used","for","computing","self.score","(",")",".","init_method",":","one","of","'corrcoef","'",",","'cov","'",",","'spearman","'",",","'kendalltau","'",",","or","a","custom","function",".","Computes","initial","covariance","and","scales","lambda","appropriately",".","Using","the","custom","function","extends","graphical","model","estimation","to","distributions","beyond","the","multivariate","Gaussian",".","The","`","spearman","`","or","`","kendalltau","`","options","extend","inverse","covariance","estimation","to","nonparanormal","and","transelliptic","graphical","models",".","Custom","function","must","return","(","(","n_features",",","n_features",")","ndarray",",","float",")","where","the","scalar","parameter","will","be","used","to","scale","the","penalty","lam",".","auto_scale",":","bool","If","True",",","will","compute","self.lam_scale_","=","max","off-diagonal","value","when","init_method='cov","'",".","If","false",",","then","self.lam_scale_","=","1.","lam_scale_","is","used","to","scale","user-supplied","self.lam","during","fit",".","Attributes","--","--","--","--","--","covariance_",":","2D","ndarray",",","shape","(","n_features",",","n_features",")","Estimated","covariance","matrix","This","can","also","be","a","len","(","path",")","list","of","2D","ndarray",",","shape","(","n_features",",","n_features",")","(","e.g.",",","see","mode='path","'","in","QuicGraphLasso",")","precision_",":","2D","ndarray",",","shape","(","n_features",",","n_features",")","Estimated","pseudo-inverse","matrix",".","This","can","also","be","a","len","(","path",")","list","of","2D","ndarray",",","shape","(","n_features",",","n_features",")","(","e.g.",",","see","mode='path","'","in","QuicGraphLasso",")","sample_covariance_",":","2D","ndarray",",","shape","(","n_features",",","n_features",")","Estimated","sample","covariance","matrix","lam_scale_",":","(","float",")","Additional","scaling","factor","on","lambda","(","due","to","magnitude","of","sample_covariance_","values",")","."]
docstr: Computes the covariance error vs. comp_cov.
  
  May require self.path_
  
  Parameters
  ----------
  comp_cov : array-like, shape = (n_features, n_features)
      The precision to compare with.
      This should normally be the test sample covariance/precision.
  
  scaling : bool
      If True, the squared error norm is divided by n_features.
      If False (default), the squared error norm is not rescaled.
  
  score_metric : str
      The type of norm used to compute the error between the estimated
      self.precision, self.covariance and the reference `comp_cov`.
      Available error types:
  
      - 'frobenius' (default): sqrt(tr(A^t.A))
      - 'spectral': sqrt(max(eigenvalues(A^t.A))
      - 'kl': kl-divergence
      - 'quadratic': quadratic loss
      - 'log_likelihood': negative log likelihood
  
  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 min error between `self.covariance_` and `comp_cov`.
  
  If self.precision_ is a list, returns errors for each matrix, otherwise
  returns a scalar.
docstr_tok: ["Computes","the","covariance","error","vs.","comp_cov",".","May","require","self.path_","Parameters","--","--","--","--","--","comp_cov",":","array-like",",","shape","=","(","n_features",",","n_features",")","The","precision","to","compare","with",".","This","should","normally","be","the","test","sample","covariance\/precision",".","scaling",":","bool","If","True",",","the","squared","error","norm","is","divided","by","n_features",".","If","False","(","default",")",",","the","squared","error","norm","is","not","rescaled",".","score_metric",":","str","The","type","of","norm","used","to","compute","the","error","between","the","estimated","self.precision",",","self.covariance","and","the","reference","`","comp_cov","`",".","Available","error","types",":","-","'frobenius","'","(","default",")",":","sqrt","(","tr","(","A^t.A",")",")","-","'spectral","'",":","sqrt","(","max","(","eigenvalues","(","A^t.A",")",")","-","'kl","'",":","kl-divergence","-","'quadratic","'",":","quadratic","loss","-","'log_likelihood","'",":","negative","log","likelihood","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","min","error","between","`","self.covariance_","`","and","`","comp_cov","`",".","If","self.precision_","is","a","list",",","returns","errors","for","each","matrix",",","otherwise","returns","a","scalar","."]
code: def cov_error(self, comp_cov, score_metric="frobenius"):
      """Computes the covariance error vs. comp_cov.
  
      May require self.path_
  
      Parameters
      ----------
      comp_cov : array-like, shape = (n_features, n_features)
          The precision to compare with.
          This should normally be the test sample covariance/precision.
  
      scaling : bool
          If True, the squared error norm is divided by n_features.
          If False (default), the squared error norm is not rescaled.
  
      score_metric : str
          The type of norm used to compute the error between the estimated
          self.precision, self.covariance and the reference `comp_cov`.
          Available error types:
  
          - 'frobenius' (default): sqrt(tr(A^t.A))
          - 'spectral': sqrt(max(eigenvalues(A^t.A))
          - 'kl': kl-divergence
          - 'quadratic': quadratic loss
          - 'log_likelihood': negative log likelihood
  
      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 min error between `self.covariance_` and `comp_cov`.
  
      If self.precision_ is a list, returns errors for each matrix, otherwise
      returns a scalar.
      """
      if not isinstance(self.precision_, list):
          return _compute_error(
              comp_cov, self.covariance_, self.precision_, score_metric
          )
  
      path_errors = []
      for lidx, lam in enumerate(self.path_):
          path_errors.append(
              _compute_error(
                  comp_cov,
                  self.covariance_[lidx],
                  self.precision_[lidx],
                  score_metric,
              )
          )
  
      return np.array(path_errors)
  
file_path: skggm/inverse_covariance/inverse_covariance.py
imports: from __future__ import absolute_import
  import numpy
  from sklearn.base import BaseEstimator
  from .None import metrics
  from .rank_correlation import spearman_correlation, kendalltau_correlation
label_desc: Use image node_id 5 for calling the InverseCovarianceEstimator obj's underlying member method code with example usage: obj.cov_error(comp_cov, score_metric) and returns: np, _compute_error