VarIr / scikit-hubness

A Python package for hubness analysis and high-dimensional data mining
BSD 3-Clause "New" or "Revised" License
44 stars 9 forks source link

Compute metrics without NN lookup #66

Closed mrdrozdov closed 3 years ago

mrdrozdov commented 3 years ago

Hi, I've already pre-computed my nearest neighbors for a large dataset. Can I use Hubness to compute metrics (such as skewness) using this pre-computed neighbor list?

VarIr commented 3 years ago

Yes, this is possible by setting up a hubness analysis like this:

hub = Hubness(metric="precomputed")
hub.fit(X=distance_matrix)
hubness_estimates = hub.score()

where distance_matrix is your numpy array of precomputed distances.