在dl4j word2 vec vecs.similarity方法抛出空指针异常

时间:2017-07-01 05:11:34

标签: java deeplearning4j dl4j

    File gModel = new File("D:/FluidAI/WordVec/pathToSaveModel.txt");
    Word2Vec vecs = WordVectorSerializer.readWord2VecModel(gModel);//("D:/FluidAI/WordVec/pathToSaveModel.txt");
    vecs.setTokenizerFactory(t);
    vecs.setSentenceIter(iter);
    //vecs.set
    vecs.fit();

    WordVectorSerializer.writeWordVectors(vecs, "pathToWriteto.txt"); 
     WordVectorSerializer.writeWord2VecModel(vecs, "pathToSaveModel.txt");
     Collection<String> st=vecs.wordsNearest("enclave", 10);
     System.out.println(st);


    double cosSim = vecs.similarity("extn", "dausa");
    System.out.println(cosSim);
vecs.similarity中的

在训练后抛出空指针异常

0 个答案:

没有答案