Mercurial > pylearn
changeset 354:d580b3a369a4
dataset__call__() returns a FieldsSubsetDataSet, so still a subset of fields, but not cached any more. I added the function dataset.cached_fields_subset(self,*fieldnames) that returns the old version, cached, in case someone needs it. Current behaviour passes the tests.
author | Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca> |
---|---|
date | Thu, 19 Jun 2008 12:35:41 -0400 |
parents | 47538a45b878 |
children | 430c9e92cd23 |
files | dataset.py |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/dataset.py Tue Jun 17 17:12:43 2008 -0400 +++ b/dataset.py Thu Jun 19 12:35:41 2008 -0400 @@ -436,6 +436,16 @@ Return a dataset that sees only the fields whose name are specified. """ assert self.hasFields(*fieldnames) + #return self.fields(*fieldnames).examples() + fieldnames_list = list(fieldnames) + return FieldsSubsetDataSet(self,fieldnames_list) + + def cached_fields_subset(self,*fieldnames) : + """ + Behaviour is supposed to be the same as __call__(*fieldnames), but the dataset returned is cached. + @see : dataset.__call__ + """ + assert self.hasFields(*fieldnames) return self.fields(*fieldnames).examples() def fields(self,*fieldnames):