deeplearning4j-scaleout/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/wordvectors/WordVectorsImpl.java
/** 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
    * @param questions the questions to ask
    * @return the accuracy based on these 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
@param questions the questions to ask
@return the accuracy based on these 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 @param questions the questions to ask @return the accuracy based on these questions
public Map<String,Double> accuracy(List<String> questions) {
        Map<String,Double> accuracy = new HashMap<>();
        Counter<String> right = new Counter<>();
        for(String s : questions) {
            if(s.startsWith(":")) {
                double correct = right.getCount("correct");
                double wrong = right.getCount("wrong");
                double accuracyRet = 100.0 * correct / (correct / wrong);
                accuracy.put(s,accuracyRet);
                right.clear();
            }
            else {
                String[] split = s.split(" ");
                String word = split[0];
                List<String> positive = Arrays.asList(word);
                List<String> negative = Arrays.asList(split[1],split[2]);
                String predicted = split[3];
                String w = wordsNearest(positive,negative,1).iterator().next();
                if(predicted.equals(w))
                    right.incrementCount("right",1.0);
                else
                    right.incrementCount("wrong",1.0);
            }
        }
        return accuracy;
    }
public Map < String , Double > accuracy ( List < String > questions ) { Map < String , Double > accuracy = new HashMap < > ( ) ; Counter < String > right = new Counter < > ( ) ; for ( String s : questions ) { if ( s . startsWith ( ":" ) ) { double correct = right . getCount ( "correct" ) ; double wrong = right . getCount ( "wrong" ) ; double accuracyRet = 100.0 * correct / ( correct / wrong ) ; accuracy . put ( s , accuracyRet ) ; right . clear ( ) ; } else { String [ ] split = s . split ( " " ) ; String word = split [ 0 ] ; List < String > positive = Arrays . asList ( word ) ; List < String > negative = Arrays . asList ( split [ 1 ] , split [ 2 ] ) ; String predicted = split [ 3 ] ; String w = wordsNearest ( positive , negative , 1 ) . iterator ( ) . next ( ) ; if ( predicted . equals ( w ) ) right . incrementCount ( "right" , 1.0 ) ; else right . incrementCount ( "wrong" , 1.0 ) ; } } return accuracy ; }
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
 @param questions the questions to ask
 @return the accuracy based on these 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 @param questions the questions to ask @return the accuracy based on these questions