Repository for the Path-Ranking Algorithm

This repository contains the code used for the following papers:

If you use this code or results in your research, and wish to cite as appropriate:

  author="Lao, Ni
  and Cohen, William W.",
  title="Relational retrieval using a combination of path-constrained random walks",
  journal="Machine Learning",
  title={Random walk inference and learning in a large scale knowledge base},
  author={Lao, Ni and Mitchell, Tom and Cohen, William W},
  booktitle={Proceedings of the Conference on Empirical Methods in Natural Language Processing},
  organization={Association for Computational Linguistics}


Compiled jar file can be found at Data files can be found at

  1. Produce edges file from a NELL knowledge dump

    arg1=NELL dump file arg2=probability threshold arg3=output format)

    java -cp pra-src-20140421.jar createEdgeFile NELL.08m.165.cesv.csv 0.8 edges
  2. index edge file to a compact graph reprensentation

    arg1=graph folder which contains *.edges arg2=edges/db)

    java -cp pra-src-20140421.jar edu.cmu.pra.SmallJobs indexGraph ../graphs/NELL165/ edges
  3. create Queries

    arg1=graph folder arg2=query folder arg3=whether its for training (boolean) arg4=whether adding the range of relation as part of the query (boolean)

    java -cp pra-src-20140421.jar edu.cmu.pra.SmallJobs createQueries ../graphs/NELL165/ ./queriesR_train/ true false
  4. Train model (or do predictions) for a relation with parameters specified by ./conf

    java -cp pra-src-20140421.jar edu.cmu.pra.LearnerPRA
  5. Train models (or do predictions) in batch mode.

    arg1=path to java class files arg2=text file containing a list of relation names

    java -cp pra-src-20140421.jar edu.cmu.pra.SmallJobs batchLearnerPRA pra-src-20140421.jar selected_relations