changeset 322:ad8be93b3c55

small bugs fixed with NArrayDataSet
author Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca>
date Thu, 12 Jun 2008 12:45:42 -0400
parents f03ae06fadc8
children 44f94ffe28f7
files dataset.py
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/dataset.py	Thu Jun 12 12:35:47 2008 -0400
+++ b/dataset.py	Thu Jun 12 12:45:42 2008 -0400
@@ -192,11 +192,6 @@
                 else description
         self._attribute_names = ["description"]
 
-        # create dictionnary of fieldnames index
-        self.map_field_idx = dict()
-        for k in len(range(self.fieldNames())):
-            map_field_idx[ self.fieldNames[k] ] = k
-
 
     attributeNames = property(lambda self: copy.copy(self._attribute_names))
 
@@ -1065,12 +1060,11 @@
         ArrayFieldsDataSet.__init__(self,**kwargs)
         assert len(data_arrays) == len(fieldnames)
         assert len(fieldnames) > 0
-        ndarrays = [numpy.ndarray(a) for a in data_arrays]
+        ndarrays = [numpy.asarray(a) for a in data_arrays]
         lens = [a.shape[0] for a in ndarrays]
         num_examples = lens[0] #they must all be equal anyway
         self._fieldnames = fieldnames
-        self._datas = []
-        for k in self.ndarrays :
+        for k in ndarrays :
             assert k.shape[0] == num_examples
         self._datas = ndarrays
         # create dict