comparison dataset.py @ 199:1400fa04dfab

bugfix
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Tue, 13 May 2008 16:42:51 -0400
parents 136f78559138
children ac61f1178f88
comparison
equal deleted inserted replaced
198:136f78559138 199:1400fa04dfab
1177 self.input_iterator=output_dataset.input_dataset.__iter__() 1177 self.input_iterator=output_dataset.input_dataset.__iter__()
1178 def __iter__(self): return self 1178 def __iter__(self): return self
1179 def next(self): 1179 def next(self):
1180 function_inputs = self.input_iterator.next() 1180 function_inputs = self.input_iterator.next()
1181 if self.output_dataset.minibatch_mode: 1181 if self.output_dataset.minibatch_mode:
1182 outputs = self.output_dataset.function(*function_inputs)
1183 assert all([hasattr(output,'__iter__') for output in outputs])
1184 function_outputs = [output[0] for output in outputs]
1185 else:
1182 function_outputs = self.output_dataset.function(*function_inputs) 1186 function_outputs = self.output_dataset.function(*function_inputs)
1183 else:
1184 function_outputs = self.output_dataset.function(function_inputs)
1185 return Example(self.output_dataset.output_names,function_outputs) 1187 return Example(self.output_dataset.output_names,function_outputs)
1186 return ApplyFunctionSingleExampleIterator(self) 1188 return ApplyFunctionSingleExampleIterator(self)
1187 1189
1188 1190
1189 def supervised_learning_dataset(src_dataset,input_fields,target_fields,weight_field=None): 1191 def supervised_learning_dataset(src_dataset,input_fields,target_fields,weight_field=None):