comparison dataset.py @ 56:1729ad44f175

Automated merge with ssh://p-omega1@lgcm.iro.umontreal.ca/tlearn
author Yoshua Bengio <bengioy@iro.umontreal.ca>
date Tue, 29 Apr 2008 16:09:17 -0400
parents 66619ce44497 e3ac93e27e16
children 1aabd2e2bb5f
comparison
equal deleted inserted replaced
55:66619ce44497 56:1729ad44f175
28 28
29 To iterate over examples, there are several possibilities: 29 To iterate over examples, there are several possibilities:
30 * for example in dataset([field1, field2,field3, ...]): 30 * for example in dataset([field1, field2,field3, ...]):
31 * for val1,val2,val3 in dataset([field1, field2,field3]): 31 * for val1,val2,val3 in dataset([field1, field2,field3]):
32 * for minibatch in dataset.minibatches([field1, field2, ...],minibatch_size=N): 32 * for minibatch in dataset.minibatches([field1, field2, ...],minibatch_size=N):
33 * for mini1,mini2,mini3 in dataset.minibatches([field1, field2, ...],minibatch_size=N): 33 * for mini1,mini2,mini3 in dataset.minibatches([field1, field2, field3], minibatch_size=N):
34 * for example in dataset: 34 * for example in dataset:
35 print example['x'] 35 print example['x']
36 * for x,y,z in dataset: 36 * for x,y,z in dataset:
37 Each of these is documented below. All of these iterators are expected 37 Each of these is documented below. All of these iterators are expected
38 to provide, in addition to the usual 'next()' method, a 'next_index()' method 38 to provide, in addition to the usual 'next()' method, a 'next_index()' method
44 dataset length. 44 dataset length.
45 45
46 To iterate over fields, one can do 46 To iterate over fields, one can do
47 * for field in dataset.fields(): 47 * for field in dataset.fields():
48 for field_value in field: # iterate over the values associated to that field for all the dataset examples 48 for field_value in field: # iterate over the values associated to that field for all the dataset examples
49 * for fields in dataset(field1,field2,...).fields() to select a subset of fields 49 * for field in dataset(field1,field2,...).fields() to select a subset of fields
50 * for fields in dataset.fields(field1,field2,...) to select a subset of fields 50 * for field in dataset.fields(field1,field2,...) to select a subset of fields
51 and each of these fields is iterable over the examples: 51 and each of these fields is iterable over the examples:
52 * for field_examples in dataset.fields(): 52 * for field_examples in dataset.fields():
53 for example_value in field_examples: 53 for example_value in field_examples:
54 ... 54 ...
55 but when the dataset is a stream (unbounded length), it is not recommanded to do 55 but when the dataset is a stream (unbounded length), it is not recommanded to do