what is raw prediction in Logistic Regression in spark mllib?

apache-spark, apache-spark-mllib, logistic-regression

Solution

Raw Prediction in case of binary classification is the margin for the concerned class. For a feature vector X,

Raw prediction ` z = WTX ` `∴ z ⊂ (-∞,+∞)`

Prediction probability = `f(z) = 1 / ( 1 + e-z)` `f(z) ⊂ [0, 1]`

Source code for raw-prediction calculation : https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala#L973

Problem

I have run binary logistic regression using spark mllib. As per documentation of spark mllib, RawPrediction are confidence values, which i assume probability for lcl and ucl. I am getting -ve values for RawPrediction. In what scenarios, raw prediction values can be -ve

Original source