Mercurial > pylearn
changeset 238:ae1d85aca858
optimization in ArrayDataSet::__iter__
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Thu, 29 May 2008 10:30:59 -0400 |
parents | 584ad7c55876 |
children | 77b362a23f8e |
files | dataset.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/dataset.py Wed May 28 14:16:32 2008 -0400 +++ b/dataset.py Thu May 29 10:30:59 2008 -0400 @@ -1054,6 +1054,8 @@ assert offset>=0 and offset<len(dataset.data) assert offset+minibatch_size<=len(dataset.data) self.current=offset + self.columns = [self.dataset.fields_columns[f] + for f in self.minibatch._names] def __iter__(self): return self def next(self): @@ -1062,7 +1064,8 @@ if self.current>=self.dataset.data.shape[0]: raise StopIteration sub_data = self.dataset.data[self.current] - self.minibatch._values = [sub_data[self.dataset.fields_columns[f]] for f in self.minibatch._names] + self.minibatch._values = [sub_data[c] for c in self.columns] + self.current+=self.minibatch_size return self.minibatch