Skip to content

Commit 5ed48dd

Browse files
yanboliangmengxr
authored andcommitted
[SPARK-12811][ML] Estimator for Generalized Linear Models(GLMs)
Estimator for Generalized Linear Models(GLMs) which will be solved by IRLS. cc mengxr Author: Yanbo Liang <[email protected]> Closes #11136 from yanboliang/spark-12811.
1 parent c43899a commit 5ed48dd

File tree

4 files changed

+1094
-4
lines changed

4 files changed

+1094
-4
lines changed

mllib/src/main/scala/org/apache/spark/ml/optim/WeightedLeastSquares.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ private[ml] class WeightedLeastSquares(
156156

157157
private[ml] object WeightedLeastSquares {
158158

159+
/**
160+
* In order to take the normal equation approach efficiently, [[WeightedLeastSquares]]
161+
* only supports the number of features is no more than 4096.
162+
*/
163+
val MAX_NUM_FEATURES: Int = 4096
164+
159165
/**
160166
* Aggregator to provide necessary summary statistics for solving [[WeightedLeastSquares]].
161167
*/
@@ -174,8 +180,8 @@ private[ml] object WeightedLeastSquares {
174180
private var aaSum: DenseVector = _
175181

176182
private def init(k: Int): Unit = {
177-
require(k <= 4096, "In order to take the normal equation approach efficiently, " +
178-
s"we set the max number of features to 4096 but got $k.")
183+
require(k <= MAX_NUM_FEATURES, "In order to take the normal equation approach efficiently, " +
184+
s"we set the max number of features to $MAX_NUM_FEATURES but got $k.")
179185
this.k = k
180186
triK = k * (k + 1) / 2
181187
count = 0L

0 commit comments

Comments
 (0)