Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/1985#discussion_r63509514
--- Diff:
flink-libraries/flink-ml/src/main/scala/org/apache/flink/ml/optimization/GradientDescent.scala
---
@@ -321,19 +318,8 @@ class GradientDescentL1 extends GradientDescent {
regularizationConstant: Double,
learningRate: Double)
: Vector = {
- // Update weight vector with gradient. L1 regularization has no
gradient, the proximal operator
- // does the job.
- BLAS.axpy(-learningRate, gradient, weightVector)
-
- // Apply proximal operator (soft thresholding)
- val shrinkageVal = regularizationConstant * learningRate
- var i = 0
- while (i < weightVector.size) {
- val wi = weightVector(i)
- weightVector(i) = scala.math.signum(wi) *
- scala.math.max(0.0, scala.math.abs(wi) - shrinkageVal)
- i += 1
- }
+
+ L1Regularization.takeStep(weightVector, gradient,
regularizationConstant,learningRate)
--- End diff --
whitespace missing
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---