docs: def build_kernel_to_data(self, Y, knn=None, bandwidth=None, bandwidth_scale=None):
          """Build transition matrix from new data to the graph
  
          Creates a transition matrix such that `Y` can be approximated by
          a linear combination of landmarks. Any
          transformation of the landmarks can be trivially applied to `Y` by
          performing
  
          `transform_Y = transitions.dot(transform)`
  
          Parameters
          ----------
  
          Y: array-like, [n_samples_y, n_features]
              new data for which an affinity matrix is calculated
              to the existing data. `n_features` must match
              either the ambient or PCA dimensions
  
          Returns
          -------
  
          transitions : array-like, [n_samples_y, self.data.shape[0]]
              Transition matrix from `Y` to `self.data`
  
          Raises
          ------
  
          ValueError: if `precomputed` is not `None`, then the graph cannot
          be extended.
          """
          if knn is None:
              knn = self.knn
          if bandwidth is None:
              bandwidth = self.bandwidth
          if bandwidth_scale is None:
              bandwidth_scale = self.bandwidth_scale
          if self.precomputed is not None:
              raise ValueError("Cannot extend kernel on precomputed graph")
          else:
              tasklogger.log_start("affinities")
              Y = self._check_extension_shape(Y)
              pdx = cdist(Y, self.data_nu, metric=self.distance)
              if bandwidth is None:
                  knn_dist = np.partition(pdx, knn, axis=1)[:, :knn]
                  bandwidth = np.max(knn_dist, axis=1)
              elif callable(bandwidth):
                  bandwidth = bandwidth(pdx)
              bandwidth = bandwidth_scale * bandwidth
              pdx = (pdx.T / bandwidth).T
              K = np.exp(-1 * pdx**self.decay)
              # handle nan
              K = np.where(np.isnan(K), 1, K)
              K[K < self.thresh] = 0
              tasklogger.log_complete("affinities")
          return K