Hi,

I write this code for just train the Stream Linear Regression, but I took no
data found warn, so no weights were not updated.

Is there any solution for this ? 

Thanks

import org.apache.spark.mllib.linalg.Vectors
import org.apache.spark.mllib.regression.{LabeledPoint,
StreamingLinearRegressionWithSGD}
import org.apache.spark.SparkConf
import org.apache.spark.streaming.{Seconds, StreamingContext}


object StreamingLinearRegression {

  def main(args: Array[String]) {

    val numFeatures=3

    val conf = new
SparkConf().setMaster("local[2]").setAppName("StreamingLinearRegression")
    val ssc = new StreamingContext(conf, Seconds(30))

    val trainingData =
ssc.textFileStream("/home/barisakgu/Desktop/Spark/train").map(LabeledPoint.parse).cache()
    val testData =
ssc.textFileStream("/home/barisakgu/Desktop/Spark/test").map(LabeledPoint.parse)

    val model = new
StreamingLinearRegressionWithSGD().setInitialWeights(Vectors.zeros(numFeatures))

    model.trainOn(trainingData)
    model.predictOnValues(testData.map(lp => (lp.label,
lp.features))).print()

    ssc.start()
    ssc.awaitTermination()

  }

}



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/Streaming-Linear-Regression-problem-tp22539.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org

Reply via email to