view pylearn/datasets/config.py @ 794:951272679910

get the mnist data from the pmat file and not the amat file
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Wed, 15 Jul 2009 13:18:55 -0400
parents 14d22ca1c8b5
children f4729745bb58
line wrap: on
line source

"""Configuration options for datasets


Especially, the locations of data files.
"""

import os, sys
def env_get(key, default, key2 = None):
    if key2 and os.getenv(key) is None:
        key=key2
    if os.getenv(key) is None:
        print >> sys.stderr, "WARNING: Environment variable", key,
        print >> sys.stderr, "is not set. Using default of", default
    return default if os.getenv(key) is None else os.getenv(key)

def data_root():
    return env_get('PYLEARN_DATA_ROOT', os.getenv('HOME')+'/data', 'DBPATH')