kiez.hubness_reduction.MutualProximity

class kiez.hubness_reduction.MutualProximity(method: str = 'normal', **kwargs)[source]

Hubness reduction with Mutual Proximity.

Uses the formula presented in [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

__init__(method: str = 'normal', **kwargs)[source]

Methods

__init__([method])

fit(source[, target])

kneighbors([k])

transform(neigh_dist, neigh_ind, query)

Transform distance between test and training data with Mutual Proximity.

transform(neigh_dist, neigh_ind, query) Tuple[T, T][source]

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

  • query – Ignored

Returns:

Mutual Proximity distances, and corresponding neighbor indices

Return type:

hub_reduced_dist, neigh_ind

Raises:

ValueError – if self.method is unknown

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.