kiez.hubness_reduction.CSLS¶
- class kiez.hubness_reduction.CSLS(nn_algo: NNAlgorithm, verbose: int = 0, **kwargs)[source]¶
Hubness reduction with Cross-domain similarity local scaling.
Uses the formula presented in [1].
References
- __init__(nn_algo: NNAlgorithm, verbose: int = 0, **kwargs)¶
Methods
__init__
(nn_algo[, verbose])fit
(source[, target])kneighbors
([k])transform
(neigh_dist, neigh_ind, query)Transform distance between test and training data with CSLS.
- transform(neigh_dist, neigh_ind, query) Tuple[T, T] [source]¶
Transform distance between test and training data with CSLS.
- Parameters:
neigh_dist (np.ndarray, shape (n_query, n_neighbors)) – Distance matrix of test objects (rows) against their individual k nearest neighbors among the training data (columns).
neigh_ind (np.ndarray, shape (n_query, n_neighbors)) – Neighbor indices corresponding to the values in neigh_dist
query – Ignored
- Returns:
CSLS 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.