diff 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
line wrap: on
line diff
--- a/dataset.py	Thu May 15 12:46:21 2008 -0400
+++ b/dataset.py	Thu May 15 12:55:21 2008 -0400
@@ -26,6 +26,17 @@
         else:
             for name,value in zip(attribute_names,attribute_values):
                 self.__setattr__(name,value)
+
+    def getAttributes(self,attribute_names=None, return_copy=False):
+        """
+        Return all (if attribute_names=None, in the order of attributeNames()) or a specified subset of attributes.
+        """
+        if attribute_names is None:
+            attribute_names = self.attributeNames()
+        if return_copy:
+            return [copy.copy(self.__getattribute__(name)) for name in attribute_names]
+        else:
+            return [self.__getattribute__(name) for name in attribute_names]
     
     
 class DataSet(AttributesHolder):