资源算法poincare-embedding

poincare-embedding

2020-04-03 | |  27 |   0 |   0

poincare-embedding

These codes implement Poincar'e Embedding introduced in the following paper:

Maximilian Nickel and Douwe Kiela, "Poincar'e Embeddings for Learning Hierarchical Representations'", arXiv preprint arXiv:1705.08039, 2017.

Requirements

  • C++ compiler that supports c++14 or later

    • for Windows user, using cygwin is recommended (with CMAKE and gcc/g++ selection) (thanks @patrickgitacc)

Build

cd poincare-embedding
mkdir work & cd work
cmake ..
make

Setup python environment

From the poincare-embeddings directory...

python3 -m venv venvsource venv/bin/activate

if using windows:

python3 -m venv venv
venvScriptsactivate

Then run the following:

python3 -m pip install -r requirements.txt
python3 -c "import nltk; nltk.download('wordnet')"

Tutorial

We assume that you are in work directory

cd poincare-embedding
mkdir work & cd work

Data Creation

You can create WordNet noun hypernym pairs as follows

python ../scripts/create_wordnet_noun_hierarchy.py ./wordnet_noun_hypernyms.tsv

and mammal subtree is created by

python ../scripts/create_mammal_subtree.py ./mammal_subtree.tsv

Run

./poincare_embedding ./mammal_subtree.tsv ./embeddings.tsv -d 2 -t 8 -e 1000 -l 0.1 -L 0.0001 -n 20 -s 0

Plot a Mammal Tree

python ../scripts/plot_mammal_subtree.py ./embeddings.tsv --center_mammal

Note: if that doesn't work, may need to run the following:

tr -d '15' < embeddings.tsv > embeddings_clean.tsv

Double check that the file has removed the character in question, then run

mv embeddings_clean.tsv embeddings.tsv


上一篇:One-Shot-Learing-with-Center-Loss

下一篇:geodesic-poincare-embeddings

用户评价
全部评价

热门资源

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • shih-styletransfer

    shih-styletransfer Code from Style Transfer ...