Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ben-willmore
Created August 22, 2011 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ben-willmore/1162167 to your computer and use it in GitHub Desktop.
Save ben-willmore/1162167 to your computer and use it in GitHub Desktop.
fixes to fastica node
diff --git a/mdp/nodes/ica_nodes.py b/mdp/nodes/ica_nodes.py
index 3e436e1..423aea1 100644
--- a/mdp/nodes/ica_nodes.py
+++ b/mdp/nodes/ica_nodes.py
@@ -551,7 +551,7 @@ def core(self, data):
print 'Convergence after %d steps\n' % round
break
if stabilization:
- if (stroke != 0) and (convergence_fine[round] < limit):
+ if (stroke == 0) and (convergence_fine[round] < limit):
if verbose:
print 'Stroke!\n'
stroke = mu
@@ -773,7 +773,7 @@ def core(self, data):
wOld = numx.zeros(w.shape, dtype)
wOldF = numx.zeros(w.shape, dtype)
used_g = gFine
- mu *= self.mu
+ mu = muK * self.mu
end_finetuning = max_it_fine + i
else:
nfail = 0
@@ -789,7 +789,7 @@ def core(self, data):
conv_fine = min(utils.norm2(w-wOldF),
utils.norm2(w+wOldF))
convergence_fine.append(conv_fine)
- if (stroke != 0) and conv_fine < limit:
+ if (stroke == 0) and conv_fine < limit:
if verbose:
print 'Stroke!'
stroke = mu
@@ -801,7 +801,7 @@ def core(self, data):
stroke = 0
if (mu == 1) and (used_g % 2 != 0):
used_g -= 1
- elif (not lng) and (round > max_it//2):
+ elif (not lng) and (i > max_it//2):
if verbose:
print 'Taking long (reducing step size)...'
lng = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment