3
$\begingroup$

I am wanting to play around with LDA topic modelling, namely looking at the effects of document length, topic number etc all have on accuracy (I know it has been done elsewhere, but no one seems to publish how they generated the documents in the first place!)

Does anyone have any methods for generating data for an LDA model? Where I can control topic number, document number etc?

$\endgroup$

1 Answer 1

2
$\begingroup$

In general text is not generated artificially because this leads to non-realistic datasets. In the case of LDA it would be very easy to generate data using LDA itself since it's a generative model. However this would make it a much easier job for LDA to estimate the parameters than with some real corpus.

So as far as I know most experiments about topic modeling are made with some real corpora, for example the UN corpus, the State of the Union corpus, the Europarl corpus, etc. The advantage with topic modeling is that there's no need for annotation so any large collection of text can be used.

Does anyone have any methods for generating data for an LDA model? Where I can control topic number, document number etc?

Note that the number of topics $k$ is a parameter in LDA, so whatever the data LDA searches for exactly $k$ topics. The number of documents is fairly easy to control if you use any large collection of documents. The main difficulty with topic modeling is how to evaluate the resulting model.

$\endgroup$
3
  • $\begingroup$ I understand that LDA is not generally performed on synthetic datasets, for the above reasons, and I also understand that you are likely to get unrealistic models. I should have been clearer - my goal is NOT to create an LDA model. I want to understand more fully and perform experiments that show the impact of K, Document Length, Document Number etc have on the performance of an LDA model, along the lines of proceedings.mlr.press/v32/tang14.html. The only way I can think to ensure some validity would be to feed an LDA some documents where K, D etc are known $\endgroup$ Aug 15, 2021 at 19:11
  • $\begingroup$ @user5067291 Apparently the authors of the paper use the LDA generative process, as I mentioned at the beginning of my answer: "We first investigate the behavior of the LDA using synthetic data sets that are generated by the LDA generative process with different parameter configurations.". It seems that they don't provide the code so you might have to implement this yourself. This can be relevant for studying the properties of LDA indeed, but it won't be informative with respect to what happens with actual text since real text is not necessarily distributed as assumed by LDA. $\endgroup$
    – Erwan
    Aug 15, 2021 at 20:28
  • 1
    $\begingroup$ My suggestion for your study would be to use some real text data where the topics are known, for example from Wikipedia. $\endgroup$
    – Erwan
    Aug 15, 2021 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.