Skip to content

Commit f95129c

Browse files
BryanCutlermengxr
authored andcommitted
[SPARK-10959] [PYSPARK] StreamingLogisticRegressionWithSGD does not train with given regParam and convergenceTol parameters
These params were being passed into the StreamingLogisticRegressionWithSGD constructor, but not transferred to the call for model training. Same with StreamingLinearRegressionWithSGD. I added the params as named arguments to the call and also fixed the intercept parameter, which was being passed as regularization value. Author: Bryan Cutler <[email protected]> Closes apache#9002 from BryanCutler/StreamingSGD-convergenceTol-bug-10959. (cherry picked from commit 5410747) Signed-off-by: Xiangrui Meng <[email protected]>
1 parent 3df7500 commit f95129c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

python/pyspark/mllib/classification.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,8 @@ def update(rdd):
632632
if not rdd.isEmpty():
633633
self._model = LogisticRegressionWithSGD.train(
634634
rdd, self.numIterations, self.stepSize,
635-
self.miniBatchFraction, self._model.weights)
635+
self.miniBatchFraction, self._model.weights,
636+
regParam=self.regParam, convergenceTol=self.convergenceTol)
636637

637638
dstream.foreachRDD(update)
638639

python/pyspark/mllib/regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ def update(rdd):
669669
self._model = LinearRegressionWithSGD.train(
670670
rdd, self.numIterations, self.stepSize,
671671
self.miniBatchFraction, self._model.weights,
672-
self._model.intercept)
672+
intercept=self._model.intercept, convergenceTol=self.convergenceTol)
673673

674674
dstream.foreachRDD(update)
675675

0 commit comments

Comments
 (0)