Skip to content
Hubness analysis and removal functions
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Documentation Status



Checkout our new project scikit-hubness which provides the functionality of the Hub-Toolbox while integrating nicely into scikit-learn workflows.

Use skhubness.neighbors as a drop-in replacement for sklearn.neighbors. It offers the same functionality and adds transparent support for hubness reduction, approximate nearest neighbor search (HNSW, LSH), and approximate hubness reduction.

We strive to improve usability of hubness reduction with the development of scikit-hubness, and we are very interested in user feedback!


The Hub Toolbox is a software suite for hubness analysis and hubness reduction in high-dimensional data.

It allows to

  • analyze, whether your datasets show hubness
  • reduce hubness via a variety of different techniques (including scaling and centering approaches) and obtain secondary distances for downstream analysis inside or outside the Hub Toolbox
  • perform evaluation tasks with both internal and external measures (e.g. Goodman-Kruskal index and k-NN classification)
  • NEW IN 2.5: The approximate module provides approximate hubness reduction methods with linear complexity which allow to analyze large datasets.
  • NEW IN 2.5: Measure hubness with the recently proposed Robin-Hood index for fast and reliable hubness estimation.


Make sure you have a working Python3 environment (at least 3.6) with numpy, scipy and scikit-learn packages. Use pip3 to install the latest stable version:

pip3 install hub-toolbox

For more details and alternatives, please see the Installation instructions.


Documentation is available online:


To run a full hubness analysis on the example dataset (DEXTER) using some of the provided hubness reduction methods, simply run the following in a Python shell:

>>> from hub_toolbox.HubnessAnalysis import HubnessAnalysis
>>> ana = HubnessAnalysis()
>>> ana.analyze_hubness()

See how you can conduct the individual analysis steps:

import hub_toolbox

# load the DEXTER example dataset
D, labels, vectors = hub_toolbox.IO.load_dexter()

# calculate intrinsic dimension estimate
d_mle = hub_toolbox.IntrinsinDim.intrinsic_dimension(vectors)

# calculate hubness (here, skewness of 5-occurence)
S_k, _, _ = hub_toolbox.Hubness.hubness(D=D, k=5, metric='distance')

# perform k-NN classification LOO-CV for two different values of k
acc, _, _ = hub_toolbox.KnnClassification.score(
        D=D, target=labels, k=[1,5], metric='distance')

# calculate Goodman-Kruskal index
gamma = hub_toolbox.GoodmanKruskal.goodman_kruskal_index(
        D=D, classes=labels, metric='distance')

# Reduce hubness with Mutual Proximity (Empiric distance distribution)
D_mp = hub_toolbox.MutualProximity.mutual_proximity_empiric(
        D=D, metric='distance')

# Reduce hubness with Local Scaling variant NICDM
D_nicdm = hub_toolbox.LocalScaling.nicdm(D=D, k=10, metric='distance')

# Check whether indices improve after hubness reduction
S_k_mp, _, _ = hub_toolbox.Hubness.hubness(D=D_mp, k=5, metric='distance')
acc_mp, _, _ = hub_toolbox.KnnClassification.score(
        D=D_mp, target=labels, k=[1,5], metric='distance')
gamma_mp = hub_toolbox.GoodmanKruskal.goodman_kruskal_index(
        D=D_mp, classes=labels, metric='distance')

# Repeat the last steps for all secondary distances you calculated

Check the Tutorial for in-depth explanations of the same.


The Hub Toolbox is a work in progress. Get in touch with us if you have comments, would like to see an additional feature implemented, would like to contribute code or have any other kind of issue. Please don't hesitate to file an issue here on GitHub.

(c) 2011-2018, Dominik Schnitzer and Roman Feldbauer
Austrian Research Institute for Artificial Intelligence (OFAI)
Contact: <>


If you use the Hub Toolbox in your scientific publication, please cite:

        author="Feldbauer, Roman
        and Leodolter, Maximilian
        and Plant, Claudia
        and Flexer, Arthur",
        title="Fast approximate hubness reduction for large high-dimensional data",
        bookTitle="IEEE International Conference on Big Knowledge, Singapore, 2018",
        notes="(in press)"

(We expect the proceedings to published by the IEEE in Dec 2018).

Relevant literature:

2018: Fast approximate hubness reduction for large high-dimensional data, available as technical report at

2018: A comprehensive empirical comparison of hubness reduction in high-dimensional spaces, full paper available at

2016: Centering Versus Scaling for Hubness Reduction, available as technical report at .

2012: Local and Global Scaling Reduce Hubs in Space, full paper available at .


The HUB TOOLBOX is licensed under the terms of the GNU GPLv3.


PyVmMonitor is being used to support the development of this free open source software package. For more information go to

You can’t perform that action at this time.