class_docstr: Relevant Components Analysis (RCA)
  
  RCA learns a full rank Mahalanobis distance metric based on a weighted sum of
  in-chunklets covariance matrices. It applies a global linear transformation
  to assign large weights to relevant dimensions and low weights to irrelevant
  dimensions. Those relevant dimensions are estimated using "chunklets",
  subsets of points that are known to belong to the same class.
  
  Read more in the :ref:`User Guide <rca>`.
  
  Parameters
  ----------
  n_components : int or None, optional (default=None)
    Dimensionality of reduced space (if None, defaults to dimension of X).
  
  preprocessor : array-like, shape=(n_samples, n_features) or callable
    The preprocessor to call to get tuples from indices. If array-like,
    tuples will be formed like this: X[indices].
  
  Examples
  --------
  >>> from metric_learn import RCA
  >>> X = [[-0.05,  3.0],[0.05, -3.0],
  >>>     [0.1, -3.55],[-0.1, 3.55],
  >>>     [-0.95, -0.05],[0.95, 0.05],
  >>>     [0.4,  0.05],[-0.4, -0.05]]
  >>> chunks = [0, 0, 1, 1, 2, 2, 3, 3]
  >>> rca = RCA()
  >>> rca.fit(X, chunks)
  
  References
  ----------
  .. [1] Noam Shental, et al. `Adjustment learning and relevant component
         analysis <http://citeseerx.ist.         psu.edu/viewdoc/download?doi=10.1.1.19.2871&rep=rep1&type=pdf>`_ .
         ECCV 2002.
  
  
  Attributes
  ----------
  components_ : `numpy.ndarray`, shape=(n_components, n_features)
    The learned linear transformation ``L``.
class_docstr_tok: ["Relevant","Components","Analysis","(","RCA",")","RCA","learns","a","full","rank","Mahalanobis","distance","metric","based","on","a","weighted","sum","of","in-chunklets","covariance","matrices",".","It","applies","a","global","linear","transformation","to","assign","large","weights","to","relevant","dimensions","and","low","weights","to","irrelevant","dimensions",".","Those","relevant","dimensions","are","estimated","using","``","chunklets","''",",","subsets","of","points","that","are","known","to","belong","to","the","same","class",".","Read","more","in","the",":","ref",":","`","User","Guide","<","rca",">","`",".","Parameters","--","--","--","--","--","n_components",":","int","or","None",",","optional","(","default=None",")","Dimensionality","of","reduced","space","(","if","None",",","defaults","to","dimension","of","X",")",".","preprocessor",":","array-like",",","shape=","(","n_samples",",","n_features",")","or","callable","The","preprocessor","to","call","to","get","tuples","from","indices",".","If","array-like",",","tuples","will","be","formed","like","this",":","X","[","indices","]",".","Examples","--","--","--","--",">",">",">","from","metric_learn","import","RCA",">",">",">","X","=","[","[","-0.05",",","3.0","]",",","[","0.05",",","-3.0","]",",",">",">",">","[","0.1",",","-3.55","]",",","[","-0.1",",","3.55","]",",",">",">",">","[","-0.95",",","-0.05","]",",","[","0.95",",","0.05","]",",",">",">",">","[","0.4",",","0.05","]",",","[","-0.4",",","-0.05","]","]",">",">",">","chunks","=","[","0",",","0",",","1",",","1",",","2",",","2",",","3",",","3","]",">",">",">","rca","=","RCA","(",")",">",">",">","rca.fit","(","X",",","chunks",")","References","--","--","--","--","--","..","[","1","]","Noam","Shental",",","et","al",".","`","Adjustment","learning","and","relevant","component","analysis","<","http",":","\/\/citeseerx.ist",".","psu.edu\/viewdoc\/download","?","doi=10.1.1.19.2871","&","rep=rep1","&","type=pdf",">","`","_",".","ECCV","2002",".","Attributes","--","--","--","--","--","components_",":","`","numpy.ndarray","`",",","shape=","(","n_components",",","n_features",")","The","learned","linear","transformation","``","L","``","."]
code: def _check_dimension(self, rank, X):
      d = X.shape[1]
  
      if rank < d:
          warnings.warn(
              "The inner covariance matrix is not invertible, "
              "so the transformation matrix may contain Nan values. "
              "You should remove any linearly dependent features and/or "
              "reduce the dimensionality of your input, "
              "for instance using `sklearn.decomposition.PCA` as a "
              "preprocessing step."
          )
  
      dim = _check_n_components(d, self.n_components)
      return dim
  
file_path: metric-learn/metric_learn/rca.py
imports: import numpy
  import warnings
  from sklearn.base import TransformerMixin
  from ._util import _check_n_components
  from .base_metric import MahalanobisMixin
  from .constraints import Constraints
label_desc: Use image node_id 2 for calling the RCA obj's underlying member method code with example usage: obj._check_dimension(rank, X) and returns: dim