Skip to content

Commit 568d250

Browse files
committed
Tweaks to wording / formatting
1 parent 05a1139 commit 568d250

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/mllib-linear-methods.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ print("Mean Squared Error = " + str(MSE))
521521
## Streaming linear regression
522522

523523
When data arrive in a streaming fashion, it is useful to fit regression models online,
524-
updating the parameters of the model as new data arrive. MLlib currently supports
524+
updating the parameters of the model as new data arrives. MLlib currently supports
525525
streaming linear regression using ordinary least squares. The fitting is similar
526526
to that performed offline, except fitting occurs on each batch of data, so that
527527
the model continually updates to reflect the data from the stream.
@@ -546,10 +546,10 @@ import org.apache.spark.mllib.regression.StreamingLinearRegressionWithSGD
546546

547547
{% endhighlight %}
548548

549-
Then we make input streams for training and testing data. We assume a Streaming Context `ssc`
549+
Then we make input streams for training and testing data. We assume a StreamingContext `ssc`
550550
has already been created, see [Spark Streaming Programming Guide](streaming-programming-guide.html#initializing)
551551
for more info. For this example, we use labeled points in training and testing streams,
552-
but in practice you will likely want to use unlabeled Vectors for test data.
552+
but in practice you will likely want to use unlabeled vectors for test data.
553553

554554
{% highlight scala %}
555555

@@ -562,8 +562,9 @@ We create our model by initializing the weights to 0
562562

563563
{% highlight scala %}
564564

565+
val numFeatures = 3
565566
val model = new StreamingLinearRegressionWithSGD()
566-
.setInitialWeights(Vectors.zeros(3))
567+
.setInitialWeights(Vectors.zeros(numFeatures))
567568

568569
{% endhighlight %}
569570

0 commit comments

Comments
 (0)