Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion sklearn/datasets/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
from os import environ, listdir, makedirs
from os.path import expanduser, isdir, join, splitext
from pathlib import Path
from numbers import Integral

from ..preprocessing import scale
from ..utils import Bunch
from ..utils import check_random_state
from ..utils import check_pandas_support
from ..utils.fixes import _open_binary, _open_text, _read_text, _contents
from ..utils._param_validation import validate_params
from ..utils._param_validation import validate_params, Interval

import numpy as np

Expand Down Expand Up @@ -820,6 +821,13 @@ def load_breast_cancer(*, return_X_y=False, as_frame=False):
)


@validate_params(
{
"n_class": [Interval(Integral, 1, 10, closed="both")],
"return_X_y": ["boolean"],
"as_frame": ["boolean"],
}
)
def load_digits(*, n_class=10, return_X_y=False, as_frame=False):
"""Load and return the digits dataset (classification).

Expand Down
1 change: 1 addition & 0 deletions sklearn/tests/test_public_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def _check_function_param_validation(
"sklearn.datasets.fetch_species_distributions",
"sklearn.datasets.load_breast_cancer",
"sklearn.datasets.load_diabetes",
"sklearn.datasets.load_digits",
"sklearn.datasets.load_iris",
"sklearn.datasets.load_svmlight_file",
"sklearn.datasets.load_svmlight_files",
Expand Down