changeset 1405:f9e4d71aa353

Add L1 and L2² costs to sigmoidal layer
author Pascal Lamblin <lamblinp@iro.umontreal.ca>
date Wed, 26 Jan 2011 16:55:44 -0500
parents 89017617ab36
children f467c5457eff
files pylearn/shared/layers/sigmoidal_layer.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/shared/layers/sigmoidal_layer.py	Mon Jan 24 13:18:43 2011 -0500
+++ b/pylearn/shared/layers/sigmoidal_layer.py	Wed Jan 26 16:55:44 2011 -0500
@@ -20,6 +20,8 @@
         :param squash: an squashing function
         """
         output = squash_fn(tensor.dot(input, w) + b)
+        l1 = abs(w).sum()
+        l2_sqr = (w**2).sum()
         update_locals(self, locals())
 
     @classmethod