Hello Sparkers,

I kept getting this error:

java.lang.ClassCastException: scala.Tuple2 cannot be cast to
org.apache.spark.mllib.regression.LabeledPoint

I have tried the following to convert v._1 to double:

Method 1:

(if(v._1>0) 1d else 0d)

Method 2:

def bool2Double(b:Boolean): Double = {
  if (b) 1.0
  else 0.0
}

bool2Double(v._1>0)

Method 3:
implicit def bool2Double(b:Boolean): Double = {
  if (b) 1.0
  else 0.0
}


None of them works.

Any advice would be appreciated.

Thanks!

J

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

Reply via email to