Using Breeze from Java on Spark MLlib

北慕城南 提交于 2019-12-22 09:26:19

问题


While trying to use MLlib from Java, what is the correct way to use breeze Matrix operations? For e.g. multiplication in scala it ist simply "matrix * vector". How is the corresponding functionality expressed in Java?

There are methods like "$colon$times" which might be invoked by the correct way

breeze.linalg.DenseMatrix<Double> matrix= ...
breeze.linalg.DenseVector<Double> vector = ...  

matrix.$colon$times( ...

one might need an operator instance ... breeze.linalg.operators.OpMulMatrix.Impl2 But which exact typed Operation instance and parameters are to be used?


回答1:


It's honestly very hard. Breeze makes very very heavy use of implicits, and they just don't translate well into Java. We have some Java friendly wrappers for signal processing, but nothing for linear algebra. (I'd happily take a pull request that provided some support for wrapping things.)




回答2:


Have a look at https://spark.apache.org/docs/2.2.0/api/java/org/apache/spark/mllib/linalg/BLAS.html, which contains many of the BLAS linear algebra operations. These can be used by both Scala and Java.



来源:https://stackoverflow.com/questions/27246348/using-breeze-from-java-on-spark-mllib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!