Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/15314#discussion_r82082166
--- Diff:
mllib/src/test/scala/org/apache/spark/ml/util/MLTestingUtils.scala ---
@@ -47,18 +48,49 @@ object MLTestingUtils extends SparkFunSuite {
} else {
genRegressionDFWithNumericLabelCol(spark)
}
- val expected = estimator.fit(dfs(DoubleType))
- val actuals = dfs.keys.filter(_ != DoubleType).map(t =>
estimator.fit(dfs(t)))
+
+ val expected = estimator match {
+ case weighted: Estimator[M] with HasWeightCol =>
+ weighted.set(weighted.weightCol, "weight")
+ weighted.fit(dfs(DoubleType).withColumn("weight", rand(seed = 42)))
+ case _: Estimator[M] => estimator.fit(dfs(DoubleType))
+ case _ => throw new Exception()
+ }
+
+ val actuals = dfs.keys.filter(_ != DoubleType).map { t =>
+ estimator match {
+ case weighted: Estimator[M] with HasWeightCol =>
+ weighted.set(weighted.weightCol, "weight")
+ weighted.fit(dfs(t).withColumn("weight", rand(seed = 42)))
--- End diff --
So, you've added a weight column to the `genRegressionDF` and
`genClassificationDF` methods, but then you're overwriting them here. Since we
add them in the df generators, we don't need the `withColumn` here.
---
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]