GitXplorerGitXplorer
m

JGibbLabeledLDA

public
104 stars
58 forks
2 issues

Commits

List of commits on branch master.
Unverified
20d2fe6730955fc300b1dc29937ef47b6b3cb24f

Merge pull request #4 from devarajphukan/master

mmyleott committed 8 years ago
Unverified
46f8cd022a460e3f5352e65fcfcfe807778e3593

trim label string

ddevarajphukan committed 8 years ago
Unverified
45683ed50e3da59288f740c9e9ab0377e558adcf

Fixed: documentation for `-nburnin` and `-samplinglag` options

mmyleott committed 11 years ago
Unverified
857173815c7977871e9c70b74fb2a09f65e3cd03

Added: documentation for `-nburnin` and `-samplinglag` options

mmyleott committed 11 years ago
Unverified
73d36ca825f8f5f4714df4e1d416bd0590834d5e

Update: \theta and \phi outputs are now smoothed and normalized

mmyleott committed 11 years ago
Unverified
ec75a2ba0b8d70c3531282ffbe572e9f2c383f0b

Removed: Constants.java and Conversion.java, which were never used

mmyleott committed 11 years ago

README

The README file for this repository.

Labeled LDA in Java (based on JGibbLDA)

This is a Java implementation of Labeled LDA based on the popular JGibbLDA package. The code has been heavily refactored and a few additional options have been added. See sections below for more details.

Data Format

The input data format is similar to the JGibbLDA input data format, with some minor cosmetic changes and additional support for document labels necessary for Labeled LDA. We first describe the (modified) input format for unlabeled documents, followed by the (new) input format for labeled documents.

Changed from JGibbLDA: All input/output files must be Gzipped.

Unlabeled Documents

Unlabeled documents have the following format:

document_1
document_2
...
document_m

where each document is a space-separated list of terms, i.e.,:

document_i = term_1 term_2 ... term_n

Changed from JGibbLDA: The first line should not be an integer indicating the number of documents in the file. The original JGibbLDA code has been modified to identify the number of documents automatically.

Note: Labeled and unlabeled documents may be mixed in the input file, thus you must ensure that unlabeled documents do not begin with a left square bracket (see Labeled Document input format below). One easy fix is to prepend a space character (' ') to each unlabeled document line.

Labeled Documents

Labeled documents follow a format similar to unlabeled documents, but the with labels given at the beginning of each line and surrounded by square brackets, e.g.:

[label_1,1 label_1,2 ... label_1,l_1] document_1
[label_2,1 label_2,2 ... label_2,l_2] document_2
...
[label_m,1 label_m,2 ... label_m,l_m] document_m

where each label is an integer in the range [0, K-1], for K equal to the number of topics (-ntopics).

Note: Labeled and unlabeled documents may be mixed in the input file. An unlabeled document is equivalent to labeling a document with every label in the range [0, K-1].

Usage

Please see the JGibbLDA usage, noting the following changes:

  • All input files must be Gzipped. All output files are also Gzipped.

  • New options have been added:

    -nburnin : Discard this many initial iterations when taking samples.

    -samplinglag : The number of iterations between samples.

    -infseparately: Inference is done separately for each document, as if inference for each document was performed in isolation.

    -unlabeled: Ignore document labels, i.e., treat every document as unlabeled.

  • Some options have been deleted:

    -wordmap: Filename is automatically built based on model path.

Contact

Please direct questions to Myle Ott.

License

Following JGibbLDA, this code is licensed under the GPLv2. Please see the LICENSE file for the full license.

Labeled LDA in Java Copyright (C) 2008-2013 Myle Ott (Labeled LDA), Xuan-Hieu Phan and Cam-Tu Nguyen (JGibbLDA)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.