The problem in JAVA model
Hi, I tested the fastText4j, and train model by: fastText = FastText.train("ag.train", ModelName.sup); fastText.saveModel(java_model);
than load model for predicting a sentence: fastText = FastText.loadModel(java_model); fastText.predict(Arrays.asList(testStr.split(" ")), 5);
get error: java.lang.ArithmeticException: / by zero at com.mayabot.mynlp.fasttext.AreaByteBufferMatrix.get(Matrix.kt:222) at com.mayabot.mynlp.fasttext.FastText.addInputVector(FastText.kt:261) at com.mayabot.mynlp.fasttext.FastText.getWordVector(FastText.kt:196) at com.mayabot.mynlp.fasttext.FastText.getWordVector(FastText.kt:207)
But, i used same data, train model by fastText-0.1.0, load model by: FastText.loadFasttextBinModel(cpp_model); predict = fastText.predict(Arrays.asList(testStr.split(" ")), 5);
That is OK:
predict result:[[__label__4,0.9996598], [__label__1,2.4863696E-4], [__label__3,1.076918E-4], [__label__2,2.3928827E-5]]
Why?
Thank you.
thank you report this bug! I will fixit in v1.1.2
u can update to 1.1.2