Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12809#discussion_r62115163
  
    --- Diff: 
examples/src/main/scala/org/apache/spark/examples/mllib/RegressionMetricsExample.scala
 ---
    @@ -18,22 +18,22 @@
     
     package org.apache.spark.examples.mllib
     
    -import org.apache.spark.{SparkConf, SparkContext}
     // $example on$
     import org.apache.spark.mllib.evaluation.RegressionMetrics
    -import org.apache.spark.mllib.regression.LinearRegressionWithSGD
    -import org.apache.spark.mllib.util.MLUtils
    +import org.apache.spark.mllib.linalg.Vector
    +import org.apache.spark.mllib.regression.{LabeledPoint, 
LinearRegressionWithSGD}
     // $example off$
    -import org.apache.spark.sql.SQLContext
    +import org.apache.spark.sql.SparkSession
     
     object RegressionMetricsExample {
       def main(args: Array[String]): Unit = {
    -    val conf = new SparkConf().setAppName("RegressionMetricsExample")
    -    val sc = new SparkContext(conf)
    -    val sqlContext = new SQLContext(sc)
    +    val spark = 
SparkSession.builder.appName("RegressionMetricsExample").getOrCreate()
         // $example on$
         // Load the data
    -    val data = MLUtils.loadLibSVMFile(sc, 
"data/mllib/sample_linear_regression_data.txt").cache()
    +    val data = spark
    +      
.read.format("libsvm").load("data/mllib/sample_linear_regression_data.txt")
    +      .rdd.map(row => LabeledPoint(row.getDouble(0), 
row.get(1).asInstanceOf[Vector]))
    +      .cache()
    --- End diff --
    
    is this part the same? From a quick glance it seems to be so


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to