Interface ModelUtils<T extends SequenceElement>
-
- All Known Implementing Classes:
BasicModelUtils
,FlatModelUtils
public interface ModelUtils<T extends SequenceElement>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,Double>
accuracy(List<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 nearestvoid
init(WeightLookupTable<T> lookupTable)
This method implementations should accept given lookup table, and use them in further calls to interface methodsdouble
similarity(String label1, String label2)
This method implementations should return distance between two given elementsList<String>
similarWordsInVocabTo(String word, double accuracy)
Find all words with a similar characters in the vocabCollection<String>
wordsNearest(String label, int n)
This method implementations should return N nearest elements labels to given element's labelCollection<String>
wordsNearest(Collection<String> positive, Collection<String> negative, int top)
Words nearest based on positive and negative wordsCollection<String>
wordsNearest(org.nd4j.linalg.api.ndarray.INDArray words, int top)
Words nearest based on positive and negative words * @param top the top n wordsCollection<String>
wordsNearestSum(String word, int n)
Collection<String>
wordsNearestSum(Collection<String> positive, Collection<String> negative, int top)
Collection<String>
wordsNearestSum(org.nd4j.linalg.api.ndarray.INDArray words, int top)
-
-
-
Method Detail
-
init
void init(WeightLookupTable<T> lookupTable)
This method implementations should accept given lookup table, and use them in further calls to interface methods- Parameters:
lookupTable
-
-
similarity
double similarity(String label1, String label2)
This method implementations should return distance between two given elements- Parameters:
label1
-label2
-- Returns:
-
accuracy
Map<String,Double> accuracy(List<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- Parameters:
questions
- the questions to ask- Returns:
- the accuracy based on these questions
-
similarWordsInVocabTo
List<String> similarWordsInVocabTo(String word, double accuracy)
Find all words with a similar characters in the vocab- Parameters:
word
- the word to compareaccuracy
- the accuracy: 0 to 1- Returns:
- the list of words that are similar in the vocab
-
wordsNearest
Collection<String> wordsNearest(String label, int n)
This method implementations should return N nearest elements labels to given element's label- Parameters:
label
- label to return nearest elements forn
- number of nearest words to return- Returns:
-
wordsNearest
Collection<String> wordsNearest(Collection<String> positive, Collection<String> negative, int top)
Words nearest based on positive and negative words- Parameters:
positive
- the positive wordsnegative
- the negative wordstop
- the top n words- Returns:
- the words nearest the mean of the words
-
wordsNearest
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- Returns:
- the words nearest the mean of the words
-
wordsNearestSum
Collection<String> wordsNearestSum(String word, int n)
-
wordsNearestSum
Collection<String> wordsNearestSum(org.nd4j.linalg.api.ndarray.INDArray words, int top)
-
wordsNearestSum
Collection<String> wordsNearestSum(Collection<String> positive, Collection<String> negative, int top)
-
-