Mercurial > pylearn
comparison pylearn/dataset_ops/image_patches.py @ 1510:07b48bd449cd
Make a dataset ops use the new path system.
author | Frederic Bastien <nouiz@nouiz.org> |
---|---|
date | Mon, 12 Sep 2011 11:47:00 -0400 |
parents | 976539956475 |
children | 9ffe5d6faee3 |
comparison
equal
deleted
inserted
replaced
1509:b709f6b53b17 | 1510:07b48bd449cd |
---|---|
1 import os, numpy | 1 import os, numpy |
2 import theano | 2 import theano |
3 | 3 |
4 from pylearn.datasets.image_patches import ( | 4 from pylearn.datasets.image_patches import ( |
5 data_root, | |
6 olshausen_field_1996_whitened_images, | 5 olshausen_field_1996_whitened_images, |
7 extract_random_patches) | 6 extract_random_patches) |
8 | 7 |
9 from .protocol import TensorFnDataset # protocol.py __init__.py | 8 from .protocol import TensorFnDataset # protocol.py __init__.py |
10 from .memo import memo | 9 from .memo import memo |
11 | 10 |
12 import scipy.io | 11 import scipy.io |
13 from pylearn.io import image_tiling | 12 from pylearn.io import image_tiling |
13 from pylearn.datasets.config import get_filepath_in_roots | |
14 | 14 |
15 @memo | 15 @memo |
16 def get_dataset(N,R,C,dtype,center,unitvar): | 16 def get_dataset(N,R,C,dtype,center,unitvar): |
17 seed=98234 | 17 seed=98234 |
18 rng = numpy.random.RandomState(seed) | 18 rng = numpy.random.RandomState(seed) |
56 | 56 |
57 | 57 |
58 @memo | 58 @memo |
59 def ranzato_hinton_2010(path=None): | 59 def ranzato_hinton_2010(path=None): |
60 if path is None: | 60 if path is None: |
61 path = os.path.join(data_root(), 'image_patches', 'mcRBM', | 61 path = get_filepath_in_roots(os.path.join('image_patches', 'mcRBM', |
62 'training_colorpatches_16x16_demo.mat') | 62 'training_colorpatches_16x16_demo.mat')) |
63 dct = scipy.io.loadmat(path) | 63 dct = scipy.io.loadmat(path) |
64 return dct | 64 return dct |
65 def ranzato_hinton_2010_whitened_patches(path=None): | 65 def ranzato_hinton_2010_whitened_patches(path=None): |
66 """Return the pca of the data, which is 10240 x 105 | 66 """Return the pca of the data, which is 10240 x 105 |
67 """ | 67 """ |