Mercurial > pylearn
comparison dataset.py @ 50:ea7d8bc38b34
fix comment
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Tue, 29 Apr 2008 14:40:06 -0400 |
parents | c5b07e87b0cb |
children | e3ac93e27e16 |
comparison
equal
deleted
inserted
replaced
47:7086cfcd8ed6 | 50:ea7d8bc38b34 |
---|---|
29 | 29 |
30 To iterate over examples, there are several possibilities: | 30 To iterate over examples, there are several possibilities: |
31 * for example in dataset([field1, field2,field3, ...]): | 31 * for example in dataset([field1, field2,field3, ...]): |
32 * for val1,val2,val3 in dataset([field1, field2,field3]): | 32 * for val1,val2,val3 in dataset([field1, field2,field3]): |
33 * for minibatch in dataset.minibatches([field1, field2, ...],minibatch_size=N): | 33 * for minibatch in dataset.minibatches([field1, field2, ...],minibatch_size=N): |
34 * for mini1,mini2,mini3 in dataset.minibatches([field1, field2, ...],minibatch_size=N): | 34 * for mini1,mini2,mini3 in dataset.minibatches([field1, field2, field3], minibatch_size=N): |
35 * for example in dataset: | 35 * for example in dataset: |
36 print example['x'] | 36 print example['x'] |
37 * for x,y,z in dataset: | 37 * for x,y,z in dataset: |
38 Each of these is documented below. All of these iterators are expected | 38 Each of these is documented below. All of these iterators are expected |
39 to provide, in addition to the usual 'next()' method, a 'next_index()' method | 39 to provide, in addition to the usual 'next()' method, a 'next_index()' method |
45 dataset length. | 45 dataset length. |
46 | 46 |
47 To iterate over fields, one can do | 47 To iterate over fields, one can do |
48 * for field in dataset.fields(): | 48 * for field in dataset.fields(): |
49 for field_value in field: # iterate over the values associated to that field for all the dataset examples | 49 for field_value in field: # iterate over the values associated to that field for all the dataset examples |
50 * for fields in dataset(field1,field2,...).fields() to select a subset of fields | 50 * for field in dataset(field1,field2,...).fields() to select a subset of fields |
51 * for fields in dataset.fields(field1,field2,...) to select a subset of fields | 51 * for field in dataset.fields(field1,field2,...) to select a subset of fields |
52 and each of these fields is iterable over the examples: | 52 and each of these fields is iterable over the examples: |
53 * for field_examples in dataset.fields(): | 53 * for field_examples in dataset.fields(): |
54 for example_value in field_examples: | 54 for example_value in field_examples: |
55 ... | 55 ... |
56 but when the dataset is a stream (unbounded length), it is not recommanded to do | 56 but when the dataset is a stream (unbounded length), it is not recommanded to do |