comparison dataset.py @ 193:cb6b945acf5a

Complete redesign of learner...
author Yoshua Bengio <bengioy@iro.umontreal.ca>
date Thu, 15 May 2008 12:55:21 -0400
parents f01ac276c6fb
children 80731832c62b
comparison
equal deleted inserted replaced
192:f62a03c9d485 193:cb6b945acf5a
24 for name,value in zip(attribute_names,attribute_values): 24 for name,value in zip(attribute_names,attribute_values):
25 self.__setattr__(name,copy.deepcopy(value)) 25 self.__setattr__(name,copy.deepcopy(value))
26 else: 26 else:
27 for name,value in zip(attribute_names,attribute_values): 27 for name,value in zip(attribute_names,attribute_values):
28 self.__setattr__(name,value) 28 self.__setattr__(name,value)
29
30 def getAttributes(self,attribute_names=None, return_copy=False):
31 """
32 Return all (if attribute_names=None, in the order of attributeNames()) or a specified subset of attributes.
33 """
34 if attribute_names is None:
35 attribute_names = self.attributeNames()
36 if return_copy:
37 return [copy.copy(self.__getattribute__(name)) for name in attribute_names]
38 else:
39 return [self.__getattribute__(name) for name in attribute_names]
29 40
30 41
31 class DataSet(AttributesHolder): 42 class DataSet(AttributesHolder):
32 """A virtual base class for datasets. 43 """A virtual base class for datasets.
33 44