From dff3b2af8437ff051f089d8f2494c4945fe63912 Mon Sep 17 00:00:00 2001 From: "wm624@hotmail.com" Date: Tue, 26 Apr 2016 16:15:35 -0700 Subject: [PATCH 1/2] fix sqlCtx in example --- .../examples/ml/LogisticRegressionWithElasticNetExample.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 f632960f26ae..6e27571f1dc1 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) From a7e3cd56122efb8253b2434a8398dfb7e886bd06 Mon Sep 17 00:00:00 2001 From: "wm624@hotmail.com" Date: Tue, 26 Apr 2016 16:28:43 -0700 Subject: [PATCH 2/2] fix linearregression and logisticregresstion trainning summary --- .../examples/ml/LinearRegressionWithElasticNetExample.scala | 4 ++-- .../examples/ml/LogisticRegressionSummaryExample.scala | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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 c7352b3e7ab9..f68aef708201 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() 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 04c60c0c1d06..89c5edf1ace9 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)