public class TreeModelUtils<T extends SequenceElement> extends BasicModelUtils<T>
BasicModelUtils.ArrayComparator, BasicModelUtils.SimilarityComparator, BasicModelUtils.WordSimilarity
Modifier and Type | Field and Description |
---|---|
protected VPTree |
vpTree |
CORRECT, EXISTS, lookupTable, normalized, vocabCache, WRONG
Constructor and Description |
---|
TreeModelUtils() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkTree() |
void |
init(WeightLookupTable<T> lookupTable)
This method implementations should accept given lookup table, and use them in further calls to interface methods
|
java.util.Collection<java.lang.String> |
wordsNearest(java.util.Collection<java.lang.String> positive,
java.util.Collection<java.lang.String> negative,
int top)
Words nearest based on positive and negative words
|
java.util.Collection<java.lang.String> |
wordsNearest(org.nd4j.linalg.api.ndarray.INDArray words,
int top)
Words nearest based on positive and negative words
* @param top the top n words
|
java.util.Collection<java.lang.String> |
wordsNearest(java.lang.String label,
int n)
This method returns nearest words for target word, based on tree structure.
|
accuracy, getLabels, similarity, similarWordsInVocabTo, wordsNearestSum, wordsNearestSum, wordsNearestSum
protected VPTree vpTree
public void init(@NonNull WeightLookupTable<T> lookupTable)
ModelUtils
init
in interface ModelUtils<T extends SequenceElement>
init
in class BasicModelUtils<T extends SequenceElement>
protected void checkTree()
public java.util.Collection<java.lang.String> wordsNearest(java.lang.String label, int n)
wordsNearest
in interface ModelUtils<T extends SequenceElement>
wordsNearest
in class BasicModelUtils<T extends SequenceElement>
label
- label of element we're looking nearest words ton
- number of nearest elements to returnpublic java.util.Collection<java.lang.String> wordsNearest(java.util.Collection<java.lang.String> positive, java.util.Collection<java.lang.String> negative, int top)
ModelUtils
wordsNearest
in interface ModelUtils<T extends SequenceElement>
wordsNearest
in class BasicModelUtils<T extends SequenceElement>
positive
- the positive wordsnegative
- the negative wordstop
- the top n wordspublic java.util.Collection<java.lang.String> wordsNearest(org.nd4j.linalg.api.ndarray.INDArray words, int top)
BasicModelUtils
wordsNearest
in interface ModelUtils<T extends SequenceElement>
wordsNearest
in class BasicModelUtils<T extends SequenceElement>