Hi,

I am unable to get the raw probabilities despite of clearing the threshold.
Its still printing the predicted label.

Can someone help resolve this issue.

Here is the code snippet.

LogisticRegressionWithSGD lrLearner = new LogisticRegressionWithSGD();
LogisticRegressionModel model = lrLearner.run(labeledPointTrain.rdd());
model.clearThreshold();
JavaRDD<Tuple2<Object, Object>> predictionAndLabels = labeledPointTrain.map(
new Function<LabeledPoint, Tuple2<Object, Object>>() {
public Tuple2<Object, Object> call(LabeledPoint p) {
Double prediction = model.predict(p.features());
return new Tuple2<Object, Object>(prediction, p.label());
}
}
);


predictionAndLabels.foreach(new VoidFunction<Tuple2<Object, Object>>(){

@Override
public void call(Tuple2<Object, Object> pred) throws Exception {
logger.error("PREDICTION:" + pred._1() + " ACTUAL LABEL:" + pred._2());

}
});



Thanks,
Kundan

Reply via email to