Link Prediction using Knowledge Embedding in Tensorflow
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
datasets
README.md
complex_embeddings.py
data_helpers.py
link_prediction.py
train.py

README.md

This code belongs to the implementation of Complex Embeddings for Simple Link Prediction paper.

Requirements

  • Python 3
  • Tensorflow > 0.8
  • Numpy

Training

Print parameters:

./train.py --help
optional arguments:
  -h, --help            show this help message and exit
  --embedding_dim EMBEDDING_DIM
                        Dimensionality of character embedding (default: 128)
  --l2_reg_lambda L2_REG_LAMBDA
                        L2 regularizaion lambda (default: 0.0)
  --batch_size BATCH_SIZE
                        Batch Size (default: 64)
  --num_epochs NUM_EPOCHS
                        Number of training epochs (default: 100)
  --evaluate_every EVALUATE_EVERY
                        Evaluate model on dev set after this many steps
                        (default: 100)
  --checkpoint_every CHECKPOINT_EVERY
                        Save model after this many steps (default: 100)
  --max_iter MAX_ITER
                        MAximum Iterations (default: 1000)
  --neg_ratio NEG_RATIO
                        Negative ratio for sampling (default: 2)
  --contiguous_sampling CONTIGUOUS_SAMPLING
                        Whether negative sampling is contiguous
                        (default: False)
  --learning_ratio LEARNING_RATIO
                        Learning rate for SGD (default: 0.5)
        
  --allow_soft_placement ALLOW_SOFT_PLACEMENT
                        Allow device soft device placement
  --log_device_placement LOG_DEVICE_PLACEMENT
                        Log placement of ops on devices

Train:

./train.py

Link Predicting

./link_prediction.py --checkpoint_dir="./runs/1451237919/checkpoints/"

Replace the checkpoint dir with the output from the training. To use your own data, change the link_prediction.py script to load your data.