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
|
Collection<String> |
wordsNearest(Collection<String> positive,
Collection<String> negative,
int top)
Words nearest based on positive and negative words
|
Collection<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
|
Collection<String> |
wordsNearest(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 Collection<String> wordsNearest(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 Collection<String> wordsNearest(Collection<String> positive, Collection<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 Collection<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>
Copyright © 2016. All Rights Reserved.