# HG changeset patch # User Olivier Delalleau # Date 1243446830 14400 # Node ID 0344ac148585c81f4fc7c9131e11bf2afb5f2607 # Parent c5ed7022054fd06c5db474acf3a58bc013c30ab8 Fixed import so that make_test_datasets can be imported without crashing diff -r c5ed7022054f -r 0344ac148585 pylearn/datasets/make_test_datasets.py --- 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])