Skip to content

Commit b5cfc53

Browse files
committed
set default weights to zeros
1 parent a1439c2 commit b5cfc53

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ abstract class GeneralizedLinearAlgorithm[M <: GeneralizedLinearModel]
119119
*/
120120
def run(input: RDD[LabeledPoint]) : M = {
121121
val nfeatures: Int = input.first().features.length
122-
val initialWeights = Array.fill(nfeatures)(1.0)
122+
val initialWeights = new Array[Double](nfeatures)
123123
run(input, initialWeights)
124124
}
125125

@@ -134,7 +134,7 @@ abstract class GeneralizedLinearAlgorithm[M <: GeneralizedLinearModel]
134134
throw new SparkException("Input validation failed.")
135135
}
136136

137-
// Add a extra variable consisting of all 1.0's for the intercept.
137+
// Prepend an extra variable consisting of all 1.0's for the intercept.
138138
val data = if (addIntercept) {
139139
input.map(labeledPoint => (labeledPoint.label, labeledPoint.features.+:(1.0)))
140140
} else {

0 commit comments

Comments
 (0)