changeset 351:7545207466d4

debugged RenamedFieldsDataSet
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Tue, 17 Jun 2008 16:47:33 -0400
parents ae6605eccd09
children cefa8518ff48
files dataset.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dataset.py	Tue Jun 17 16:20:17 2008 -0400
+++ b/dataset.py	Tue Jun 17 16:47:33 2008 -0400
@@ -692,6 +692,7 @@
         assert len(src_fieldnames)==len(new_fieldnames)
         self.valuesHStack = src.valuesHStack
         self.valuesVStack = src.valuesVStack
+        self.lookup_fields = Example(new_fieldnames,src_fieldnames)
 
     def __len__(self): return len(self.src)
     
@@ -719,7 +720,11 @@
 
     def minibatches_nowrap(self,fieldnames,minibatch_size,n_batches,offset):
         assert self.hasFields(*fieldnames)
-        return self.src.minibatches_nowrap(fieldnames,minibatch_size,n_batches,offset)
+        cursor = Example(fieldnames,[0]*len(fieldnames))
+        for batch in self.src.minibatches_nowrap([self.lookup_fields[f] for f in fieldnames],minibatch_size,n_batches,offset):
+            cursor._values=batch._values
+            yield cursor
+    
     def __getitem__(self,i):
 #        return FieldsSubsetDataSet(self.src[i],self.new_fieldnames)
         complete_example = self.src[i]