Github user MLnick commented on a diff in the pull request:
https://github.com/apache/spark/pull/18281#discussion_r125444096
--- Diff: python/pyspark/ml/tests.py ---
@@ -1229,11 +1229,22 @@ def test_output_columns(self):
(2.0, Vectors.dense(0.5, 0.5))],
["label", "features"])
lr = LogisticRegression(maxIter=5, regParam=0.01)
- ovr = OneVsRest(classifier=lr)
+ ovr = OneVsRest(classifier=lr, parallelism=1)
model = ovr.fit(df)
output = model.transform(df)
self.assertEqual(output.columns, ["label", "features",
"prediction"])
+ def test_parallelism_doesnt_change_output(self):
+ df = self.spark.createDataFrame([(0.0, Vectors.dense(1.0, 0.8)),
+ (1.0, Vectors.sparse(2, [], [])),
+ (2.0, Vectors.dense(0.5, 0.5))],
+ ["label", "features"])
+ ovrPar1 = OneVsRest(classifier=LogisticRegression(maxIter=5,
regParam=.01), parallelism=1)
+ modelPar1 = ovrPar1.fit(df)
+ ovrPar2 = OneVsRest(classifier=LogisticRegression(maxIter=5,
regParam=.01), parallelism=2)
+ modelPar2 = ovrPar2.fit(df)
+ self.assertEqual(modelPar1.getPredictionCol(),
modelPar2.getPredictionCol())
--- End diff --
As per the Scala tests - fitting in parallel should result in exactly the
same model coefficients also (though they might be in a different order). Can
we check this?
---
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]