Skip to content

[WIP] first step in fixing minimum 2 required samples for fixing MLPRegress… https://github.com/scikit-learn/scikit-learn/issues/24713 #24787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
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
3 changes: 3 additions & 0 deletions sklearn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,9 @@ def _validate_data(
if no_val_X and no_val_y:
raise ValueError("Validation should be done on X, y or both.")
elif not no_val_X and no_val_y:
if ((0.1 * len(X)) < 2):
msg = "10% of input training samples must be at least 2 by default for `R2` scores to be computed."
raise ValueError(msg)
X = check_array(X, input_name="X", **check_params)
out = X
elif no_val_X and not no_val_y:
Expand Down