comparison dataset.py @ 163:d7d67651d67c

bugfix, we should advence by the minibatch size.
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Mon, 12 May 2008 17:40:06 -0400
parents 28a988bd19c3
children ee11ed427ba8
comparison
equal deleted inserted replaced
162:45427d4d64b3 163:d7d67651d67c
1077 # cache everything from current length to upper 1077 # cache everything from current length to upper
1078 for example in self.dataset.source_dataset[cache_len:upper]: 1078 for example in self.dataset.source_dataset[cache_len:upper]:
1079 self.dataset.cached_examples.append(example) 1079 self.dataset.cached_examples.append(example)
1080 all_fields_minibatch = Example(self.dataset.fieldNames(), 1080 all_fields_minibatch = Example(self.dataset.fieldNames(),
1081 zip(*self.dataset.cached_examples[self.current:self.current+minibatch_size])) 1081 zip(*self.dataset.cached_examples[self.current:self.current+minibatch_size]))
1082 self.current+=1 1082 self.current+=minibatch_size
1083 if self.dataset.fieldNames()==fieldnames: 1083 if self.dataset.fieldNames()==fieldnames:
1084 return all_fields_minibatch 1084 return all_fields_minibatch
1085 return Example(fieldnames,[all_fields_minibatch[name] for name in fieldnames]) 1085 return Example(fieldnames,[all_fields_minibatch[name] for name in fieldnames])
1086 return CacheIterator(self) 1086 return CacheIterator(self)
1087 1087