Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/15683#discussion_r87639131
--- Diff:
mllib/src/test/scala/org/apache/spark/ml/regression/GeneralizedLinearRegressionSuite.scala
---
@@ -88,6 +89,12 @@ class GeneralizedLinearRegressionSuite
xVariance = Array(0.7, 1.2), nPoints = 10000, seed, noiseLevel =
0.01,
family = "poisson", link = "log").toDF()
+ datasetPoissonLogWithZero = generateGeneralizedLinearRegressionInput(
+ intercept = -1.5, coefficients = Array(0.22, 0.06), xMean =
Array(2.9, 10.5),
+ xVariance = Array(0.7, 1.2), nPoints = 100, seed, noiseLevel = 0.01,
+ family = "poisson", link = "log")
+ .map{x => LabeledPoint(if (x.label < 0.7) 0.0 else x.label,
x.features)}.toDF()
--- End diff --
Sorry for not catching this before, but I still don't like this solution.
It's based on the assumption that the random sampler will produce samples <
0.7. If someone changes the intercept, the coefficients, the seed, the number
of samples (more probable), will this dataset still contain zero values? So I
was going to suggest just creating a dataset manually like:
````scala
datasetPoissonLogWithZero = Seq(
LabeledPoint(0.9458219159417919,
Vectors.dense(3.5595422042211196,11.195284189877581)),
LabeledPoint(0.01,
Vectors.dense(2.345616312601851,9.654072347028526)),
LabeledPoint(0.9859906010596757,
Vectors.dense(3.379806446078384,12.030690121565227)),
LabeledPoint(0.702999993550245,
Vectors.dense(2.5196967525411735,9.649023755695037)),
LabeledPoint(0.8263283868037207,
Vectors.dense(2.7946580547347253,11.573536770107552))
).toDF()
````
But then I ran the tests with this dataset and I'm getting a test failure
because the weights in the IRLS solver are blowing up to infinity. I'll try to
take a closer look here soon.
---
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]