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

    https://github.com/apache/spark/pull/12500#discussion_r60968226
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/util/MLTestingUtils.scala ---
    @@ -47,14 +48,32 @@ object MLTestingUtils extends SparkFunSuite {
         val actuals = dfs.keys.filter(_ != DoubleType).map(t => 
estimator.fit(dfs(t)))
         actuals.foreach(actual => check(expected, actual))
     
    -    val dfWithStringLabels = generateDFWithStringLabelCol(sqlContext)
    +    val dfWithStringLabels = sqlContext.createDataFrame(Seq(
    +      ("0", Vectors.dense(0, 2, 3), 0.0)
    +    )).toDF("label", "features", "censor")
         val thrown = intercept[IllegalArgumentException] {
           estimator.fit(dfWithStringLabels)
         }
         assert(thrown.getMessage contains
           "Column label must be of type NumericType but was actually of type 
StringType")
       }
     
    +  def checkNumericTypes[T <: Evaluator](evaluator: T, sqlContext: 
SQLContext): Unit = {
    +    val dfs = genEvaluatorDFWithNumericLabelCol(sqlContext, "label", 
"prediction")
    +    val expected = evaluator.evaluate(dfs(DoubleType))
    +    val actuals = dfs.keys.filter(_ != DoubleType).map(t => 
evaluator.evaluate(dfs(t)))
    +    actuals.foreach(actual => assert(expected === actual))
    +
    +    val dfWithStringLabels = sqlContext.createDataFrame(Seq(
    +      ("0", 0d)
    +    )).toDF("label", "prediction")
    +    val thrown = intercept[IllegalArgumentException] {
    +      evaluator.evaluate(dfWithStringLabels)
    +    }
    +    assert(thrown.getMessage contains
    --- End diff --
    
    Minor style issue, but Spark code style prefers not to use infix notation 
(see https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide). 
Could you do `thrown.getMessage.contains(...)` instead? And also change the 
occurrence above in L57.


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