diff options
author | Nick Pentreath <nickp@za.ibm.com> | 2016-05-07 10:57:40 +0200 |
---|---|---|
committer | Nick Pentreath <nickp@za.ibm.com> | 2016-05-07 10:57:40 +0200 |
commit | b0cafdb6ccff9add89dc31c45adf87c8fa906aac (patch) | |
tree | 1ce9876b0c6237387283cee2ff021dfb6815e0c4 /examples/src/main/scala | |
parent | df89f1d43d4eaa1dd8a439a8e48bca16b67d5b48 (diff) | |
download | spark-b0cafdb6ccff9add89dc31c45adf87c8fa906aac.tar.gz spark-b0cafdb6ccff9add89dc31c45adf87c8fa906aac.tar.bz2 spark-b0cafdb6ccff9add89dc31c45adf87c8fa906aac.zip |
[MINOR][ML][PYSPARK] ALS example cleanup
Cleans up ALS examples by removing unnecessary casts to double for `rating` and `prediction` columns, since `RegressionEvaluator` now supports `Double` & `Float` input types.
## How was this patch tested?
Manual compile and run with `run-example ml.ALSExample` and `spark-submit examples/src/main/python/ml/als_example.py`.
Author: Nick Pentreath <nickp@za.ibm.com>
Closes #12892 from MLnick/als-examples-cleanup.
Diffstat (limited to 'examples/src/main/scala')
-rw-r--r-- | examples/src/main/scala/org/apache/spark/examples/ml/ALSExample.scala | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/examples/src/main/scala/org/apache/spark/examples/ml/ALSExample.scala b/examples/src/main/scala/org/apache/spark/examples/ml/ALSExample.scala index 7c1cfe2937..6b151a622e 100644 --- a/examples/src/main/scala/org/apache/spark/examples/ml/ALSExample.scala +++ b/examples/src/main/scala/org/apache/spark/examples/ml/ALSExample.scala @@ -23,10 +23,6 @@ import org.apache.spark.ml.evaluation.RegressionEvaluator import org.apache.spark.ml.recommendation.ALS // $example off$ import org.apache.spark.sql.SparkSession -// $example on$ -import org.apache.spark.sql.functions._ -import org.apache.spark.sql.types.DoubleType -// $example off$ object ALSExample { @@ -65,8 +61,6 @@ object ALSExample { // Evaluate the model by computing the RMSE on the test data val predictions = model.transform(test) - .withColumn("rating", col("rating").cast(DoubleType)) - .withColumn("prediction", col("prediction").cast(DoubleType)) val evaluator = new RegressionEvaluator() .setMetricName("rmse") |