title: Poincare embeddings: building transitive closures from WordNet
body: <p>I'd like to replicate Figure 2 in <a href="https://arxiv.org/pdf/1705.08039.pdf" rel="nofollow noreferrer">Poincaré Embeddings for Learning Hierarchical Representations</a>, namely: Poincare embeddings from the &quot;mammal&quot; subtree of WordNet.</p>
  <p>First, I construct the transitive closure needed to represent the graph. Following <a href="https://www.nltk.org/howto/wordnet.html" rel="nofollow noreferrer">these docs</a> and <a href="https://stackoverflow.com/questions/15330725/">this SO answer</a>, I do the following to construct the relations:</p>
  <pre class="lang-py prettyprint-override"><code>from   nltk.corpus import wordnet as wn
  
  root    = wn.synset('mammal.n.01')
  words   = list(set([w for s in root.closure(hyponyms) for w in s.lemma_names()]))
  rname   = root.name().split('.')[0]
  closure = [(word, rname) for word in words]
  </code></pre>
  <p>Then I am using <a href="https://radimrehurek.com/gensim/models/poincare.html" rel="nofollow noreferrer">Gensim's <code>Poincare</code> model</a> to compute the embeddings. Given the example relations in Gensim's documentation, e.g.</p>
  <pre class="lang-py prettyprint-override"><code>relations = [('kangaroo', 'marsupial'), ('kangaroo', 'mammal'), ('gib', 'cat')]
  </code></pre>
  <p>I infer that the hypernym needs to be to the right. Here is the model fitting code:</p>
  <pre class="lang-py prettyprint-override"><code>
  from   gensim.models.poincare import PoincareModel
  from   gensim.viz.poincare import poincare_2d_visualization
  
  model = PoincareModel(relations, size=2, negative=0)
  model.train(epochs=50)
  
  fig = poincare_2d_visualization(model, relations, 'WordNet Poincare embeddings')
  fig.show()
  </code></pre>
  <p>However, the result is obviously not correct in that it looks nothing like the paper. What am I doing wrong?</p>
  <p><a href="https://i.stack.imgur.com/etpEp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/etpEp.png" alt="Poincare embeddings" /></a></p>