8000 Added documentation about y nan handling in check_X_y · johannah/scikit-learn@c450751 · GitHub
[go: up one dir, main page]

Skip to content

Commit c450751

Browse files
hlin117MechCoder
authored andcommitted
Added documentation about y nan handling in check_X_y
1 parent b6a5ed2 commit c450751

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

sklearn/utils/validation.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,10 @@ def check_X_y(X, y, accept_sparse=None, dtype="numeric", order=None, copy=False,
440440
"""Input validation for standard estimators.
441441
442442
Checks X and y for consistent length, enforces X 2d and y 1d.
443-
Standard input checks are only applied to y. For multi-label y,
444-
set multi_output=True to allow 2d and sparse y.
445-
If the dtype of X is object, attempt converting to float,
446-
raising on failure.
443+
Standard input checks are only applied to y, such as checking that y
444+
does not have np.nan or np.inf targets. For multi-label y, set
445+
multi_output=True to allow 2d and sparse y. If the dtype of X is
446+
object, attempt converting to float, raising on failure.
447447
448448
Parameters
449449
----------
@@ -473,7 +473,8 @@ def check_X_y(X, y, accept_sparse=None, dtype="numeric", order=None, copy=False,
473473
be triggered by a conversion.
474474
475475
force_all_finite : boolean (default=True)
476-
Whether to raise an error on np.inf and np.nan in X.
476+
Whether to raise an error on np.inf and np.nan in X. This parameter
477+
does not influence whether y can have np.inf or np.nan values.
477478
478479
ensure_2d : boolean (default=True)
479480
Whether to make X at least 2d.
@@ -483,7 +484,8 @@ def check_X_y(X, y, accept_sparse=None, dtype="numeric", order=None, copy=False,
483484
484485
multi_output : boolean (default=False)
485486
Whether to allow 2-d y (array or sparse matrix). If false, y will be
486-
validated as a vector.
487+
validated as a vector. y cannot have np.nan or np.inf values if
488+
multi_output=True.
487489
488490
ensure_min_samples : int (default=1)
489491
Make sure that X has a minimum number of samples in its first

0 commit comments

Comments
 (0)
0