Github user holdenk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18281#discussion_r128630894
  
    --- Diff: python/pyspark/ml/tests.py ---
    @@ -1389,11 +1389,25 @@ 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())
    +        for i, model in enumerate(modelPar1.models):
    +            assert(np.allclose(model.coefficients.toArray(),
    +                               modelPar2.models[i].coefficients.toArray(), 
atol=1E-4))
    +
    --- End diff --
    
    Similar comment, can we add a test to make sure that we are actually 
training in parallel? This is perhaps especially important in Python because I 
could see us accidentally blocking on something unexpected.


---
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]

Reply via email to