Repository: spark
Updated Branches:
  refs/heads/master 450136ec0 -> c74fd1e54


[SPARK-14937][ML][DOCUMENT] spark.ml LogisticRegression sqlCtx in scala is 
inconsistent with java and python

## What changes were proposed in this pull request?
In spark.ml document, the LogisticRegression scala example uses sqlCtx. It is 
inconsistent with java and python examples which use sqlContext. In addition, a 
user can't copy & paste to run the example in spark-shell as sqlCtx doesn't 
exist in spark-shell while sqlContext exists.

Change the scala example referred by the spark.ml example.

## How was this patch tested?

Compile the example scala file and it passes compilation.

Author: [email protected] <[email protected]>

Closes #12717 from wangmiao1981/doc.


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

Branch: refs/heads/master
Commit: c74fd1e546440e604c546894e956c44fb6021156
Parents: 450136e
Author: [email protected] <[email protected]>
Authored: Wed Apr 27 11:56:57 2016 -0700
Committer: Joseph K. Bradley <[email protected]>
Committed: Wed Apr 27 11:56:57 2016 -0700

----------------------------------------------------------------------
 .../examples/ml/LinearRegressionWithElasticNetExample.scala    | 4 ++--
 .../spark/examples/ml/LogisticRegressionSummaryExample.scala   | 6 +++---
 .../examples/ml/LogisticRegressionWithElasticNetExample.scala  | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/c74fd1e5/examples/src/main/scala/org/apache/spark/examples/ml/LinearRegressionWithElasticNetExample.scala
----------------------------------------------------------------------
diff --git 
a/examples/src/main/scala/org/apache/spark/examples/ml/LinearRegressionWithElasticNetExample.scala
 
b/examples/src/main/scala/org/apache/spark/examples/ml/LinearRegressionWithElasticNetExample.scala
index c7352b3..f68aef7 100644
--- 
a/examples/src/main/scala/org/apache/spark/examples/ml/LinearRegressionWithElasticNetExample.scala
+++ 
b/examples/src/main/scala/org/apache/spark/examples/ml/LinearRegressionWithElasticNetExample.scala
@@ -29,11 +29,11 @@ object LinearRegressionWithElasticNetExample {
   def main(args: Array[String]): Unit = {
     val conf = new 
SparkConf().setAppName("LinearRegressionWithElasticNetExample")
     val sc = new SparkContext(conf)
-    val sqlCtx = new SQLContext(sc)
+    val sqlContext = new SQLContext(sc)
 
     // $example on$
     // Load training data
-    val training = sqlCtx.read.format("libsvm")
+    val training = sqlContext.read.format("libsvm")
       .load("data/mllib/sample_linear_regression_data.txt")
 
     val lr = new LinearRegression()

http://git-wip-us.apache.org/repos/asf/spark/blob/c74fd1e5/examples/src/main/scala/org/apache/spark/examples/ml/LogisticRegressionSummaryExample.scala
----------------------------------------------------------------------
diff --git 
a/examples/src/main/scala/org/apache/spark/examples/ml/LogisticRegressionSummaryExample.scala
 
b/examples/src/main/scala/org/apache/spark/examples/ml/LogisticRegressionSummaryExample.scala
index 04c60c0..89c5edf 100644
--- 
a/examples/src/main/scala/org/apache/spark/examples/ml/LogisticRegressionSummaryExample.scala
+++ 
b/examples/src/main/scala/org/apache/spark/examples/ml/LogisticRegressionSummaryExample.scala
@@ -30,11 +30,11 @@ object LogisticRegressionSummaryExample {
   def main(args: Array[String]): Unit = {
     val conf = new SparkConf().setAppName("LogisticRegressionSummaryExample")
     val sc = new SparkContext(conf)
-    val sqlCtx = new SQLContext(sc)
-    import sqlCtx.implicits._
+    val sqlContext = new SQLContext(sc)
+    import sqlContext.implicits._
 
     // Load training data
-    val training = 
sqlCtx.read.format("libsvm").load("data/mllib/sample_libsvm_data.txt")
+    val training = 
sqlContext.read.format("libsvm").load("data/mllib/sample_libsvm_data.txt")
 
     val lr = new LogisticRegression()
       .setMaxIter(10)

http://git-wip-us.apache.org/repos/asf/spark/blob/c74fd1e5/examples/src/main/scala/org/apache/spark/examples/ml/LogisticRegressionWithElasticNetExample.scala
----------------------------------------------------------------------
diff --git 
a/examples/src/main/scala/org/apache/spark/examples/ml/LogisticRegressionWithElasticNetExample.scala
 
b/examples/src/main/scala/org/apache/spark/examples/ml/LogisticRegressionWithElasticNetExample.scala
index f632960..6e27571 100644
--- 
a/examples/src/main/scala/org/apache/spark/examples/ml/LogisticRegressionWithElasticNetExample.scala
+++ 
b/examples/src/main/scala/org/apache/spark/examples/ml/LogisticRegressionWithElasticNetExample.scala
@@ -29,11 +29,11 @@ object LogisticRegressionWithElasticNetExample {
   def main(args: Array[String]): Unit = {
     val conf = new 
SparkConf().setAppName("LogisticRegressionWithElasticNetExample")
     val sc = new SparkContext(conf)
-    val sqlCtx = new SQLContext(sc)
+    val sqlContext = new SQLContext(sc)
 
     // $example on$
     // Load training data
-    val training = 
sqlCtx.read.format("libsvm").load("data/mllib/sample_libsvm_data.txt")
+    val training = 
sqlContext.read.format("libsvm").load("data/mllib/sample_libsvm_data.txt")
 
     val lr = new LogisticRegression()
       .setMaxIter(10)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to