# HG changeset patch # User Thierry Bertin-Mahieux # Date 1213648683 14400 # Node ID 52aa031e1fe3577a2aad0b32e8af3dd19215feb5 # Parent 20e08c52c98c8102c8a4931f8eeb9e4bf713c790 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. diff -r 20e08c52c98c -r 52aa031e1fe3 dataset.py --- 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): """