Skip to content

Commit

Permalink
make ClassificatinModel.predict(JavaRDD) return JavaDoubleRDD
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxr committed Feb 4, 2015
1 parent 7c0946c commit a89763b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.spark.mllib.classification

import org.apache.spark.annotation.Experimental
import org.apache.spark.api.java.JavaRDD
import org.apache.spark.api.java.{JavaDoubleRDD, JavaRDD}
import org.apache.spark.mllib.linalg.Vector
import org.apache.spark.rdd.RDD

Expand Down Expand Up @@ -48,8 +48,8 @@ trait ClassificationModel extends Serializable {
/**
* Predict values for examples stored in a JavaRDD.
* @param testData JavaRDD representing data points to be predicted
* @return a JavaRDD[java.lang.Double] where each entry contains the corresponding prediction
* @return a JavaDoubleRDD where each entry contains the corresponding prediction
*/
def predict(testData: JavaRDD[Vector]): JavaRDD[java.lang.Double] =
predict(testData.rdd).toJavaRDD().asInstanceOf[JavaRDD[java.lang.Double]]
def predict(testData: JavaRDD[Vector]): JavaDoubleRDD =
JavaDoubleRDD.fromRDD(predict(testData.rdd))
}

0 comments on commit a89763b

Please sign in to comment.