Mercurial > pylearn
comparison dataset.py @ 320:b1da46b9b901
bug fixed when initializing NArraysDataSet with 1-d arrays. This now raises an Exception
author | Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca> |
---|---|
date | Wed, 11 Jun 2008 17:11:37 -0400 |
parents | 6441e568745e |
children | f03ae06fadc8 |
comparison
equal
deleted
inserted
replaced
319:6441e568745e | 320:b1da46b9b901 |
---|---|
1059 ArrayFieldsDataSet.__init__(self,**kwargs) | 1059 ArrayFieldsDataSet.__init__(self,**kwargs) |
1060 assert len(data_arrays) == len(fieldnames) | 1060 assert len(data_arrays) == len(fieldnames) |
1061 assert len(fieldnames) > 0 | 1061 assert len(fieldnames) > 0 |
1062 all_matrix_sizes = map(lambda x : numpy.asmatrix(x).shape[0] , data_arrays) | 1062 all_matrix_sizes = map(lambda x : numpy.asmatrix(x).shape[0] , data_arrays) |
1063 num_examples = max(all_matrix_sizes) | 1063 num_examples = max(all_matrix_sizes) |
1064 if num_examples == 1 : | |
1065 # problem, do we transpose all arrays? is there only one example? | |
1066 raise Exception("wrong initialization, unknow behaviour with 1-d arrays") | |
1064 self._fieldnames = fieldnames | 1067 self._fieldnames = fieldnames |
1065 self._datas = [] | 1068 self._datas = [] |
1066 for k in range(len(data_arrays)) : | 1069 for k in range(len(data_arrays)) : |
1067 self._datas.append( numpy.asmatrix(data_arrays[k]) ) | 1070 self._datas.append( numpy.asmatrix(data_arrays[k]) ) |
1068 if self._datas[-1].shape[0] == 1 and self._datas[-1].shape[1] == num_examples : | 1071 if self._datas[-1].shape[0] == 1 and self._datas[-1].shape[1] == num_examples : |