### Question:
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);  }### Answer:
@Test public void testWordsNearestFlat1() throws Exception { vec.setModelUtils(new FlatModelUtils<VocabWord>()); Collection<String> list = vec.wordsNearest("energy", 10); log.info("Flat model results:"); printWords("energy", list, vec); }
@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); }
@Test @Ignore public void testWordsNearestTree1() throws Exception { vec.setModelUtils(new TreeModelUtils<VocabWord>()); Collection<String> list = vec.wordsNearest("energy", 10); log.info("Tree model results:"); printWords("energy", list, vec); }