comparison dataset.py @ 171:895b4b60f5e8

bugfix. Otherwise the example was writed over and not a new one was returned
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Tue, 13 May 2008 13:23:05 -0400
parents 4803cb76e26b
children f01ac276c6fb bda6d89d0b3d
comparison
equal deleted inserted replaced
170:bc72a0fa6d01 171:895b4b60f5e8
2 from lookup_list import LookupList 2 from lookup_list import LookupList
3 Example = LookupList 3 Example = LookupList
4 from misc import unique_elements_list_intersection 4 from misc import unique_elements_list_intersection
5 from string import join 5 from string import join
6 from sys import maxint 6 from sys import maxint
7 import numpy 7 import numpy, copy
8 8
9 from exceptions import * 9 from exceptions import *
10 10
11 class AttributesHolder(object): 11 class AttributesHolder(object):
12 def __init__(self): pass 12 def __init__(self): pass
1051 # the work could possibly be done by minibatches 1051 # the work could possibly be done by minibatches
1052 # that are as large as possible but no more than what memory allows. 1052 # that are as large as possible but no more than what memory allows.
1053 fields_values = source_dataset.minibatches(minibatch_size=len(source_dataset)).__iter__().next() 1053 fields_values = source_dataset.minibatches(minibatch_size=len(source_dataset)).__iter__().next()
1054 assert all([len(self)==len(field_values) for field_values in fields_values]) 1054 assert all([len(self)==len(field_values) for field_values in fields_values])
1055 for example in fields_values.examples(): 1055 for example in fields_values.examples():
1056 self.cached_examples.append(example) 1056 self.cached_examples.append(copy.copy(example))
1057 1057
1058 self.fieldNames = source_dataset.fieldNames 1058 self.fieldNames = source_dataset.fieldNames
1059 self.hasFields = source_dataset.hasFields 1059 self.hasFields = source_dataset.hasFields
1060 self.valuesHStack = source_dataset.valuesHStack 1060 self.valuesHStack = source_dataset.valuesHStack
1061 self.valuesVStack = source_dataset.valuesVStack 1061 self.valuesVStack = source_dataset.valuesVStack