Skip to content
Snippets Groups Projects
Commit e451f7f0 authored by wm624@hotmail.com's avatar wm624@hotmail.com Committed by Nick Pentreath
Browse files

[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.
parent 53d4abe9
No related branches found
No related tags found
No related merge requests found
......@@ -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")
......
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment