Skip to content

skl_digits

load_data

Load and return the Sklearn digits dataset.

Parameters:

Name Type Description Default
image_key str

The key for image.

'x'
label_key str

The key for label.

'y'

Returns:

Type Description
NumpyDataset

(train_data, eval_data)

Source code in fastestimator/fastestimator/dataset/data/skl_digits.py
def load_data(image_key: str = "x", label_key: str = "y") -> NumpyDataset:
    """Load and return the Sklearn digits dataset.

    Args:
        image_key: The key for image.
        label_key: The key for label.

    Returns:
        (train_data, eval_data)
    """
    ds = datasets.load_digits()
    images = ds.images
    targets = ds.target
    return NumpyDataset({image_key: images, label_key: targets})