changeset 1429:b0141efbf6a2

fix loading of sparse utlc dataset when PYLEARN_DATA_ROOT have more then 1 directory.
author Frederic Bastien <nouiz@nouiz.org>
date Tue, 08 Feb 2011 16:17:56 -0500
parents 3823dbfff6cf
children 931a19eeab5a
files pylearn/datasets/utlc.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/datasets/utlc.py	Tue Feb 08 12:57:15 2011 -0500
+++ b/pylearn/datasets/utlc.py	Tue Feb 08 16:17:56 2011 -0500
@@ -116,9 +116,9 @@
     :param transfer: If True also return the transfer label
     """
     assert name in ['harry','terry','ule']
-    trname,vname,tename = [os.path.join(config.data_root(),
-                                        'UTLC','sparse',
-                                        name+'_'+subset+'.npy')
+    common = os.path.join('UTLC','sparse',name+'_')
+    trname,vname,tename = [config.get_filepath_in_roots(common+subset+'.npy.gz',
+                                                        common+subset+'.npy')
                            for subset in ['train','valid','test']]
     train = load_sparse(trname)
     valid = load_sparse(vname)
@@ -192,6 +192,8 @@
             fname = fname+'.gz'
             assert os.path.exists(fname)
             f = gzip.open(fname)
+        elif fname.endswith('.gz'):
+            f = gzip.open(fname)
         else:
             f = open(fname)
         d = cPickle.load(f)