@Test public void testWordsNearestBasic1() throws Exception { vec.setModelUtils(new BasicModelUtils<VocabWord>()); String target = "energy"; INDArray arr1 = vec.getWordVectorMatrix(target).dup(); System.out.println("[-]: " + arr1); System.out.println("[+]: " + Transforms.unitVec(arr1)); Collection<String> list = vec.wordsNearest(target, 10); log.info("Transpose model results:"); printWords(target, list, vec); list = vec.wordsNearest(target, 10); log.info("Transpose model results 2:"); printWords(target, list, vec); list = vec.wordsNearest(target, 10); log.info("Transpose model results 3:"); printWords(target, list, vec); INDArray arr2 = vec.getWordVectorMatrix(target).dup(); assertEquals(arr1, arr2); }
@Override public Collection<String> wordsNearest(String label, int n) { Collection<String> collection = wordsNearest(lookupTable.vector(label), n); if (collection.contains(label)) collection.remove(label); return collection; }
FlatModelUtils extends BasicModelUtils<T> { @Override public Collection<String> wordsNearest(String label, int n) { Collection<String> collection = wordsNearest(lookupTable.vector(label), n); if (collection.contains(label)) collection.remove(label); return collection; } }
FlatModelUtils extends BasicModelUtils<T> { @Override public Collection<String> wordsNearest(String label, int n) { Collection<String> collection = wordsNearest(lookupTable.vector(label), n); if (collection.contains(label)) collection.remove(label); return collection; } FlatModelUtils(); }
FlatModelUtils extends BasicModelUtils<T> { @Override public Collection<String> wordsNearest(String label, int n) { Collection<String> collection = wordsNearest(lookupTable.vector(label), n); if (collection.contains(label)) collection.remove(label); return collection; } FlatModelUtils(); @Override Collection<String> wordsNearest(String label, int n); @Override Collection<String> wordsNearest(INDArray words, int top); }
FlatModelUtils extends BasicModelUtils<T> { @Override public Collection<String> wordsNearest(String label, int n) { Collection<String> collection = wordsNearest(lookupTable.vector(label), n); if (collection.contains(label)) collection.remove(label); return collection; } FlatModelUtils(); @Override Collection<String> wordsNearest(String label, int n); @Override Collection<String> wordsNearest(INDArray words, int top);  }