changeset 689:651eb6506d91

do not read data file on import
author James Bergstra <bergstrj@iro.umontreal.ca>
date Thu, 14 May 2009 16:58:14 -0400
parents 49e531f7b0ba
children 7d8bb6d087bc
files pylearn/datasets/tzanetakis.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/datasets/tzanetakis.py	Thu May 14 16:54:59 2009 -0400
+++ b/pylearn/datasets/tzanetakis.py	Thu May 14 16:58:14 2009 -0400
@@ -88,8 +88,6 @@
         assert len(path) == 1000
         return path, label
 
-    nclasses = 10
-
     class_idx_dict = dict(blues=numpy.asarray(0),
             classical=1,
             country=2,
@@ -108,8 +106,9 @@
         for i, c in enumerate(classes):
             self.class_idx_dict[c] = numpy.asarray(i, dtype='int64')
 
-    def __len__(self):
-        return len(self.path)
+    n_examples = property(lambda self: len(self.path))
+    nclasses = property(lambda self: 10)
+
 
     def make_node(self, idx):
         idx_ = theano.tensor.as_tensor_variable(idx)
@@ -127,5 +126,5 @@
     def grad(self, inputs, g_output):
         return [None for i in inputs]
 
-tzanetakis_example = TzanetakisExample()
+#tzanetakis_example = TzanetakisExample() #requires reading a data file