Interface ModelUtils<T extends SequenceElement>

    • 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 compare
        accuracy - 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 for
        n - 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 words
        negative - the negative words
        top - 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​(org.nd4j.linalg.api.ndarray.INDArray words,
                                           int top)