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

    https://github.com/apache/spark/pull/15394#discussion_r82996998
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/optim/WeightedLeastSquaresSuite.scala 
---
    @@ -132,24 +197,234 @@ class WeightedLeastSquaresSuite extends 
SparkFunSuite with MLlibTestSparkContext
         var idx = 0
         for (fitIntercept <- Seq(false, true)) {
           for (standardization <- Seq(false, true)) {
    -        val wls = new WeightedLeastSquares(
    -          fitIntercept, regParam = 0.0, standardizeFeatures = 
standardization,
    -          standardizeLabel = standardization).fit(instancesConstLabel)
    -        val actual = Vectors.dense(wls.intercept, wls.coefficients(0), 
wls.coefficients(1))
    -        assert(actual ~== expected(idx) absTol 1e-4)
    +        for (solver <- WeightedLeastSquares.supportedSolvers) {
    +          val wls = new WeightedLeastSquares(fitIntercept, regParam = 0.0, 
elasticNetParam = 0.0,
    +            standardizeFeatures = standardization,
    +            standardizeLabel = standardization, solverType = 
solver).fit(instancesConstLabel)
    +          val actual = Vectors.dense(wls.intercept, wls.coefficients(0), 
wls.coefficients(1))
    +          assert(actual ~== expected(idx) absTol 1e-4)
    +        }
           }
           idx += 1
         }
    +
    +    // when label is constant zero, and fitIntercept is false, we should 
not train and get all zeros
    +    val instancesConstZeroLabel = instancesConstLabel.map { case 
Instance(l, w, f) =>
    --- End diff --
    
    It's better to move this as a class member variable, and add corresponding 
R code to illustrate how to reproduce the output.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to