You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by colin <co...@sina.cn> on 2016/05/05 05:59:43 UTC

Mllib using model to predict probability

In 2-class problems, when I use SVM, RondomForest models to do
classifications, they predict "0" or "1".
And when I use ROC to evaluate the model, sometimes I need a probability
that a record belongs to "0" or "1".
In scikit-learn, every model can do "predict" and "predict_prob", which the
last one can ouput the probability.
I find the document, and didn't found this function in MLLIB. 
Does mllib has this function?



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Mllib-using-model-to-predict-probability-tp26886.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

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


Re: Mllib using model to predict probability

Posted by nd...@gmail.com.
You can user the BinaryClassificationEvaluator class to get both predicted classes (0/1) and probabilities. Check the following spark doc https://spark.apache.org/docs/latest/mllib-evaluation-metrics.html .


Cheers,
Ardo 

Sent from my iPhone

> On 05 May 2016, at 07:59, colin <co...@sina.cn> wrote:
> 
> In 2-class problems, when I use SVM, RondomForest models to do
> classifications, they predict "0" or "1".
> And when I use ROC to evaluate the model, sometimes I need a probability
> that a record belongs to "0" or "1".
> In scikit-learn, every model can do "predict" and "predict_prob", which the
> last one can ouput the probability.
> I find the document, and didn't found this function in MLLIB. 
> Does mllib has this function?
> 
> 
> 
> --
> View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Mllib-using-model-to-predict-probability-tp26886.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
> 

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