Skip to content

Commit

Permalink
set default weights to zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxr committed Mar 17, 2014
1 parent a1439c2 commit b5cfc53
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ abstract class GeneralizedLinearAlgorithm[M <: GeneralizedLinearModel]
*/
def run(input: RDD[LabeledPoint]) : M = {
val nfeatures: Int = input.first().features.length
val initialWeights = Array.fill(nfeatures)(1.0)
val initialWeights = new Array[Double](nfeatures)
run(input, initialWeights)
}

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

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

0 comments on commit b5cfc53

Please sign in to comment.