LDA {ldaPrototype}R Documentation

LDA Object

Description

Constructor for LDA objects used in this package.

Usage

LDA(
  x,
  param,
  assignments,
  topics,
  document_sums,
  document_expects,
  log.likelihoods
)

as.LDA(
  x,
  param,
  assignments,
  topics,
  document_sums,
  document_expects,
  log.likelihoods
)

is.LDA(obj, verbose = FALSE)

Arguments

x

[named list]
Output from lda.collapsed.gibbs.sampler. Alternatively each element can be passed for individual results. Individually set elements overwrite elements from x.

param

[named list]
Parameters of the function call lda.collapsed.gibbs.sampler. List always should contain names "K", "alpha", "eta" and "num.iterations".

assignments

Individual element for LDA object.

topics

Individual element for LDA object.

document_sums

Individual element for LDA object.

document_expects

Individual element for LDA object.

log.likelihoods

Individual element for LDA object.

obj

[R object]
Object to test.

verbose

[logical(1)]
Should test information be given in the console?

Details

The functions LDA and as.LDA do exactly the same. If you call LDA on an object x which already is of the structure of an LDA object (in particular a LDA object itself), the additional arguments param, assignments, ... may be used to override the specific elements.

Value

[named list] LDA object.

See Also

Other constructor functions: as.LDABatch(), as.LDARep()

Other LDA functions: LDABatch(), LDARep(), getTopics()

Examples

res = LDARep(docs = reuters_docs, vocab = reuters_vocab, n = 1, K = 10)
lda = getLDA(res)

LDA(lda)
# does not change anything

LDA(lda, assignments = NULL)
# creates a new LDA object without the assignments element

LDA(param = getParam(lda), topics = getTopics(lda))
# creates a new LDA object with elements param and topics


[Package ldaPrototype version 0.3.1 Index]