From 07f0fa86448dac8d745f5b0ab8cf79e38e10e4ea Mon Sep 17 00:00:00 2001
From: Pawel Swietojanski
Date: Tue, 3 Nov 2015 14:08:23 +0000
Subject: [PATCH] fix to L1 prior cost computation
---
mlp/optimisers.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mlp/optimisers.py b/mlp/optimisers.py
index 77b4db6..1959717 100644
--- a/mlp/optimisers.py
+++ b/mlp/optimisers.py
@@ -76,7 +76,7 @@ class Optimiser(object):
if l2_weight > 0:
l2_cost += 0.5 * l2_weight * numpy.sum(param**2)
if l1_weight > 0:
- l1_cost += l1_weight * numpy.sum(numpy.sign(param))
+ l1_cost += l1_weight * numpy.sum(numpy.abs(param))
return l1_cost, l2_cost