[Question] Fast sparse matrix libraries for ML tasks in Java?

For those of you who implement ML methods that require sparse matrices, is there a library you'd recommend? Though I'm looking for a lib that supports Java, any library using native code is a candidate.

The library needs to support large matrices (10^7 x 10^7), support basic linear algebra operations (products, transpose, etc.), and compile to native code that can be wrapped as a Java lib.

I'm currently using a pure-Java lib (Vectorz) in Clojure and the performance isn't there. I've spent some time profiling and improving the library, but my hunch is it will never be comparable to native code. I'd like to find a few candidates to benchmark and test this hunch.

The most promising library I've come across is Eigen (C++). There's an incomplete Java wrapper for it.

In case anyone is curious, I'm working with graphs (1M nodes, 10M edges) and term vectors (10M dimensions). Thanks in advance for any recommendations.

Posted Jan 7, 2015, 8:02 AM UTC

06
kkastner•

BIDMACH seemed pretty cool when I saw it at NIPS this year. Dunno if it meets your exact specs, but it is definitely fast and on the JVM. It also seemed pretty readable from the little bit I looked at it, though I am not really much in the Java and friends languages.

1
mattreplOP•

Hadn't seen this, thanks!

1
stolzen•

Maybe JBlas is what you're looking for. http://mikiobraun.github.io/jblas/

1
mattreplOP•

Thanks, I know of jblas but it doesn't support sparse matrices.

1
EdwardRaff•

Do you know what the performance should be?

I ask this, because unlike dense matrices - sparse matrices are terrible for FLOP throughput. Unless the one you are using really just isn't well optimized, I would expect the performance difference between a pure java & native version to be smaller than normal.

and compile to native code that can be wrapped as a Java lib

Thats a very odd requirement when looking for a Java library.

0
mattreplOP•

I'm also not sure how much of a speed improvement there'd be, I plan to benchmark candidates.

The reason I ask about native libs is because I can write the Java wrapper.

1