diff --git a/sklearn/datasets/base.py b/sklearn/datasets/base.py index 549671381cf2ab90300de2015fa769d6eef298f4..98b31411683c977fcfdc2fc8cef3493f9ea64f83 100644 --- a/sklearn/datasets/base.py +++ b/sklearn/datasets/base.py @@ -244,7 +244,8 @@ def load_digits(n_class=10): >>> from sklearn.datasets import load_digits >>> digits = load_digits() - + >>> digits.data.shape + (1797, 64) >>> # import pylab as pl >>> # pl.gray() >>> # pl.matshow(digits.images[0]) # Visualize the first image @@ -332,7 +333,9 @@ def load_boston(): Examples -------- >>> from sklearn.datasets import load_boston - >>> data = load_boston() + >>> boston = load_boston() + >>> boston.data.shape + (506, 13) """ module_path = dirname(__file__) data_file = csv.reader(open(join(module_path, 'data', @@ -381,7 +384,6 @@ def load_sample_images(): (427, 640, 3) >>> first_img_data.dtype dtype('uint8') - >>> # import pylab as pl >>> # pl.gray() >>> # pl.matshow(dataset.images[0]) # Visualize the first image @@ -413,6 +415,7 @@ def load_sample_images(): def load_sample_image(image_name): """Load the numpy array of a single sample image + >>> from sklearn.datasets import load_sample_image >>> china = load_sample_image('china.jpg') >>> china.dtype dtype('uint8') diff --git a/sklearn/datasets/mldata.py b/sklearn/datasets/mldata.py index dc8b3054b800bd31d97b556f4941a5cd85cb4a6b..7a4f1ae62108a174a03815eb15df0b014fa83fd6 100644 --- a/sklearn/datasets/mldata.py +++ b/sklearn/datasets/mldata.py @@ -80,7 +80,7 @@ def fetch_mldata(dataname, target_name='label', data_name='data', Load the 'iris' dataset from mldata.org: >>> from sklearn.datasets.mldata import fetch_mldata >>> iris = fetch_mldata('iris') - >>> print iris.target[0] + >>> iris.target[0] 1 >>> print iris.data[0] [-0.555556 0.25 -0.864407 -0.916667] diff --git a/sklearn/feature_extraction/image.py b/sklearn/feature_extraction/image.py index 0a6525e11624124acba336a01331b5ef78d2c45a..8ec6ab0b8cb15abf6cfcc749bd0a982cae378fc4 100644 --- a/sklearn/feature_extraction/image.py +++ b/sklearn/feature_extraction/image.py @@ -208,13 +208,14 @@ def extract_patches_2d(image, patch_size, max_patches=None, random_state=None): Examples -------- + >>> from sklearn.feature_extraction import image >>> one_image = np.arange(16).reshape((4, 4)) >>> one_image array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11], [12, 13, 14, 15]]) - >>> patches = extract_patches_2d(one_image, (2, 2)) + >>> patches = image.extract_patches_2d(one_image, (2, 2)) >>> patches.shape (9, 2, 2) >>> patches[0]