spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mln...@apache.org
Subject spark git commit: [SPARK-15492][ML][DOC] Binarization scala example copy & paste to spark-shell error
Date Thu, 26 May 2016 10:36:55 GMT
Repository: spark
Updated Branches:
  refs/heads/master 53d4abe9e -> e451f7f0c


[SPARK-15492][ML][DOC] Binarization scala example copy & paste to spark-shell error

## What changes were proposed in this pull request?

(Please fill in changes proposed in this fix)
The Binarization scala example val dataFrame : Dataframe = spark.createDataFrame(data).toDF("label",
"feature"), which can't be pasted in the spark-shell as Dataframe is not imported. Compared
with other examples, this explicit type is not required.

So I removed Dataframe in the code.
## How was this patch tested?

(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)
Manually tested

Author: wm624@hotmail.com <wm624@hotmail.com>

Closes #13266 from wangmiao1981/unit.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e451f7f0
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e451f7f0
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e451f7f0

Branch: refs/heads/master
Commit: e451f7f0c3857cdbbca98e66928a97f797f2fc6b
Parents: 53d4abe
Author: wm624@hotmail.com <wm624@hotmail.com>
Authored: Thu May 26 12:36:36 2016 +0200
Committer: Nick Pentreath <nickp@za.ibm.com>
Committed: Thu May 26 12:36:36 2016 +0200

----------------------------------------------------------------------
 .../scala/org/apache/spark/examples/ml/BinarizerExample.scala    | 4 ++--
 .../scala/org/apache/spark/examples/ml/OneVsRestExample.scala    | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/e451f7f0/examples/src/main/scala/org/apache/spark/examples/ml/BinarizerExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/spark/examples/ml/BinarizerExample.scala b/examples/src/main/scala/org/apache/spark/examples/ml/BinarizerExample.scala
index 82bc147..5cd13ad 100644
--- a/examples/src/main/scala/org/apache/spark/examples/ml/BinarizerExample.scala
+++ b/examples/src/main/scala/org/apache/spark/examples/ml/BinarizerExample.scala
@@ -21,7 +21,7 @@ package org.apache.spark.examples.ml
 // $example on$
 import org.apache.spark.ml.feature.Binarizer
 // $example off$
-import org.apache.spark.sql.{DataFrame, SparkSession}
+import org.apache.spark.sql.{SparkSession}
 
 object BinarizerExample {
   def main(args: Array[String]): Unit = {
@@ -31,7 +31,7 @@ object BinarizerExample {
       .getOrCreate()
     // $example on$
     val data = Array((0, 0.1), (1, 0.8), (2, 0.2))
-    val dataFrame: DataFrame = spark.createDataFrame(data).toDF("label", "feature")
+    val dataFrame = spark.createDataFrame(data).toDF("label", "feature")
 
     val binarizer: Binarizer = new Binarizer()
       .setInputCol("feature")

http://git-wip-us.apache.org/repos/asf/spark/blob/e451f7f0/examples/src/main/scala/org/apache/spark/examples/ml/OneVsRestExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/spark/examples/ml/OneVsRestExample.scala b/examples/src/main/scala/org/apache/spark/examples/ml/OneVsRestExample.scala
index 0b333cf..0da8e31 100644
--- a/examples/src/main/scala/org/apache/spark/examples/ml/OneVsRestExample.scala
+++ b/examples/src/main/scala/org/apache/spark/examples/ml/OneVsRestExample.scala
@@ -21,7 +21,6 @@ package org.apache.spark.examples.ml
 // $example on$
 import org.apache.spark.ml.classification.{LogisticRegression, OneVsRest}
 import org.apache.spark.ml.evaluation.MulticlassClassificationEvaluator
-import org.apache.spark.sql.DataFrame
 // $example off$
 import org.apache.spark.sql.SparkSession
 
@@ -43,7 +42,7 @@ object OneVsRestExample {
 
     // $example on$
     // load data file.
-    val inputData: DataFrame = spark.read.format("libsvm")
+    val inputData = spark.read.format("libsvm")
       .load("data/mllib/sample_multiclass_classification_data.txt")
 
     // generate the train/test split.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message