Search code examples
javablasnd4j

PCA fails with ND4J: BLAS not found?


I'm using ND4J on Windows to do a PCA on a matrix, but I think ND4J can't find the BLAS library.

I installed OpenBLAS with minGW (make then make PREFIX=C:/OpenBLAS install), and added C:\OpenBLAS\bin (where libopenblas.dll is) to the PATH environment variable. Executing where libopenblas.dll returns

C:\Program Files\Java\jdk1.8.0_111\bin\libopenblas.dll
C:\OpenBLAS\bin\libopenblas.dll

So I was surprised to see that OpenBLAS was already installed.

My Java code is the following:

INDArray traceMatrix = /* my data matrix */;
int keptFeatures = 10;
INDArray pcaFactors = PCA.pca(traceMatrix, keptFeatures, false);

and the stack of the error is:

java.lang.UnsupportedOperationException
    at org.nd4j.linalg.factory.BaseBlasWrapper.geev(BaseBlasWrapper.java:470)
    at org.nd4j.linalg.eigen.Eigen.eigenvectors(Eigen.java:100)
    at org.nd4j.linalg.dimensionalityreduction.PCA.pca(PCA.java:62)
    at [myCode:line where the pca() method is called]

Do you have an idea on how to fix this problem?

I am using Eclipse if this can help.

EDIT: I was using an outdated version of ND4J, so I will be updating my libraries, trying to solve my problem.


Solution

  • With the help of Alex Black at https://gitter.im/deeplearning4j/deeplearning4j, I found that I was using an old version of ND4J.

    Switching to a newer version (and installing a back-end) solved the problem.