Github user imatiach-msft commented on a diff in the pull request:
https://github.com/apache/spark/pull/16699#discussion_r98490824
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/regression/GeneralizedLinearRegression.scala
---
@@ -336,14 +361,19 @@ class GeneralizedLinearRegression @Since("2.0.0")
(@Since("2.0.0") override val
}
val w = if (!isDefined(weightCol) || $(weightCol).isEmpty) lit(1.0)
else col($(weightCol))
- val instances: RDD[Instance] =
- dataset.select(col($(labelCol)), w, col($(featuresCol))).rdd.map {
- case Row(label: Double, weight: Double, features: Vector) =>
- Instance(label, weight, features)
- }
+ val off = if (!isDefined(offsetCol) || $(offsetCol).isEmpty) {
--- End diff --
maybe rename off to offset? also it looks like the spacing below needs to
be fixed (extra indentation).
+ val off = if (!isDefined(offsetCol) || $(offsetCol).isEmpty) {
+ lit(0.0)
+ } else {
+ col($(offsetCol)).cast(DoubleType)
+ }
---
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]