Mercurial > pylearn
changeset 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 (current diff) 70147d00615a (diff) |
children | 1aabd2e2bb5f |
files | dataset.py test_dataset.py |
diffstat | 3 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Tue Apr 29 15:05:12 2008 -0400 +++ b/.hgignore Tue Apr 29 16:09:17 2008 -0400 @@ -1,2 +1,3 @@ syntax: glob *~ +*.pyc \ No newline at end of file
--- a/dataset.py Tue Apr 29 15:05:12 2008 -0400 +++ b/dataset.py Tue Apr 29 16:09:17 2008 -0400 @@ -30,7 +30,7 @@ * for example in dataset([field1, field2,field3, ...]): * for val1,val2,val3 in dataset([field1, field2,field3]): * for minibatch in dataset.minibatches([field1, field2, ...],minibatch_size=N): - * for mini1,mini2,mini3 in dataset.minibatches([field1, field2, ...],minibatch_size=N): + * for mini1,mini2,mini3 in dataset.minibatches([field1, field2, field3], minibatch_size=N): * for example in dataset: print example['x'] * for x,y,z in dataset: @@ -46,8 +46,8 @@ To iterate over fields, one can do * for field in dataset.fields(): for field_value in field: # iterate over the values associated to that field for all the dataset examples - * for fields in dataset(field1,field2,...).fields() to select a subset of fields - * for fields in dataset.fields(field1,field2,...) to select a subset of fields + * for field in dataset(field1,field2,...).fields() to select a subset of fields + * for field in dataset.fields(field1,field2,...) to select a subset of fields and each of these fields is iterable over the examples: * for field_examples in dataset.fields(): for example_value in field_examples:
--- a/test_dataset.py Tue Apr 29 15:05:12 2008 -0400 +++ b/test_dataset.py Tue Apr 29 16:09:17 2008 -0400 @@ -1,4 +1,4 @@ - +#!/bin/env python from dataset import * from math import * import numpy @@ -9,7 +9,9 @@ print a ds = ArrayDataSet(a,{'x':slice(3),'y':3,'z':[0,2]}) print "len(ds)=",len(ds) + assert(len(ds)==10) print "example 0 = ",ds[0] +# assert print "x=",ds["x"] print "x|y" for x,y in ds("x","y"):