as.RollingLDA: RollingLDA Object

Description Usage Arguments Details Value See Also Examples

View source: R/as.RollingLDA.R

Description

Constructor for RollingLDA objects used in this package. The function may be useful to create a RollingLDA object out of a standard LDA object to use it as initial model and update it using updateRollingLDA.

Usage

1
2
3
as.RollingLDA(x, id, lda, docs, dates, vocab, chunks, param)

is.RollingLDA(obj, verbose = FALSE)

Arguments

x

[named list]
RollingLDA object. Alternatively each element can be passed for individual results. Individually set elements overwrite elements from x.

id

[character(1)]
Name for the computation/model.

lda

[named list]
LDA object.

docs

[named list]
Texts in a preprocessed format. See LDAprep.

dates

[(un)named Date]
Dates of the texts. If unnamed, it must match the order of docs.

vocab

[character]
Vocabularies.

chunks

[data.table]
with specifications for each model chunk

chunk.id

[integer] Index counting up starting with 0.

start.date

[Date] Minimum of each chunk's dates.

end.date

[Date] Maximum of each chunk's dates.

memory

[Date] Date from which texts are considered as memory.

n

[integer] Number of fitted texts.

n.dicsarded

[integer] Number of lost texts through preprocessing.

n.memory

[integer] Number of texts considered as memory.

n.vocab

[integer] Number of vocabularies (monotonously increasing).

If not passed, lda is interpreted as initialization chunk.

param

[named list(4)]
Parameters of the object, i.e. parameters for future updates fitted on the to be created model. List always should contain names "vocab.abs", "vocab.rel", "vocab.fallback" and "doc.abs".

obj

[R object]
Object to test.

verbose

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

Details

If you call as.RollingLDA on an object x which already is of the structure of an RollingLDA object (in particular a RollingLDA object itself), the additional arguments id, param, ... may be used to override the specific elements.

Value

[named list] RollingLDA object.

See Also

Other RollingLDA functions: RollingLDA(), getChunks(), updateRollingLDA()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
roll_lda = RollingLDA(texts = economy_texts,
                      dates = economy_dates,
                      chunks = "quarter",
                      memory = "3 quarter",
                      init = "2008-07-03",
                      K = 10,
                      type = "lda")

is.RollingLDA(roll_lda, verbose = TRUE)
getID(roll_lda)
roll_lda = as.RollingLDA(roll_lda, id = "newID")
getID(roll_lda)

rollinglda documentation built on Oct. 28, 2021, 5:10 p.m.