kiez.hubness_reduction.DisSimLocal

class kiez.hubness_reduction.DisSimLocal(squared: bool = True, **kwargs)[source]

Hubness reduction with DisSimLocal.

Uses the formula presented in [1].

Parameters:

squared (bool, default = True) – DisSimLocal operates on squared Euclidean distances. If True, return (quasi) squared Euclidean distances; if False, return (quasi) Eucldean distances.

References

__init__(squared: bool = True, **kwargs)[source]

Methods

__init__([squared])

fit(source[, target])

kneighbors([k])

transform(neigh_dist, neigh_ind, query)

Transform distance between test and training data with DisSimLocal.

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

Transform distance between test and training data with DisSimLocal.

Parameters:
  • neigh_dist (shape (n_query, n_neighbors)) – Distance matrix of test objects (rows) against their individual k nearest neighbors among the training data (columns).

  • neigh_ind (shape (n_query, n_neighbors)) – Neighbor indices corresponding to the values in neigh_dist

  • query (shape (n_query, n_features)) – Query entities that were used to obtain neighbors If none is provided use source that was provided in fit step

Returns:

DisSimLocal distances, and corresponding neighbor indices

Return type:

hub_reduced_dist, neigh_ind

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.