@Test public void testPredictProbability() { String text = "I like soccer"; FastText fastText = new FastText(supModelFile); Pair<String,Float> result = fastText.predictProbability(text); assertEquals("__label__soccer", result.getFirst()); assertEquals(-0.6930, result.getSecond(), 2e-3); assertEquals(48, fastText.vocabSize()); assertEquals(0.0500, fastText.getLearningRate(), 2e-3); assertEquals(100, fastText.getDimension()); assertEquals(5, fastText.getContextWindowSize()); assertEquals(5, fastText.getEpoch()); assertEquals(5, fastText.getNegativesNumber()); assertEquals(1, fastText.getWordNgrams()); assertEquals("softmax", fastText.getLossName()); assertEquals("sup", fastText.getModelName()); assertEquals(0, fastText.getNumberOfBuckets()); }
public Pair<String, Float> predictProbability(String text) { assertModelLoaded(); JFastText.ProbLabel predictedProbLabel = fastTextImpl.predictProba(text); Pair<String,Float> retVal = new Pair<>(); retVal.setFirst(predictedProbLabel.label); retVal.setSecond(predictedProbLabel.logProb); return retVal; }
FastText implements WordVectors, Serializable { public Pair<String, Float> predictProbability(String text) { assertModelLoaded(); JFastText.ProbLabel predictedProbLabel = fastTextImpl.predictProba(text); Pair<String,Float> retVal = new Pair<>(); retVal.setFirst(predictedProbLabel.label); retVal.setSecond(predictedProbLabel.logProb); return retVal; } }
FastText implements WordVectors, Serializable { public Pair<String, Float> predictProbability(String text) { assertModelLoaded(); JFastText.ProbLabel predictedProbLabel = fastTextImpl.predictProba(text); Pair<String,Float> retVal = new Pair<>(); retVal.setFirst(predictedProbLabel.label); retVal.setSecond(predictedProbLabel.logProb); return retVal; } FastText(File modelPath);  FastText(); }
FastText implements WordVectors, Serializable { public Pair<String, Float> predictProbability(String text) { assertModelLoaded(); JFastText.ProbLabel predictedProbLabel = fastTextImpl.predictProba(text); Pair<String,Float> retVal = new Pair<>(); retVal.setFirst(predictedProbLabel.label); retVal.setSecond(predictedProbLabel.logProb); return retVal; } FastText(File modelPath);  FastText(); void fit(); void loadIterator(); void loadPretrainedVectors(File vectorsFile); void loadBinaryModel(String modelPath); void unloadBinaryModel(); void test(File testFile); String predict(String text); Pair<String, Float> predictProbability(String text); @Override VocabCache vocab(); @Override long vocabSize(); @Override String getUNK(); @Override void setUNK(String input); @Override double[] getWordVector(String word); @Override INDArray getWordVectorMatrixNormalized(String word); @Override INDArray getWordVectorMatrix(String word); @Override INDArray getWordVectors(Collection<String> labels); @Override INDArray getWordVectorsMean(Collection<String> labels); @Override boolean hasWord(String word); @Override Collection<String> wordsNearest(INDArray words, int top); @Override Collection<String> wordsNearestSum(INDArray words, int top); @Override Collection<String> wordsNearestSum(String word, int n); @Override Collection<String> wordsNearestSum(Collection<String> positive, Collection<String> negative, int top); @Override Map<String, Double> accuracy(List<String> questions); @Override int indexOf(String word); @Override List<String> similarWordsInVocabTo(String word, double accuracy); @Override Collection<String> wordsNearest(Collection<String> positive, Collection<String> negative, int top); @Override Collection<String> wordsNearest(String word, int n); @Override double similarity(String word, String word2); @Override WeightLookupTable lookupTable(); @Override void setModelUtils(ModelUtils utils); @Override void loadWeightsInto(INDArray array); @Override int vectorSize(); @Override boolean jsonSerializable(); double getLearningRate(); int getDimension(); int getContextWindowSize(); int getEpoch(); int getNegativesNumber(); int getWordNgrams(); String getLossName(); String getModelName(); int getNumberOfBuckets(); String getLabelPrefix(); @Override boolean outOfVocabularySupported(); }
FastText implements WordVectors, Serializable { public Pair<String, Float> predictProbability(String text) { assertModelLoaded(); JFastText.ProbLabel predictedProbLabel = fastTextImpl.predictProba(text); Pair<String,Float> retVal = new Pair<>(); retVal.setFirst(predictedProbLabel.label); retVal.setSecond(predictedProbLabel.logProb); return retVal; } FastText(File modelPath);  FastText(); void fit(); void loadIterator(); void loadPretrainedVectors(File vectorsFile); void loadBinaryModel(String modelPath); void unloadBinaryModel(); void test(File testFile); String predict(String text); Pair<String, Float> predictProbability(String text); @Override VocabCache vocab(); @Override long vocabSize(); @Override String getUNK(); @Override void setUNK(String input); @Override double[] getWordVector(String word); @Override INDArray getWordVectorMatrixNormalized(String word); @Override INDArray getWordVectorMatrix(String word); @Override INDArray getWordVectors(Collection<String> labels); @Override INDArray getWordVectorsMean(Collection<String> labels); @Override boolean hasWord(String word); @Override Collection<String> wordsNearest(INDArray words, int top); @Override Collection<String> wordsNearestSum(INDArray words, int top); @Override Collection<String> wordsNearestSum(String word, int n); @Override Collection<String> wordsNearestSum(Collection<String> positive, Collection<String> negative, int top); @Override Map<String, Double> accuracy(List<String> questions); @Override int indexOf(String word); @Override List<String> similarWordsInVocabTo(String word, double accuracy); @Override Collection<String> wordsNearest(Collection<String> positive, Collection<String> negative, int top); @Override Collection<String> wordsNearest(String word, int n); @Override double similarity(String word, String word2); @Override WeightLookupTable lookupTable(); @Override void setModelUtils(ModelUtils utils); @Override void loadWeightsInto(INDArray array); @Override int vectorSize(); @Override boolean jsonSerializable(); double getLearningRate(); int getDimension(); int getContextWindowSize(); int getEpoch(); int getNegativesNumber(); int getWordNgrams(); String getLossName(); String getModelName(); int getNumberOfBuckets(); String getLabelPrefix(); @Override boolean outOfVocabularySupported();  }