我是一个新手,对神经网络和自然语言处理一无所知。我发现了这个库:DeepLearning4J。我正在尝试让它工作,但每当我执行以下指令时:
Collection<String> similar = vec.wordsNearest("word_to_search", 10);
如果我搜索的单词被映射到网络上,我会得到以下异常:
java.lang.IllegalArgumentException: XERBLA: Error on argument 6 (LDA) in SGEMV
at org.jblas.NativeBlas.sgemv(Native Method)
at org.nd4j.linalg.jblas.blas.JblasLevel2.sgemv(JblasLevel2.java:25)
at org.nd4j.linalg.api.blas.impl.BaseLevel2.gemv(BaseLevel2.java:53)
at org.nd4j.linalg.api.ndarray.BaseNDArray.mmuli(BaseNDArray.java:2569)
at org.nd4j.linalg.api.ndarray.BaseNDArray.mmul(BaseNDArray.java:2377)
at org.deeplearning4j.models.embeddings.wordvectors.WordVectorsImpl.wordsNearest(WordVectorsImpl.java:290)
at org.deeplearning4j.models.embeddings.wordvectors.WordVectorsImpl.wordsNearest(WordVectorsImpl.java:337)
at word2vec.Word2VecTest.main(Word2VecTest.java:74)
Exception in thread "main" java.lang.NoSuchMethodError: org.nd4j.linalg.api.ndarray.INDArray.mean(I)Lorg/nd4j/linalg/api/ndarray/INDArray;
at org.deeplearning4j.models.embeddings.wordvectors.WordVectorsImpl.wordsNearest(WordVectorsImpl.java:283)
at word2vec.Word2VecTest.main(Word2VecTest.java:89)
我知道NoSuchMethodError可能是由库不同版本引起的。在这种特定情况下,这可能是由nd4j引起的。我已经多次检查了版本,这是我正在导入的版本。
- akka-actor_2.11-2.4-M3.jar
- akka-cluster_2.11-2.4-M3.jar
- akka-remote_2.11-2.4-M3.jar
- akka-slf4j_2.11-2.4-M3.jar
- byte-buddy-0.6.15.jar
- config-1.3.0.jar
- deeplearning4j-core-0.0.3.3.4.alpha2.jar
- deeplearning4j-nlp-0.0.3.3.4.alpha2.jar
- deeplearning4j-scaleout-akka-0.0.3.3.4.alpha2.jar
- deeplearning4j-ui-0.0.3.3.4.alpha2.jar
- javassist-3.12.1.GA.jar
- jblas-1.2.4.jar
- jcublas-6.5.jar
- lucene-analyzers-common-4.10.3.jar
- lucene-core-4.10.3.jar
- nd4j-api-0.4-rc3.4.jar
- nd4j-bytebuddy-0.4-rc3.4.jar
- nd4j-jblas-0.4-rc3.4.jar
- nd4j-jcublas-common-0.4-rc3.4.jar
- netty-3.10.4.Final.jar
- protobuf-java-2.6.1.jar
- reflections-0.9.10.jar
- scala-library-2.12.0-M2.jar
- selenium-server-standalone-2.47.1.jar