zhengruifeng commented on a change in pull request #31693:
URL: https://github.com/apache/spark/pull/31693#discussion_r587057900
##########
File path:
mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
##########
@@ -971,6 +975,10 @@ class LogisticRegression @Since("1.2.0") (
}
if (fitWithMean) {
+ // orginal initialCoefWithInterceptArray is for problem:
Review comment:
the `initialCoefWithInterceptArray` is intialized in two ways:
1, all zero weights with intercept = `b = \log{P(1) / P(0)} = \log{count_1 /
count_0}`, then this adjustment does nothing;
2, a user-provided model `val providedCoef =
optInitialModel.get.coefficientMatrix`, in this case, we should adjust the
initial intercept: suppose user set maxIter=1 or even 0, the final intercept
well be adjusted to a wrong value. Disable this intialization adjust will make
test case 'set initial model' fail:

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]