问题
I'm using this LDA package for R. Specifically I am trying to do supervised latent dirichlet allocation (slda). In the linked package, there's an slda.em
function. However what confuses me is that it asks for alpha, eta and variance parameters. As far as I understand, I thought these parameters are unknowns in the model. So my question is, did the author of the package mean to say that these are initial guesses for the parameters? If yes, there doesn't seem to be a way of accessing them from the result of running slda.em
.
Aside from coding the extra EM steps in the algorithm, is there a suggested way to guess reasonable values for these parameters?
回答1:
Since you are trying to generate a supervised model, the typical approach would be to use cross validation to determine the model parameters. So you hold out some of the data as your test set, train the a model on the remaining data, and evaluate the model performance, repeating k times. You then continue to repeat with different model parameters to determine which result in the best model performance.
In the specific case of slda, I would run demo(slda)
to see the author's implementation of it. When you run the demo, you'll see that he sets alpha=1.0
, eta=0.1
, and variance=0.25
. I'd suggest using these as your starting point, and then use cross validation to determine better parameters if you need to improve model performance.
来源:https://stackoverflow.com/questions/36902758/r-supervised-latent-dirichlet-allocation-package