Github user yinxusen commented on a diff in the pull request:
https://github.com/apache/spark/pull/11320#discussion_r54218738
--- Diff: docs/mllib-linear-methods.md ---
@@ -748,49 +396,16 @@ online to the first stream, and make predictions on
the second stream.
First, we import the necessary classes for parsing our input data and
creating the model.
-{% highlight scala %}
-
-import org.apache.spark.mllib.linalg.Vectors
-import org.apache.spark.mllib.regression.LabeledPoint
-import org.apache.spark.mllib.regression.StreamingLinearRegressionWithSGD
-
-{% endhighlight %}
-
Then we make input streams for training and testing data. We assume a
StreamingContext `ssc`
has already been created, see [Spark Streaming Programming
Guide](streaming-programming-guide.html#initializing)
for more info. For this example, we use labeled points in training and
testing streams,
but in practice you will likely want to use unlabeled vectors for test
data.
-{% highlight scala %}
-
-val trainingData =
ssc.textFileStream("/training/data/dir").map(LabeledPoint.parse).cache()
-val testData =
ssc.textFileStream("/testing/data/dir").map(LabeledPoint.parse)
-
-{% endhighlight %}
-
-We create our model by initializing the weights to 0
-
-{% highlight scala %}
-
-val numFeatures = 3
-val model = new StreamingLinearRegressionWithSGD()
- .setInitialWeights(Vectors.zeros(numFeatures))
-
-{% endhighlight %}
+We create our model by initializing the weights to 0.
Now we register the streams for training and testing and start the job.
Printing predictions alongside true labels lets us easily see the result.
--- End diff --
delete the line
---
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]