Thanks it got solved ☺

From: Artem Aliev [mailto:artem.al...@gmail.com]
Sent: Thursday, February 11, 2016 3:19 PM
To: Sonal Goyal
Cc: Chandan Verma; user@spark.apache.org
Subject: Re: Getting prediction values in spark mllib

It depends on Algorithm you use
NaiveBayesModel has predictProbabilities method to work dirrectly with 
probabilites
the LogisiticRegresionModel and SVMModel clearThreshold() will make predict 
method returns probabilites as mentioned above

On Thu, Feb 11, 2016 at 11:17 AM, Sonal Goyal 
<sonalgoy...@gmail.com<mailto:sonalgoy...@gmail.com>> wrote:

Looks like you are doing binary classification and you are getting the label 
out. If you clear the model threshold, you should be able to get the raw score.
On Feb 11, 2016 1:32 PM, "Chandan Verma" 
<chandan.ve...@citiustech.com<mailto:chandan.ve...@citiustech.com>> wrote:

Following is the code Snippet


JavaRDD<Tuple2<Object, Object>> predictionAndLabels = data
                                                                .map(new 
Function<LabeledPoint, Tuple2<Object, Object>>() {
                                                                                
public Tuple2<Object, Object> call(LabeledPoint p) {
                                                                                
                Double prediction = sameModel.predict(p.features());
                                                                                
                return new Tuple2<Object, Object>(prediction, p.label());
                                                                                
}
                                                                });

The line "sameModel.predict(p.features());" gives me the prediction as double 
value (eg 0.0 or 1.0) .
How can i get the prediction value with more digits after decimal 
point.eg<http://point.eg> 0.23443333 etc
===========================================================================================================================================================================================
 DISCLAIMER: The information contained in this message (including any 
attachments) is confidential and may be privileged. If you have received it by 
mistake please notify the sender by return e-mail and permanently delete this 
message and any attachments from your system. Any dissemination, use, review, 
distribution, printing or copying of this message in whole or in part is 
strictly prohibited. Please note that e-mails are susceptible to change. 
CitiusTech shall not be liable for the improper or incomplete transmission of 
the information contained in this communication nor for any delay in its 
receipt or damage to your system. CitiusTech does not guarantee that the 
integrity of this communication has been maintained or that this communication 
is free of viruses, interceptions or interferences. 
====================================================================================================================================================================

Reply via email to