What is sklearn.datasets.clear_data_home() in Scikit learn?

Scikit learn is a renowned library for machine learning in Python. It has multiple modules for efficient statistical modeling, data processing, and model building. sklearn.datasets is a module of Scikit learn that includes different utilities to load and fetch common datasets. One of the methods in this module is clear_data_home().

Functionality

This method deletes all the content of the data home cache in a specified directory. We can extract the dataset directory by using the datasets.get_data_home() method and the datasets.clear_data_home() method to help delete downloaded data from the specified directory.

Syntax

The following is the syntax for using this method:

sklearn.datasets.clear_data_home(data_home=None)

Parameters

data_home: This is a string data type argument of a path to the Scikit learn directory. The default value is None which sets the path to ~/sklearn_learn_data.

Code

In this example, we demonstrate how to use this method in code when using the default home directory and not specifying one.

# load from sklearn library
from sklearn.datasets import clear_data_home
# data_home =None will be root/sklearn_learn_data
data = clear_data_home(data_home=None)
print(data)

Free Resources