Site index · List index
Message view
Top
From tillrohrmann <...@git.apache.org>
Date Thu, 07 May 2015 09:31:16 GMT
Github user tillrohrmann commented on a diff in the pull request:

---
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+import breeze.numerics._
+import breeze.linalg.{norm => BreezeNorm, max => BreezeMax}
+
+
+
+// TODO(tvas): Change name to RegularizationPenalty?
+/** Represents a type of regularization penalty
+  *
+  * Regularization penalties are used to restrict the optimization problem to solutions
with
+  * certain desirable characteristics, such as sparsity for the L1 penalty, or penalizing
large
+  * weights for the L2 penalty.
+  *
+  * The regularization term, $R(w)$ is added to the objective function, $f(w) = L(w) + \lambda R(w)$
+  * where $\lambda$ is the regularization parameter used to tune the amount of regularization
+  * applied.
+  */
+abstract class RegularizationType extends Serializable {
+
+  /** Updates the weights by taking a step according to the gradient and regularization
applied
+    *
+    * @param oldWeights The weights to be updated
+    * @param gradient The gradient according to which we will update the weights
+    * @param effectiveStepSize The effective step size for this iteration
+    * @param regParameter The regularization parameter to be applied in the case of L1
+    *                     regularization
+    */
+  def takeStep(
+      effectiveStepSize: Double,
+      regParameter: Double) {
+  }
+
+  /** Adds regularization to the loss value **/
--- End diff --

Maybe add docs for the parameters and the return value

---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message