Mercurial > pylearn
changeset 731:0344ac148585
Fixed import so that make_test_datasets can be imported without crashing
author | Olivier Delalleau <delallea@iro> |
---|---|
date | Wed, 27 May 2009 13:53:50 -0400 |
parents | c5ed7022054f |
children | 9b371879c6ab |
files | pylearn/datasets/make_test_datasets.py |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/datasets/make_test_datasets.py Wed May 27 13:26:33 2009 -0400 +++ b/pylearn/datasets/make_test_datasets.py Wed May 27 13:53:50 2009 -0400 @@ -1,7 +1,6 @@ -from dataset import ArrayDataSet -from shapeset.dset import Polygons -from linear_regression import linear_predictor -from kernel_regression import kernel_predictor +from pylearn.old_dataset.dataset import ArrayDataSet +from pylearn.algorithms.linear_regression import linear_predictor +from pylearn.algorithms.kernel_regression import kernel_predictor from numpy import * """ @@ -24,6 +23,9 @@ return images.reshape(len(images),images[0].size).astype('float64'),targets return dataset.ApplyFunctionDataSet(dset("image","nvert"),mapf,["input","target"]) + # Import moved inside function because shapeset is not part of Pylearn, + # and thus may not be available (=> crash). + from shapeset.dset import Polygons p=Polygons(image_size,[3,4],fg_min=1./255,fg_max=1./255,rot_max=1.,scale_min=0.35,scale_max=0.9,pos_min=0.1, pos_max=0.9) trainset=convert_dataset(p) return trainset @@ -43,6 +45,9 @@ return images.reshape(len(images),images[0].size).astype('float64'),targets return dataset.CachedDataSet(dataset.ApplyFunctionDataSet(dset("image","nvert"),mapf,["input","target"]),cache) + # Import moved inside function because shapeset is not part of Pylearn, + # and thus may not be available (=> crash). + from shapeset.dset import Polygons p=Polygons(image_size,[3,4],fg_min=1./255,fg_max=1./255,rot_max=1.,scale_min=0.35,scale_max=0.9,pos_min=0.1, pos_max=0.9) data = p.subset[0:n_examples] trainset=convert_dataset(data.subset[0:n_examples])