docstr: Get components matrix (L) from computed mahalanobis matrix.
docstr_tok: ["Get","components","matrix","(","L",")","from","computed","mahalanobis","matrix","."]
code: def _components_from_basis_weights(self, basis, w):
      """
      Get components matrix (L) from computed mahalanobis matrix.
      """
  
      # get rid of inactive bases
      # TODO: Maybe have a tolerance over zero?
      (active_idx,) = w > 0
      w = w[..., active_idx]
      basis = basis[active_idx, :]
  
      n_basis, n_features = basis.shape
  
      if n_basis < n_features:  # if metric is low-rank
          warnings.warn(
              "The number of bases with nonzero weight is less than the "
              "number of features of the input, in consequence the "
              "learned transformation reduces the dimension to %d."
              % n_basis
          )
          return (
              np.sqrt(w.T) * basis
          )  # equivalent to np.diag(np.sqrt(w)).dot(basis)
  
      else:  # if metric is full rank
          return components_from_metric(np.matmul(basis.T, w.T * basis))
  
imports: from __future__ import print_function, absolute_import, division
  import numpy
  from .base_metric import _TripletsClassifierMixin, MahalanobisMixin
  from ._util import components_from_metric
  from sklearn.base import TransformerMixin
  from .constraints import Constraints
  from sklearn.preprocessing import normalize
  from sklearn.neighbors import NearestNeighbors
  from sklearn.cluster import KMeans
  from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
  from sklearn.utils import check_array, check_random_state
  import warnings
label_desc: Use image node_id 4 for calling the _BaseSCML obj's underlying member method code with example usage: obj._components_from_basis_weights(basis, w) and returns: unknown, components_from_metric