Skip to content

Commit

Permalink
faster construction of features with intercept
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxr committed Mar 17, 2014
1 parent dc96546 commit a1439c2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ abstract class GeneralizedLinearAlgorithm[M <: GeneralizedLinearModel]

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

val initialWeightsWithIntercept = if (addIntercept) {
Array(1.0, initialWeights:_*)
initialWeights.+:(1.0)
} else {
initialWeights
}
Expand Down

0 comments on commit a1439c2

Please sign in to comment.