Skip to content
Merged
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
14 changes: 4 additions & 10 deletions sklearn/naive_bayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,21 +1146,15 @@ def partial_fit(self, X, y, classes=None, sample_weight=None):
sample_weight=sample_weight)

def _check_X(self, X):
# FIXME: we can avoid calling check_array twice after #14872 is merged.
# X = check_array(X, y, dtype='int', accept_sparse=False,
# force_all_finite=True)
X = check_array(X, accept_sparse=False, force_all_finite=True)
X = check_array(X, dtype='int')
X = check_array(X, dtype='int', accept_sparse=False,
force_all_finite=True)
if np.any(X < 0):
raise ValueError("X must not contain negative values.")
return X

def _check_X_y(self, X, y):
# FIXME: we can avoid calling check_array twice after #14872 is merged.
# X, y = check_array(X, y, dtype='int', accept_sparse=False,
# force_all_finite=True)
X, y = check_X_y(X, y, accept_sparse=False, force_all_finite=True)
X, y = check_X_y(X, y, dtype='int')
X, y = check_X_y(X, y, dtype='int', accept_sparse=False,
force_all_finite=True)
if np.any(X < 0):
raise ValueError("X must not contain negative values.")
return X, y
Expand Down