[Topic-models] Troubleshooting Johnathan Chang's R-LDA Package

Jonathan Chang foo at facebook.com
Tue Jan 4 16:39:51 EST 2011


I replied to you in the other email, but I think storage.mode doesn't work for
what you want.  If you want to ensure that topics is an integer, multiply by
100000L.  The trailing L tells R that the constant should be treated as an
integer and not a float.

On January 4, 2011 1:32:35 PM PST, Shivani Rao wrote:
> I found this strange error in R-lda package, while doing query
> inference.
> 
> For a given LDAmodel (on the corpus), dicitonary of words =
> myDict,  I
> extract the following
> 
> topics <- LDAmodel$topics *
> 1000000
> storage.mode(topics) <-"integer"   # done to ensure that the matrix
> is an
> integer matrix
> topic_sums <- LDAmodel$topicsums 
> *1000000
> storage.mode(topic_sums) <-"integer" # done to ensure that the
> matrix is an
> integer matrix
> 
> then run the LD model, for the queries
> docs_test
> 
> Querymodel
> <-
> lda.collapsed.gibbs.sampler(docs_test,K,myDict,num_iter,alpha,beta,compute.log.likelihood=TRUE,initial
> =
> list(topics = topics,topic_sums = topic_sums))
> 
> I get the following
> error
> 
> Error in structure(.Call("collapsedGibbsSampler", documents,
> as.integer(K),
> :
> Counts became negative for word (241): (4, -2147482775,
> 2)
>  n storage.mode(topics) <- "integer" : NAs introduced by coercion
> 
> Any
> clue as to why this is happening?
> 
> 
> Regards,
> Shivani
> 
> -- 
> Research
> Scholar,
> School of Electrical and Computer Engineering
> Purdue
> University
> West Lafayette
> IN
> web.ics.purdue.edu/~sgrao
> _______________________________________________
> Topic-models
> mailing
> list
> Topic-models at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/topic-models
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/topic-models/attachments/20110104/2f0ffa50/attachment.htm>


More information about the Topic-models mailing list