Search code examples
pythonsklearn-pandas

What does load_digits() from sklearn do?


Well, I've seen some questions regarding load_digits(), but all of them are regarding some feature or some comparison against other function. What I really need to know is what does load_digits do? In layman's terms. Please do not just copy the definition given in the sklearn website, I've read and I have no clue what that means.

This is the code given in the class that I didn't understand:

    dataset = load_digits()
    X, y = dataset.data, dataset.target

    for class_name, class_count in zip(dataset.target_names, np.bincount(dataset.target)):
        print(class_name,class_count) 

Solution

  • In layman's terms, it loads the MNIST dataset, as a dictionary.

    There are 5 elements in the dict:

    Out[27]: dict_keys(['data', 'target', 'target_names', 'images', 'DESCR'])
    

    Probably you've seen these before:

    enter image description here

    That's the MNIST dataset of hand-written digits. It's being used as a benchmark classification task for machine learning algorithms, and in AI research.