# HG changeset patch # User James Bergstra # Date 1240260775 14400 # Node ID be6639fccecc7eec5f0f020f5ca8729dc6239af7 # Parent 4497619e29558c4900ecb90dfa74e248e8a4ed8d added option for custom path in tzanetakis diff -r 4497619e2955 -r be6639fccecc pylearn/datasets/tzanetakis.py --- a/pylearn/datasets/tzanetakis.py Wed Apr 08 19:53:18 2009 -0400 +++ b/pylearn/datasets/tzanetakis.py Mon Apr 20 16:52:55 2009 -0400 @@ -63,7 +63,7 @@ class TzanetakisExample(theano.Op): """Return the i'th file, label pair from the Tzanetakis dataset.""" @staticmethod - def read_tzanetakis_file(): + def read_tracklist(alt_path_root=None): """Read the tzanetakis dataset file :rtype: (list, list) :returns: paths, labels @@ -74,7 +74,12 @@ for line in tracklist: toks = line.split() try: - path.append(toks[0]) + if alt_path_root is None: + path.append(toks[0]) + else: + line_path = toks[0] + file_name = line_path.split('/')[-1] + path.append(alt_path_root + '/' + file_name) label.append(toks[1]) except: print 'BAD LINE IN TZANETAKIS TRACKLIST' @@ -96,8 +101,8 @@ reggae=8, rock=9) - def __init__(self): - self.path, self.label = self.read_tzanetakis_file() + def __init__(self, alt_path_root=None): + self.path, self.label = self.read_tracklist(alt_path_root) self.class_idx_dict = {} classes = ('blues classical country disco hiphop jazz metal pop reggae rock').split() for i, c in enumerate(classes):