comparison datasets/ftfile.py @ 271:a92ec9939e4f

fixed a problem with maxsize when not provided
author Yoshua Bengio <bengioy@iro.umontreal.ca>
date Sun, 21 Mar 2010 19:30:05 -0400
parents 966272e7f14b
children 5e481b224117
comparison
equal deleted inserted replaced
270:d41fe003fade 271:a92ec9939e4f
199 If `valid_data` and `valid_labels` are not supplied then a sample 199 If `valid_data` and `valid_labels` are not supplied then a sample
200 approximately equal in size to the test set is taken from the train 200 approximately equal in size to the test set is taken from the train
201 set. 201 set.
202 """ 202 """
203 if valid_data is None: 203 if valid_data is None:
204 total_valid_size = min(sum(FTFile(td).size for td in test_data), maxsize) 204 total_valid_size = sum(FTFile(td).size for td in test_data)
205 if maxsize is not None:
206 total_valid_size = min(total_valid_size, maxsize)
205 valid_size = total_valid_size/len(train_data) 207 valid_size = total_valid_size/len(train_data)
206 self._train = FTData(train_data, train_lbl, size=-valid_size, 208 self._train = FTData(train_data, train_lbl, size=-valid_size,
207 inscale=inscale, outscale=outscale, 209 inscale=inscale, outscale=outscale,
208 indtype=indtype, outdtype=outdtype, 210 indtype=indtype, outdtype=outdtype,
209 maxsize=maxsize) 211 maxsize=maxsize)