PyTorch implementation of Designing Hierarchies for Optimal Hyperbolic Embedding paper.
The trees that we used in this paper are all in the ./tree folder. However, if you want to generate and visualize them yourself, you can run evaluate.py:
tree_types = ["binomial", "full_rary_tree", "barabasi_albert_graph", "star_graph", "path_graph"]
rs = [2, 3, 4, 5]
Ns = [256, 512, 1024]
dims = [10, 20, 130]
# Generate and visualize trees
generate_trees_and_adjacency(tree_types, rs, Ns)You can find the real-world ontology that we are using under the ./real-world/ directory. You can also find the final best embedding of each method under ./tree/{tree_name}/{method_name}/.
To get the Poincare embeddings of the generated trees (Binomial, rary, and Barabasi-Albert), run:
bash run_poincare.shTo get the Poincare embeddings of the real-world trees (ImageNet and Pizza ontology), run:
bash run_poincare_realworld.shTo get the Average distortion, Worst-case distortion, and MAP of the hyperbolic embeddings, run:
python evaluate.pyThis calls the evaluate_tree(tree, embeddings) function.
You can find the dependencies of our project in:
requirements_optimal_hierarchy.txt(for the main project)requirements_poincare.txt(for the Poincare code)
This code is licensed under Apache-2.0.