Skip to content
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

Fixed Large memory requirements for SimpleImputer strategy median #4794 #4817

Merged
merged 10 commits into from
Aug 11, 2022
7 changes: 4 additions & 3 deletions python/cuml/thirdparty_adapters/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,17 @@ def _masked_column_median(arr, masked_value):
mask = _get_mask(arr, masked_value)
if arr.size == 0:
return cp.full(arr.shape[1], cp.nan)
arr_sorted = arr.copy()
arr_sorted = arr
erikrene marked this conversation as resolved.
Show resolved Hide resolved
if not cp.isnan(masked_value):
arr_sorted = arr.copy()
# If nan is not the missing value, any column with nans should
# have a median of nan
nan_cols = cp.any(cp.isnan(arr), axis=0)
arr_sorted[mask] = cp.nan
arr_sorted.sort(axis=0)
else:
nan_cols = cp.full(arr.shape[1], False)
# nans are always sorted to end of array
arr_sorted = cp.sort(arr_sorted, axis=0)
arr_sorted = cp.sort(arr_sorted, axis=0)
erikrene marked this conversation as resolved.
Show resolved Hide resolved

count_missing_values = mask.sum(axis=0)
# Ignore missing values in determining "halfway" index of sorted
Expand Down