public interface ModelUtils<T extends SequenceElement>
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Double> |
accuracy(java.util.List<java.lang.String> questions)
Accuracy based on questions which are a space separated list of strings
where the first word is the query word, the next 2 words are negative,
and the last word is the predicted word to be nearest
|
void |
init(WeightLookupTable<T> lookupTable)
This method implementations should accept given lookup table, and use them in further calls to interface methods
|
double |
similarity(java.lang.String label1,
java.lang.String label2)
This method implementations should return distance between two given elements
|
java.util.List<java.lang.String> |
similarWordsInVocabTo(java.lang.String word,
double accuracy)
Find all words with a similar characters
in the vocab
|
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 implementations should return N nearest elements labels to given element's label
|
java.util.Collection<java.lang.String> |
wordsNearestSum(java.util.Collection<java.lang.String> positive,
java.util.Collection<java.lang.String> negative,
int top) |
java.util.Collection<java.lang.String> |
wordsNearestSum(org.nd4j.linalg.api.ndarray.INDArray words,
int top) |
java.util.Collection<java.lang.String> |
wordsNearestSum(java.lang.String word,
int n) |
void init(WeightLookupTable<T> lookupTable)
lookupTable
- double similarity(java.lang.String label1, java.lang.String label2)
label1
- label2
- java.util.Map<java.lang.String,java.lang.Double> accuracy(java.util.List<java.lang.String> questions)
questions
- the questions to askjava.util.List<java.lang.String> similarWordsInVocabTo(java.lang.String word, double accuracy)
word
- the word to compareaccuracy
- the accuracy: 0 to 1java.util.Collection<java.lang.String> wordsNearest(java.lang.String label, int n)
label
- label to return nearest elements forn
- number of nearest words to returnjava.util.Collection<java.lang.String> wordsNearest(java.util.Collection<java.lang.String> positive, java.util.Collection<java.lang.String> negative, int top)
positive
- the positive wordsnegative
- the negative wordstop
- the top n wordsjava.util.Collection<java.lang.String> wordsNearest(org.nd4j.linalg.api.ndarray.INDArray words, int top)
java.util.Collection<java.lang.String> wordsNearestSum(java.lang.String word, int n)
java.util.Collection<java.lang.String> wordsNearestSum(org.nd4j.linalg.api.ndarray.INDArray words, int top)
java.util.Collection<java.lang.String> wordsNearestSum(java.util.Collection<java.lang.String> positive, java.util.Collection<java.lang.String> negative, int top)