diff dataset.py @ 242:ef70a665aaaf

Hmm... that was committed by Fred I think, I got lost by Mercurial I think
author delallea@opale.iro.umontreal.ca
date Fri, 30 May 2008 10:19:16 -0400
parents ddb88a8e9fd2 ae1d85aca858
children c8f19a9eb10f
line wrap: on
line diff
--- a/dataset.py	Fri May 30 10:14:46 2008 -0400
+++ b/dataset.py	Fri May 30 10:19:16 2008 -0400
@@ -987,7 +987,7 @@
         for fieldname, fieldcolumns in self.fields_columns.items():
             if type(fieldcolumns) is int:
                 assert fieldcolumns>=0 and fieldcolumns<data_array.shape[1]
-                if 0:
+                if 1:
                     #I changed this because it didn't make sense to me,
                     # and it made it more difficult to write my learner.
                     # If it breaks stuff, let's talk about it.
@@ -1054,6 +1054,8 @@
                 assert offset>=0 and offset<len(dataset.data)
                 assert offset+minibatch_size<=len(dataset.data)
                 self.current=offset
+                self.columns = [self.dataset.fields_columns[f] 
+                                for f in self.minibatch._names]
             def __iter__(self):
                 return self
             def next(self):
@@ -1062,7 +1064,8 @@
                 if self.current>=self.dataset.data.shape[0]:
                     raise StopIteration
                 sub_data =  self.dataset.data[self.current]
-                self.minibatch._values = [sub_data[self.dataset.fields_columns[f]] for f in self.minibatch._names]
+                self.minibatch._values = [sub_data[c] for c in self.columns]
+
                 self.current+=self.minibatch_size
                 return self.minibatch