Skip to content

Commit c9ca1d7

Browse files
committed
Revert "ENH Uses binned values from training to find missing values (#16883)"
This reverts commit e5cc2b0.
1 parent 8a695d7 commit c9ca1d7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

sklearn/ensemble/_hist_gradient_boosting/gradient_boosting.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ def fit(self, X, y, sample_weight=None):
192192
X_train, y_train, sample_weight_train = X, y, sample_weight
193193
X_val = y_val = sample_weight_val = None
194194

195+
has_missing_values = np.isnan(X_train).any(axis=0).astype(np.uint8)
196+
195197
# Bin the data
196198
# For ease of use of the API, the user-facing GBDT classes accept the
197199
# parameter max_bins, which doesn't take into account the bin for
@@ -209,11 +211,6 @@ def fit(self, X, y, sample_weight=None):
209211
else:
210212
X_binned_val = None
211213

212-
# Uses binned data to check for missing values
213-
has_missing_values = (
214-
X_binned_train == self.bin_mapper_.missing_values_bin_idx_).any(
215-
axis=0).astype(np.uint8)
216-
217214
if self.verbose:
218215
print("Fitting gradient boosted rounds:")
219216

0 commit comments

Comments
 (0)