class_docstr: Base class for all metric-learners.
  
  Parameters
  ----------
  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 gotten like this: X[indices].
class_docstr_tok: ["Base","class","for","all","metric-learners",".","Parameters","--","--","--","--","--","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","gotten","like","this",":","X","[","indices","]","."]
docstr: Returns a function that takes as input two 1D arrays and outputs
  the value of the learned metric on these two points. Depending on the
  algorithm, it can return a distance or a similarity function between
  pairs.
  
  This function will be independent from the metric learner that learned it
  (it will not be modified if the initial metric learner is modified),
  and it can be directly plugged into the `metric` argument of
  scikit-learn's estimators.
  
  Returns
  -------
  metric_fun : function
    The function described above.
  
  
  Examples
  --------
  .. doctest::
  
    >>> from metric_learn import NCA
    >>> from sklearn.datasets import make_classification
    >>> from sklearn.neighbors import KNeighborsClassifier
    >>> nca = NCA()
    >>> X, y = make_classification()
    >>> nca.fit(X, y)
    >>> knn = KNeighborsClassifier(metric=nca.get_metric())
    >>> knn.fit(X, y) # doctest: +NORMALIZE_WHITESPACE
    KNeighborsClassifier(algorithm='auto', leaf_size=30,
      metric=<function MahalanobisMixin.get_metric.<locals>.metric_fun
              at 0x...>,
      metric_params=None, n_jobs=None, n_neighbors=5, p=2,
      weights='uniform')
  
  See Also
  --------
  pair_distance : a method that returns the distance between several
    pairs of points. Unlike `get_metric`, this is a method of the metric
    learner and therefore can change if the metric learner changes. Besides,
    it can use the metric learner's preprocessor, and works on concatenated
    arrays.
  
  pair_score : a method that returns the similarity score between
    several pairs of points. Unlike `get_metric`, this is a method of the
    metric learner and therefore can change if the metric learner changes.
    Besides, it can use the metric learner's preprocessor, and works on
    concatenated arrays.
docstr_tok: ["Returns","a","function","that","takes","as","input","two","1D","arrays","and","outputs","the","value","of","the","learned","metric","on","these","two","points",".","Depending","on","the","algorithm",",","it","can","return","a","distance","or","a","similarity","function","between","pairs",".","This","function","will","be","independent","from","the","metric","learner","that","learned","it","(","it","will","not","be","modified","if","the","initial","metric","learner","is","modified",")",",","and","it","can","be","directly","plugged","into","the","`","metric","`","argument","of","scikit-learn","'s","estimators",".","Returns","--","--","--","-","metric_fun",":","function","The","function","described","above",".","Examples","--","--","--","--","..","doctest",":",":",">",">",">","from","metric_learn","import","NCA",">",">",">","from","sklearn.datasets","import","make_classification",">",">",">","from","sklearn.neighbors","import","KNeighborsClassifier",">",">",">","nca","=","NCA","(",")",">",">",">","X",",","y","=","make_classification","(",")",">",">",">","nca.fit","(","X",",","y",")",">",">",">","knn","=","KNeighborsClassifier","(","metric=nca.get_metric","(",")",")",">",">",">","knn.fit","(","X",",","y",")","#","doctest",":","+NORMALIZE_WHITESPACE","KNeighborsClassifier","(","algorithm='auto","'",",","leaf_size=30",",","metric=","<","function","MahalanobisMixin.get_metric.","<","locals",">",".metric_fun","at","0x","...",">",",","metric_params=None",",","n_jobs=None",",","n_neighbors=5",",","p=2",",","weights='uniform","'",")","See","Also","--","--","--","--","pair_distance",":","a","method","that","returns","the","distance","between","several","pairs","of","points",".","Unlike","`","get_metric","`",",","this","is","a","method","of","the","metric","learner","and","therefore","can","change","if","the","metric","learner","changes",".","Besides",",","it","can","use","the","metric","learner","'s","preprocessor",",","and","works","on","concatenated","arrays",".","pair_score",":","a","method","that","returns","the","similarity","score","between","several","pairs","of","points",".","Unlike","`","get_metric","`",",","this","is","a","method","of","the","metric","learner","and","therefore","can","change","if","the","metric","learner","changes",".","Besides",",","it","can","use","the","metric","learner","'s","preprocessor",",","and","works","on","concatenated","arrays","."]
code: def get_metric(self):
      """Returns a function that takes as input two 1D arrays and outputs
      the value of the learned metric on these two points. Depending on the
      algorithm, it can return a distance or a similarity function between
      pairs.
  
      This function will be independent from the metric learner that learned it
      (it will not be modified if the initial metric learner is modified),
      and it can be directly plugged into the `metric` argument of
      scikit-learn's estimators.
  
      Returns
      -------
      metric_fun : function
        The function described above.
  
  
      Examples
      --------
      .. doctest::
  
        >>> from metric_learn import NCA
        >>> from sklearn.datasets import make_classification
        >>> from sklearn.neighbors import KNeighborsClassifier
        >>> nca = NCA()
        >>> X, y = make_classification()
        >>> nca.fit(X, y)
        >>> knn = KNeighborsClassifier(metric=nca.get_metric())
        >>> knn.fit(X, y) # doctest: +NORMALIZE_WHITESPACE
        KNeighborsClassifier(algorithm='auto', leaf_size=30,
          metric=<function MahalanobisMixin.get_metric.<locals>.metric_fun
                  at 0x...>,
          metric_params=None, n_jobs=None, n_neighbors=5, p=2,
          weights='uniform')
  
      See Also
      --------
      pair_distance : a method that returns the distance between several
        pairs of points. Unlike `get_metric`, this is a method of the metric
        learner and therefore can change if the metric learner changes. Besides,
        it can use the metric learner's preprocessor, and works on concatenated
        arrays.
  
      pair_score : a method that returns the similarity score between
        several pairs of points. Unlike `get_metric`, this is a method of the
        metric learner and therefore can change if the metric learner changes.
        Besides, it can use the metric learner's preprocessor, and works on
        concatenated arrays.
      """
  
imports: from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.utils.extmath import stable_cumsum
  from sklearn.utils.validation import _is_arraylike, check_is_fitted
  from sklearn.metrics import roc_auc_score, roc_curve, precision_recall_curve
  import numpy
  from abc import ABCMeta, abstractmethod
  from ._util import ArrayIndexer, check_input, validate_vector
  import warnings
label_desc: Use image node_id 7 for calling the BaseMetricLearner obj's underlying member method code with example usage: obj.get_metric() without return types