Mercurial > pylearn
comparison dataset.py @ 351:7545207466d4
debugged RenamedFieldsDataSet
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Tue, 17 Jun 2008 16:47:33 -0400 |
parents | a22ea54a19ed |
children | 47538a45b878 |
comparison
equal
deleted
inserted
replaced
350:ae6605eccd09 | 351:7545207466d4 |
---|---|
690 self.new_fieldnames=new_fieldnames | 690 self.new_fieldnames=new_fieldnames |
691 assert src.hasFields(*src_fieldnames) | 691 assert src.hasFields(*src_fieldnames) |
692 assert len(src_fieldnames)==len(new_fieldnames) | 692 assert len(src_fieldnames)==len(new_fieldnames) |
693 self.valuesHStack = src.valuesHStack | 693 self.valuesHStack = src.valuesHStack |
694 self.valuesVStack = src.valuesVStack | 694 self.valuesVStack = src.valuesVStack |
695 self.lookup_fields = Example(new_fieldnames,src_fieldnames) | |
695 | 696 |
696 def __len__(self): return len(self.src) | 697 def __len__(self): return len(self.src) |
697 | 698 |
698 def fieldNames(self): | 699 def fieldNames(self): |
699 return self.new_fieldnames | 700 return self.new_fieldnames |
717 return self.example | 718 return self.example |
718 return FieldsSubsetIterator(self) | 719 return FieldsSubsetIterator(self) |
719 | 720 |
720 def minibatches_nowrap(self,fieldnames,minibatch_size,n_batches,offset): | 721 def minibatches_nowrap(self,fieldnames,minibatch_size,n_batches,offset): |
721 assert self.hasFields(*fieldnames) | 722 assert self.hasFields(*fieldnames) |
722 return self.src.minibatches_nowrap(fieldnames,minibatch_size,n_batches,offset) | 723 cursor = Example(fieldnames,[0]*len(fieldnames)) |
724 for batch in self.src.minibatches_nowrap([self.lookup_fields[f] for f in fieldnames],minibatch_size,n_batches,offset): | |
725 cursor._values=batch._values | |
726 yield cursor | |
727 | |
723 def __getitem__(self,i): | 728 def __getitem__(self,i): |
724 # return FieldsSubsetDataSet(self.src[i],self.new_fieldnames) | 729 # return FieldsSubsetDataSet(self.src[i],self.new_fieldnames) |
725 complete_example = self.src[i] | 730 complete_example = self.src[i] |
726 return Example(self.new_fieldnames, | 731 return Example(self.new_fieldnames, |
727 [complete_example[field] | 732 [complete_example[field] |