You can call Scala code from Java, even when it involves overloaded
operators, since they are also just methods with names like $plus and
$times. In this case, it's not quite feasible since the Scala API is
complex and would end up forcing you to manually supply some other
implementation details to work

This code is very easy to reproduce in Java. It's a vector plus
matrix-times-vector. argmax tells you the index of that resulting
vector with the largest value.

On Wed, Nov 26, 2014 at 6:11 AM, jatinpreet <jatinpr...@gmail.com> wrote:
> Hi,
>
> I am trying to access the posterior probability of Naive Baye's prediction
> with MLlib using Java. As the member variables brzPi and brzTheta are
> private, I applied a hack to access the values through reflection.
>
> I am using Java and couldn't find a way to use the breeze library with Java.
> If I am correct the relevant calculation is given through line number 66 in
> NaiveBayesModel class,
>
> labels(brzArgmax(brzPi + brzTheta * testData.toBreeze))
>
> Here the element-wise additions and multiplication of DenseVectors are given
> as operators which are not directly accessible in Java. Also, the use of
> brzArgmax is not very clear with Java for me.
>
> Can anyone please help me convert the above mentioned calculation from Scala
> to Java.
>
> PS: I have raised a improvement request on Jira for making these variables
> directly accessible from outside.
>
> Thanks,
> Jatin
>
>
>
> -----
> Novice Big Data Programmer
> --
> View this message in context: 
> http://apache-spark-user-list.1001560.n3.nabble.com/Accessing-posterior-probability-of-Naive-Baye-s-prediction-tp19828.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
> For additional commands, e-mail: user-h...@spark.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org

Reply via email to