skhubness.reduction.MutualProximity — scikit-hubness 0.21.0a8 documentation

# skhubness.reduction.MutualProximity

class `skhubness.reduction.` `MutualProximity`(method: str = 'normal', verbose: int = 0, **kwargs)

  Hubness reduction with Mutual Proximity [R5a390b9a9956-1].

  Parameters
    method: ‘normal’ or ‘empiric’, default = ‘normal’

      Model distance distribution with ‘method’.

      - ‘normal’ or ‘gaussi’ model distance distributions with independent Gaussians (fast)

      - ‘empiric’ or ‘exact’ model distances with the empiric distributions (slow)

    verbose: int, default = 0

      If verbose > 0, show progress bar.

  References

  R5a390b9a9956-1

    Schnitzer, D., Flexer, A., Schedl, M., & Widmer, G. (2012). Local and global scaling reduce hubs in space. The Journal of Machine Learning Research, 13(1), 2871–2902.

  `__init__`(self, method: 'str' = 'normal', verbose: 'int' = 0, **kwargs)

    Initialize self. See help(type(self)) for accurate signature.

  Methods

  `__init__`(self, method, verbose, \*\*kwargs) | Initialize self.
  `fit`(self, neigh_dist, neigh_ind[, X, …]) | Fit the model using neigh_dist and neigh_ind as training data.
  `fit_transform`(self, neigh_dist, neigh_ind, X) | Equivalent to call .fit().transform()
  `transform`(self, neigh_dist, neigh_ind[, X, …]) | Transform distance between test and training data with Mutual Proximity.

  `fit`(self, neigh_dist, neigh_ind, X=None, assume_sorted=None, *args, **kwargs) → 'MutualProximity'

    Fit the model using neigh_dist and neigh_ind as training data.

    Parameters
      neigh_dist: np.ndarray, shape (n_samples, n_neighbors)

        Distance matrix of training objects (rows) against their individual k nearest neighbors (columns).

      neigh_ind: np.ndarray, shape (n_samples, n_neighbors)

        Neighbor indices corresponding to the values in neigh_dist.

      X: ignored
      assume_sorted: ignored
  `fit_transform`(self, neigh_dist, neigh_ind, X, assume_sorted=True, return_distance=True, *args, **kwargs)

    Equivalent to call .fit().transform()

  `transform`(self, neigh_dist, neigh_ind, X=None, assume_sorted=None, *args, **kwargs)

    Transform distance between test and training data with Mutual Proximity.

    Parameters
      neigh_dist: np.ndarray

        Distance matrix of test objects (rows) against their individual k nearest neighbors among the training data (columns).

      neigh_ind: np.ndarray

        Neighbor indices corresponding to the values in neigh_dist

      X: ignored
      assume_sorted: ignored
    Returns
      hub_reduced_dist, neigh_ind

        Mutual Proximity distances, and corresponding neighbor indices

    Notes

    The returned distances are NOT sorted! If you use this class directly, you will need to sort the returned matrices according to hub_reduced_dist. Classes from `skhubness.neighbors` do this automatically.