comparison dataset.py @ 74:b4159cbdc06b

Fixed errors raised by test_dataset
author Yoshua Bengio <bengioy@iro.umontreal.ca>
date Sat, 03 May 2008 14:41:02 -0400
parents 69f97aad3faf
children 1e2bb5bad636
comparison
equal deleted inserted replaced
73:69f97aad3faf 74:b4159cbdc06b
227 self.n_batches_done+=1 227 self.n_batches_done+=1
228 if upper >= self.L and self.n_batches: 228 if upper >= self.L and self.n_batches:
229 self.next_row -= self.L 229 self.next_row -= self.L
230 return DataSetFields(MinibatchDataSet(minibatch,self.dataset.valuesVStack, 230 return DataSetFields(MinibatchDataSet(minibatch,self.dataset.valuesVStack,
231 self.dataset.valuesHStack), 231 self.dataset.valuesHStack),
232 minibatch.keys())) 232 minibatch.keys())
233 233
234 234
235 minibatches_fieldnames = None 235 minibatches_fieldnames = None
236 minibatches_minibatch_size = 1 236 minibatches_minibatch_size = 1
237 minibatches_n_batches = None 237 minibatches_n_batches = None
346 346
347 def fields(self,*fieldnames): 347 def fields(self,*fieldnames):
348 """ 348 """
349 Return a DataSetFields object associated with this dataset. 349 Return a DataSetFields object associated with this dataset.
350 """ 350 """
351 return DataSetFields(self,*fieldnames) 351 return DataSetFields(self,fieldnames)
352 352
353 def __getitem__(self,i): 353 def __getitem__(self,i):
354 """ 354 """
355 dataset[i] returns the (i+1)-th example of the dataset. 355 dataset[i] returns the (i+1)-th example of the dataset.
356 dataset[i:j] returns the subdataset with examples i,i+1,...,j-1. 356 dataset[i:j] returns the subdataset with examples i,i+1,...,j-1.
546 546
547 DataSetFields can be concatenated vertically or horizontally. To be consistent with 547 DataSetFields can be concatenated vertically or horizontally. To be consistent with
548 the syntax used for DataSets, the | concatenates the fields and the & concatenates 548 the syntax used for DataSets, the | concatenates the fields and the & concatenates
549 the examples. 549 the examples.
550 """ 550 """
551 def __init__(self,dataset,*fieldnames): 551 def __init__(self,dataset,fieldnames):
552 original_dataset=dataset 552 original_dataset=dataset
553 if not fieldnames: 553 if not fieldnames:
554 fieldnames=dataset.fieldNames() 554 fieldnames=dataset.fieldNames()
555 elif not fieldnames==dataset.fieldNames(): 555 elif not fieldnames==dataset.fieldNames():
556 dataset = FieldsSubsetDataSet(dataset,fieldnames) 556 dataset = FieldsSubsetDataSet(dataset,fieldnames)
1031 1031
1032 If the values_{h,v}stack functions are not provided, then 1032 If the values_{h,v}stack functions are not provided, then
1033 the input_dataset.values{H,V}Stack functions are used by default. 1033 the input_dataset.values{H,V}Stack functions are used by default.
1034 """ 1034 """
1035 def __init__(self,input_dataset,function,output_names,minibatch_mode=True, 1035 def __init__(self,input_dataset,function,output_names,minibatch_mode=True,
1036 values_hstack=None,values_vstack, 1036 values_hstack=None,values_vstack=None,
1037 description=None,fieldtypes=None): 1037 description=None,fieldtypes=None):
1038 """ 1038 """
1039 Constructor takes an input dataset that has as many fields as the function 1039 Constructor takes an input dataset that has as many fields as the function
1040 expects as inputs. The resulting dataset has as many fields as the function 1040 expects as inputs. The resulting dataset has as many fields as the function
1041 produces as outputs, and that should correspond to the number of output names 1041 produces as outputs, and that should correspond to the number of output names