Re: Accessing posterior probability of Naive Baye's prediction

2014-11-28 Thread jatinpreet
Thanks Sean, it did turn out to be a simple mistake after all. I appreciate your help. Jatin On Thu, Nov 27, 2014 at 7:52 PM, sowen [via Apache Spark User List] < ml-node+s1001560n19975...@n3.nabble.com> wrote: > No, the feature vector is not converted. It contains count n_i of how > often each

Re: Accessing posterior probability of Naive Baye's prediction

2014-11-27 Thread Sean Owen
No, the feature vector is not converted. It contains count n_i of how often each term t_i occurs (or a TF-IDF transformation of those). You are finding the class c such that P(c) * P(t_1|c)^n_1 * ... is maximized. In log space it's log(P(c)) + n_1*log(P(t_1|c)) + ... So your n_1 counts (or TF-IDF

Re: Accessing posterior probability of Naive Baye's prediction

2014-11-27 Thread jatinpreet
Hi, I have been running through some troubles while converting the code to Java. I have done the matrix operations as directed and tried to find the maximum score for each category. But the predicted category is mostly different from the prediction done by MLlib. I am fetching iterators of the pi

Re: Accessing posterior probability of Naive Baye's prediction

2014-11-26 Thread jatinpreet
Hi Sean, The values brzPi and brzTheta are of the form breeze.linalg.DenseVector. So would I have to convert them back to simple vectors and use a library to perform addition/multiplication? If yes, can you please point me to the conversion logic and vector operation library for Java? Thanks, Ja

Re: Accessing posterior probability of Naive Baye's prediction

2014-11-26 Thread Sean Owen
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