comparison dataset.py @ 218:df3fae88ab46

small debugging
author Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca>
date Fri, 23 May 2008 12:22:54 -0400
parents 4b7e89b75e2b
children 517364d48ae0
comparison
equal deleted inserted replaced
217:44dd9b6448c5 218:df3fae88ab46
243 assert offset+minibatch_size<=self.L 243 assert offset+minibatch_size<=self.L
244 ds_nbatches = (self.L-self.next_row)/self.minibatch_size 244 ds_nbatches = (self.L-self.next_row)/self.minibatch_size
245 if n_batches is not None: 245 if n_batches is not None:
246 ds_nbatches = min(n_batches,ds_nbatches) 246 ds_nbatches = min(n_batches,ds_nbatches)
247 if fieldnames: 247 if fieldnames:
248 if not dataset.hasFields(*fieldnames): 248 assert dataset.hasFields(*fieldnames)
249 raise ValueError('field not present', fieldnames)
250 else: 249 else:
251 self.fieldnames=dataset.fieldNames() 250 self.fieldnames=dataset.fieldNames()
252 self.iterator = self.dataset.minibatches_nowrap(self.fieldnames,self.minibatch_size, 251 self.iterator = self.dataset.minibatches_nowrap(self.fieldnames,self.minibatch_size,
253 ds_nbatches,self.next_row) 252 ds_nbatches,self.next_row)
254 253
968 967
969 # check consistency and complete slices definitions 968 # check consistency and complete slices definitions
970 for fieldname, fieldcolumns in self.fields_columns.items(): 969 for fieldname, fieldcolumns in self.fields_columns.items():
971 if type(fieldcolumns) is int: 970 if type(fieldcolumns) is int:
972 assert fieldcolumns>=0 and fieldcolumns<data_array.shape[1] 971 assert fieldcolumns>=0 and fieldcolumns<data_array.shape[1]
973 972 self.fields_columns[fieldname]=[fieldcolumns]
974 if 0:
975 #I changed this because it didn't make sense to me,
976 # and it made it more difficult to write my learner.
977 # If it breaks stuff, let's talk about it.
978 # - James 22/05/2008
979 self.fields_columns[fieldname]=[fieldcolumns]
980 else:
981 self.fields_columns[fieldname]=fieldcolumns
982
983 elif type(fieldcolumns) is slice: 973 elif type(fieldcolumns) is slice:
984 start,step=None,None 974 start,step=None,None
985 if not fieldcolumns.start: 975 if not fieldcolumns.start:
986 start=0 976 start=0
987 if not fieldcolumns.step: 977 if not fieldcolumns.step: