diff --git a/sklearn/datasets/base.py b/sklearn/datasets/base.py index dbea85522f87482f4b667f40e0a8b6e7d1abda8c..549671381cf2ab90300de2015fa769d6eef298f4 100644 --- a/sklearn/datasets/base.py +++ b/sklearn/datasets/base.py @@ -31,6 +31,7 @@ class Bunch(dict): dict.__init__(self, kwargs) self.__dict__ = self + def get_data_home(data_home=None): """Return the path of the scikit-learn data dir. @@ -54,11 +55,13 @@ def get_data_home(data_home=None): makedirs(data_home) return data_home + def clear_data_home(data_home=None): """Delete all the content of the data home cache.""" data_home = get_data_home(data_home) shutil.rmtree(data_home) + def load_files(container_path, description=None, categories=None, load_content=True, shuffle=True, random_state=None): """Load text files with categories as subfolder names. @@ -173,6 +176,7 @@ def load_files(container_path, description=None, categories=None, target=target, DESCR=description) + def load_iris(): """Load and return the iris dataset (classification). @@ -216,6 +220,7 @@ def load_iris(): feature_names=['sepal length (cm)', 'sepal width (cm)', 'petal length (cm)', 'petal width (cm)']) + def load_digits(n_class=10): """Load and return the digits dataset (classification). @@ -265,6 +270,7 @@ def load_digits(n_class=10): images=images, DESCR=descr) + def load_diabetes(): """Load and return the diabetes dataset (regression). @@ -280,6 +286,7 @@ def load_diabetes(): target = np.loadtxt(join(base_dir, 'diabetes_target.csv.gz')) return Bunch(data=data, target=target) + def load_linnerud(): """Load and return the linnerud dataset (multivariate regression). @@ -310,6 +317,7 @@ def load_linnerud(): header_physiological=header_physiological, DESCR=fdescr.read()) + def load_boston(): """Load and return the boston house-prices dataset (regression). @@ -347,6 +355,7 @@ def load_boston(): feature_names=feature_names, DESCR=fdescr.read()) + def load_sample_images(): """Load sample images for image manipulation. @@ -400,6 +409,7 @@ def load_sample_images(): filenames=filenames, DESCR=descr) + def load_sample_image(image_name): """Load the numpy array of a single sample image