Home

Awesome

TensorFlow-EFE

A collection of Tensorflow implementations of embeddings for entities.

Requirements

Models

The generic abstract model is defined in model.py. All specific models are implemented in efe.py

ModelImplementationsReference
TransETransE_L2; TransE_L1Bordes et al. (NIPS 2013)
NTNNTNSocher et al. (NIPS 2013)
DistMultDistMult; DistMult_tanhYang et al. (ICLR 2015)
ComplExComplex; Complex_tanhTrouillon et al. (ICML 2016)

Preprocess

python preprocess.py -d [data_name]

Hyperparameters

Set hyperparameters

Add hyperparameters dict and its identifier in model_param_space.py.

Search optimal hyperparameters

python task.py -m [model_name] -d [data_name] -e [max_evals] -c [cv_runs]

model_name is the identifier defined in the model_param_space.py. data_name is either wn18 or fb15k. max_evals is the maximum runs to search the hyperparameters, default: 100. cv_runs is the number of runs for the cross validation, default: 3.

The search process and result are stored in log folder.

Evaluation

python train.py -m [model_name] -d [data_name]

Train on the given hyperparameter setting and give the result for the test set.

Performance

<table> <tr> <th>Model</th> <th colspan="4">WN18</th> <th colspan="4">FB15K</th> </tr> <tr> <th></th> <th>Filtered MRR</th> <th>Hits@1 </th> <th>Hits@3 </th> <th>Hits@10 </th> <th>Filtered MRR</th> <th>Hits@1 </th> <th>Hits@3 </th> <th>Hits@10 </th> </tr> <tr> <td>TransE</td> <td>0.454</td> <td>0.089</td> <td>0.814</td> <td>0.954</td> <td>0.407</td> <td>0.272</td> <td>0.480</td> <td>0.657</td> </tr> <tr> <td>DistMult</td> <td>0.868</td> <td>0.786</td> <td>0.948</td> <td>0.970</td> <td>0.761</td> <td><b>0.691</b></td> <td>0.815</td> <td>0.875</td> </tr> <tr> <td>ComplEx</td> <td><b>0.971</b></td> <td><b>0.969</b></td> <td><b>0.973</b></td> <td><b>0.974</b></td> <td><b>0.768</b></td> <td>0.676</td> <td><b>0.843</b></td> <td><b>0.908</b></td> </tr> </table>

License

MIT