Skip to content

Commit

Permalink
code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sethah committed Jun 28, 2017
1 parent fcf5372 commit a19b385
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private[ml] trait DifferentiableRegularization[T] extends DiffFunction[T] {
}

/**
* A Breeze diff function for computing the L2 regularized loss and gradient of an array of
* A Breeze diff function for computing the L2 regularized loss and gradient of a vector of
* coefficients.
*
* @param regParam The magnitude of the regularization.
Expand Down Expand Up @@ -72,7 +72,7 @@ private[ml] class L2Regularization(
}
(0.5 * sum * regParam, Vectors.dense(gradient))
case _: SparseVector =>
throw new IllegalArgumentException("SparseVector is not currently supported.")
throw new IllegalArgumentException("Sparse coefficients are not currently supported.")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class LinearRegression @Since("1.3.0") (@Since("1.3.0") override val uid: String

val getAggregatorFunc = new LeastSquaresAggregator(yStd, yMean, $(fitIntercept),
bcFeaturesStd, bcFeaturesMean)(_)
val getFeaturesStd = (j: Int) => if (j >=0 && j < numFeatures) featuresStd(j) else 0.0
val getFeaturesStd = (j: Int) => if (j >= 0 && j < numFeatures) featuresStd(j) else 0.0
val regularization = if (effectiveL2RegParam != 0.0) {
val shouldApply = (idx: Int) => idx >= 0 && idx < numFeatures
Some(new L2Regularization(effectiveL2RegParam, shouldApply,
Expand Down

0 comments on commit a19b385

Please sign in to comment.