diff sparse_random_autoassociator/model.py @ 373:42cc94cf6c12

No update if there aren't any non-zeros
author Joseph Turian <turian@gmail.com>
date Mon, 07 Jul 2008 02:15:14 -0400
parents 75bab24bb2d8
children
line wrap: on
line diff
--- a/sparse_random_autoassociator/model.py	Mon Jul 07 02:06:15 2008 -0400
+++ b/sparse_random_autoassociator/model.py	Mon Jul 07 02:15:14 2008 -0400
@@ -50,6 +50,8 @@
         are correct (i.e. are truly nonzero/zero).
         """
         (nonzero_indices, zero_indices) = _select_indices(instance)
+        # No update if there aren't any non-zeros.
+        if len(nonzero_indices) == 0: return
         xnonzero = numpy.asarray([instance[idx] for idx in nonzero_indices])
         print
         print "xnonzero:", xnonzero