Aside from some syntax errors, this looks like exactly how you do it, right?

Except that you call clearThreshold(), which causes it to return the
margin, not a 0/1 prediction. Don't call that. It will default to the
behavior you want.

On Mon, Oct 13, 2014 at 3:03 PM, Alfonso Muñoz Muñoz
<alfonso.mu...@11paths.com> wrote:
> Dear friends,
>
>
>
> Is there any way to know what is the “predicted label” for each “input
> label”?
>
>
>
> [CODE]
>
> …
>
> Val model=SVMWithSGD.train(training,numIterations)
>
> Model.clearThreshold()
>
>
>
> Val scoreAndLabels = test.map{ point =>
>
>                 Val score = model.predict(point.features)
>
>                 (prediction, point.label)
>
> }
>
>
>
> scoreAndLabels.foreach( t=> println(“”+t._1+” [“+t._2”]”))
>
> …
>
> [END CODE]
>
>
>
> Thanks,
>
>

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

Reply via email to