comparison pylearn/datasets/nade.py @ 1482:be4a49a65333

modified Nade dataset to use new config.get_filepath_in_roots mechanism
author gdesjardins
date Tue, 05 Jul 2011 10:56:40 -0400
parents b24ed2aa077e
children f7b348e6a98e
comparison
equal deleted inserted replaced
1481:444222497167 1482:be4a49a65333
2 import numpy 2 import numpy
3 3
4 from pylearn.io.pmat import PMat 4 from pylearn.io.pmat import PMat
5 from pylearn.datasets.config import data_root # config 5 from pylearn.datasets.config import data_root # config
6 from pylearn.datasets.dataset import Dataset 6 from pylearn.datasets.dataset import Dataset
7 import config
7 8
8 def load_dataset(name=None): 9 def load_dataset(name=None):
9 """ 10 """
10 Various datasets which were used in the following paper. 11 Various datasets which were used in the following paper.
11 The Neural Autoregressive Distribution Estimator 12 The Neural Autoregressive Distribution Estimator
24 WARNING: class labels are integer-valued instead of 1-of-n encoding ! 25 WARNING: class labels are integer-valued instead of 1-of-n encoding !
25 """ 26 """
26 assert name in ['adult','binarized_mnist', 'mnist', 'connect4','dna', 27 assert name in ['adult','binarized_mnist', 'mnist', 'connect4','dna',
27 'mushrooms','nips','ocr_letters','rcv1','web'] 28 'mushrooms','nips','ocr_letters','rcv1','web']
28 rval = Dataset() 29 rval = Dataset()
29 30
30 path = os.path.join(data_root(), 'larocheh', name) 31 # dataset lookup through $PYLEARN_DATA_ROOT
32 _path = os.path.join('larocheh', name)
33 path = config.get_filepath_in_roots(_path)
31 34
32 # load training set 35 # load training set
33 x=numpy.load(os.path.join(path,'train_data.npy')) 36 x=numpy.load(os.path.join(path,'train_data.npy'))
34 y_fname = os.path.join(path, 'train_labels.npy') 37 y_fname = os.path.join(path, 'train_labels.npy')
35 if os.path.exists(y_fname): 38 if os.path.exists(y_fname):