| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Implementation of Constrained Relational Topic Models (C-RTM), proposed in the paper "Constrained Relational Topic Models" [https://doi.org/10.1016/j.ins.2019.09.039] accepted in Information Sciences, 2020. CRTM is a family of topic models that extend the well-know Relational Topic Models (Chang, 2009). It models the structure of a document network and incorporates other types of relational information obtained by prior domain knowledge. This implementation extends the code from the package of (Weiwei Yang's).
java -cp YWWTools.jar:deps.jar yang.weiwei.Tools --tool lda --model lda --constrained true --vocab <vocab-file> --corpus <corpus-file> --trained-model <model-file>
--constrained true: it must be set to true to allow the incorporation of prior knowledge constraints.
<vocab-file>: Vocabulary file. Each line contains a unique word.
<corpus-file>: Corpus file in which documents are represented by word indexes and frequencies. Each line contains a document in the following format
<doc-len> <word-type-1>:<frequency-1> <word-type-2>:<frequency-2> ... <word-type-n>:<frequency-n>
<doc-len> is the total number of tokens in this document. <word-type-i> denotes the i-th word in <vocab-file>, starting from 0. Words with zero frequency can be omitted.
<model-file>: Trained model file in JSON format. Read and written by program.
--train-c-file <constraint-file>: File containing the document constraints. Each line contains a constraint in the following format
<constraint-type> <document-1> <document-2>
<document-1> is row-id of document-1. <document-2> is row-id of document-2. <constraint-type> must be set to M (if it is a must-constraint) or C (if it is a cannot-constraint).
Three benchmark relational datasets are included in their related folders. They are already preprocessed and ready to be used as input for the model. Notice that the file labels.txt can be used to create the must- and cannot-constraints. Two random documents can be extracted and if their labels are the same, a must-constraint may be added to the <constraint-file>, otherwise a cannot-constraint may be added.
Yang, Y., Downey, D., Boyd-Graber, J.: Efficient Methods for Incorporating Knowledge into Topic Models. In: Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (EMNLP). pp. 308-317 (2015)
Jonathan Chang, David M. Blei: Relational Topic Models for Document Networks. In: Proceedings of the Twelfth International Conference on Artificial Intelligence and Statistics (AISTATS) 2009: 81-88
| Back | FazBrowse Home | New Git URL |