comparison dataset.py @ 88:6749d18e11c8

bugfix as numpy numpy don't support self.data[[i1,...],[i2,...]] when their is more then two i1 and i2
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Mon, 05 May 2008 14:51:41 -0400
parents 7b1f3ad3d60b
children a289b8bed64c
comparison
equal deleted inserted replaced
87:3fd6879e0f76 88:6749d18e11c8
950 if type(key) is list: 950 if type(key) is list:
951 for i in range(len(key)): 951 for i in range(len(key)):
952 if self.hasFields(key[i]): 952 if self.hasFields(key[i]):
953 key[i]=self.fields_columns[key[i]] 953 key[i]=self.fields_columns[key[i]]
954 return MinibatchDataSet(Example(fieldnames, 954 return MinibatchDataSet(Example(fieldnames,
955 [self.data[key,self.fields_columns[f]] for f in fieldnames]), 955 #we must separate differently for list as numpy
956 # don't support self.data[[i1,...],[i2,...]]
957 # when their is more then two i1 and i2
958 [self.data[key,:][:,self.fields_columns[f]]
959 if isinstance(self.fields_columns[f],list) else
960 self.data[key,self.fields_columns[f]]
961 for f in fieldnames]),
956 self.valuesVStack,self.valuesHStack) 962 self.valuesVStack,self.valuesHStack)
957 963
958 # else check for a fieldname 964 # else check for a fieldname
959 if self.hasFields(key): 965 if self.hasFields(key):
960 return self.data[self.fields_columns[key],:] 966 return self.data[self.fields_columns[key],:]