diff dataset.py @ 339:aa8aff6abbf7

n_minibatches in ArrayDataSet automatically computed
author Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca>
date Mon, 16 Jun 2008 17:26:51 -0400
parents 5e38ed2b3a75
children d96be0eba3cc
line wrap: on
line diff
--- a/dataset.py	Mon Jun 16 17:17:01 2008 -0400
+++ b/dataset.py	Mon Jun 16 17:26:51 2008 -0400
@@ -1274,6 +1274,8 @@
     def minibatches_nowrap(self,fieldnames,minibatch_size,n_batches,offset):
         cursor = Example(fieldnames,[0]*len(fieldnames))
         fieldnames = self.fieldNames() if fieldnames is None else fieldnames
+        if n_batches == None:
+            n_batches = (len(self) - offset) / minibatch_size
         for n in xrange(n_batches):
             if offset == len(self):
                 break