diff dataset.py @ 331:52aa031e1fe3

IMPORTANT: minibatches now returns minibatch_nowrap with a minimum of assert before. Should implement the good behavior, e.g. returning only complete batches and let the user figure out what he wants.
author Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca>
date Mon, 16 Jun 2008 16:38:03 -0400
parents 20e08c52c98c
children dada08a6adb8
line wrap: on
line diff
--- a/dataset.py	Mon Jun 16 16:11:36 2008 -0400
+++ b/dataset.py	Mon Jun 16 16:38:03 2008 -0400
@@ -368,6 +368,7 @@
         On every iteration, the variables i1, i2, i3 will have
         exactly minibatch_size elements. e.g. len(i1) == minibatch_size
 
+        @DEPRECATED n_batches : not used anywhere
         - n_batches (integer, default None)
         The iterator will loop exactly this many times, and then stop.  If None,
         the derived class can choose a default.  If (-1), then the returned
@@ -379,8 +380,15 @@
         Note: A list-like container is something like a tuple, list, numpy.ndarray or
         any other object that supports integer indexing and slicing.
 
+        @ATTENTION: now minibatches returns minibatches_nowrap, which is supposed to return complete
+        batches only, raise StopIteration
+
         """
-        return DataSet.MinibatchWrapAroundIterator(self,fieldnames,minibatch_size,n_batches,offset)
+        #return DataSet.MinibatchWrapAroundIterator(self,fieldnames,minibatch_size,n_batches,offset)\
+        assert offset >= 0
+        assert offset < len(self)
+        assert offset + minibatch_size < len(self)
+        return minibatch_nowrap(fieldnames,minibatch_size,n_batches,offset)
 
     def minibatches_nowrap(self,fieldnames,minibatch_size,n_batches,offset):
         """