Mercurial > pylearn
comparison dataset.py @ 65:d48eba49a2f4
fixed the infinite loop
author | Yoshua Bengio <bengioy@iro.umontreal.ca> |
---|---|
date | Fri, 02 May 2008 11:10:20 -0400 |
parents | 863da25a60f1 |
children | dde1fb1b63ba |
comparison
equal
deleted
inserted
replaced
64:863da25a60f1 | 65:d48eba49a2f4 |
---|---|
544 DataSetFields can be concatenated vertically or horizontally. To be consistent with | 544 DataSetFields can be concatenated vertically or horizontally. To be consistent with |
545 the syntax used for DataSets, the | concatenates the fields and the & concatenates | 545 the syntax used for DataSets, the | concatenates the fields and the & concatenates |
546 the examples. | 546 the examples. |
547 """ | 547 """ |
548 def __init__(self,dataset,*fieldnames): | 548 def __init__(self,dataset,*fieldnames): |
549 original_dataset=dataset | |
549 if not fieldnames: | 550 if not fieldnames: |
550 fieldnames=dataset.fieldNames() | 551 fieldnames=dataset.fieldNames() |
551 elif fieldnames is not dataset.fieldNames(): | 552 elif not fieldnames==dataset.fieldNames(): |
552 dataset = FieldsSubsetDataSet(dataset,fieldnames) | 553 dataset = FieldsSubsetDataSet(dataset,fieldnames) |
553 assert dataset.hasFields(*fieldnames) | 554 assert dataset.hasFields(*fieldnames) |
554 self.dataset=dataset | 555 self.dataset=dataset |
556 print type(dataset) | |
555 if isinstance(dataset,MinibatchDataSet): | 557 if isinstance(dataset,MinibatchDataSet): |
556 LookupList.__init__(self,fieldnames,list(dataset._fields)) | 558 LookupList.__init__(self,fieldnames,list(dataset._fields)) |
559 elif isinstance(original_dataset,MinibatchDataSet): | |
560 LookupList.__init__(self,fieldnames, | |
561 [original_dataset._fields[field] | |
562 for field in fieldnames]) | |
557 else: | 563 else: |
558 minibatch_iterator = dataset.minibatches(fieldnames, | 564 minibatch_iterator = dataset.minibatches(fieldnames, |
559 minibatch_size=len(dataset), | 565 minibatch_size=len(dataset), |
560 n_batches=1) | 566 n_batches=1) |
561 minibatch=minibatch_iterator.next() | 567 minibatch=minibatch_iterator.next() |