Mercurial > pylearn
comparison dataset.py @ 430:c096e2820131
merge
author | Yoshua Bengio <bengioy@iro.umontreal.ca> |
---|---|
date | Tue, 29 Jul 2008 09:36:09 -0400 |
parents | 52b4908d8971 |
children | 739612d316a4 ce6b4fd3ab29 |
comparison
equal
deleted
inserted
replaced
429:2bde0bed1919 | 430:c096e2820131 |
---|---|
1452 | 1452 |
1453 Note that the expected semantics of the function differs in minibatch mode | 1453 Note that the expected semantics of the function differs in minibatch mode |
1454 (it takes minibatches of inputs and produces minibatches of outputs, as | 1454 (it takes minibatches of inputs and produces minibatches of outputs, as |
1455 documented in the class comment). | 1455 documented in the class comment). |
1456 | 1456 |
1457 TBM: are filedtypes the old field types (from input_dataset) or the new ones | 1457 TBM: are fieldtypes the old field types (from input_dataset) or the new ones |
1458 (for the new dataset created)? | 1458 (for the new dataset created)? |
1459 """ | 1459 """ |
1460 self.input_dataset=input_dataset | 1460 self.input_dataset=input_dataset |
1461 self.function=function | 1461 self.function=function |
1462 self.output_names=output_names | 1462 self.output_names=output_names |
1463 #print 'self.output_names in afds:', self.output_names | |
1464 #print 'length in afds:', len(self.output_names) | |
1463 self.minibatch_mode=minibatch_mode | 1465 self.minibatch_mode=minibatch_mode |
1464 DataSet.__init__(self,description,fieldtypes) | 1466 DataSet.__init__(self,description,fieldtypes) |
1465 self.valuesHStack = values_hstack if values_hstack else input_dataset.valuesHStack | 1467 self.valuesHStack = values_hstack if values_hstack else input_dataset.valuesHStack |
1466 self.valuesVStack = values_vstack if values_vstack else input_dataset.valuesVStack | 1468 self.valuesVStack = values_vstack if values_vstack else input_dataset.valuesVStack |
1467 | 1469 |
1482 input_examples = zip(*input_fields) #makes so that [i] means example i | 1484 input_examples = zip(*input_fields) #makes so that [i] means example i |
1483 output_examples = [self.function(*input_example) | 1485 output_examples = [self.function(*input_example) |
1484 for input_example in input_examples] | 1486 for input_example in input_examples] |
1485 all_output_fields = zip(*output_examples) | 1487 all_output_fields = zip(*output_examples) |
1486 | 1488 |
1489 #print 'output_names=', self.output_names | |
1490 #print 'all_output_fields', all_output_fields | |
1491 #print 'len(all_output_fields)=', len(all_output_fields) | |
1487 all_outputs = Example(self.output_names, all_output_fields) | 1492 all_outputs = Example(self.output_names, all_output_fields) |
1488 #print 'input_fields', input_fields | |
1489 #print 'all_outputs', all_outputs | |
1490 if fieldnames==self.output_names: | 1493 if fieldnames==self.output_names: |
1491 rval = all_outputs | 1494 rval = all_outputs |
1492 else: | 1495 else: |
1493 rval = Example(fieldnames,[all_outputs[name] for name in fieldnames]) | 1496 rval = Example(fieldnames,[all_outputs[name] for name in fieldnames]) |
1494 #print 'rval', rval | 1497 #print 'rval', rval |