You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val lda = LocalOnlineLda.empty
val model = lda.loadModel(new File("/home/xyz/tmp/lda_model")).get
val docloc = new File("/home/xyz/tmp/test_dataset/33629")
val testdoc = text(docloc)
val topicprops = lda.topicProportions(testdoc, model, Some(com.nitro.scalda.tokenizer.StanfordLemmatizer()))
Gives Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: Dimension mismatch! error in the line val topicprops = lda.topicProportions(....).
Error Log:
Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: Dimension mismatch!
at scala.Predef$.require(Predef.scala:224)
at breeze.linalg.operators.DenseMatrixMultiplyStuff$implOpMulMatrix_DMD_DMD_eq_DMD$.apply(DenseMatrixOps.scala:53)
at breeze.linalg.operators.DenseMatrixMultiplyStuff$implOpMulMatrix_DMD_DMD_eq_DMD$.apply(DenseMatrixOps.scala:48)
at breeze.linalg.ImmutableNumericOps$class.$times(NumericOps.scala:135)
at breeze.linalg.DenseMatrix.$times(DenseMatrix.scala:53)
at com.nitro.scalda.models.onlineLDA.local.LocalOnlineLda$$anonfun$eStep$2.apply(LocalOnlineLDA.scala:83)
at com.nitro.scalda.models.onlineLDA.local.LocalOnlineLda$$anonfun$eStep$2.apply(LocalOnlineLDA.scala:74)
at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732)
at com.nitro.scalda.models.onlineLDA.local.LocalOnlineLda.eStep(LocalOnlineLDA.scala:74)
at com.nitro.scalda.models.onlineLDA.local.LocalOnlineLda.topicProportions(LocalOnlineLDA.scala:270)
at testmodel$.delayedEndpoint$testmodel$1(testmodel.scala:28)
at testmodel$delayedInit$body.apply(testmodel.scala:7)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76)
at testmodel$.main(testmodel.scala:7)
at testmodel.main(testmodel.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Scala Version: 2.11.8
System: Ubuntu 14.04
The text was updated successfully, but these errors were encountered:
When using empty, the numTopics is set to zero (0). Later, this value is used to create the initialGamma which returns an empty matrix (1 row, 0 columns).
For what I can tell this matrix is used in several operations and eventually fails as it is expected to have the same number of columns as the original model had, and since it was set to zero, it fails 😞.
A possible solution is to use the model.lambda.rows instead of the params.numTopics in the topicProportions method as this matches the original number of topics.
Saving the model as:
and loading it as:
Gives
Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: Dimension mismatch!
error in the lineval topicprops = lda.topicProportions(....)
.Error Log:
Scala Version: 2.11.8
System: Ubuntu 14.04
The text was updated successfully, but these errors were encountered: