def test_missing_indicator(failure_logger, int_dataset, # noqa: F811 missing_values, features): zero_filled, one_filled, nan_filled = int_dataset if missing_values == 0: X_np, X = zero_filled elif missing_values == 1: X_np, X = one_filled else: X_np, X = nan_filled indicator = cuMissingIndicator(missing_values=missing_values, features=features) ft_X = indicator.fit_transform(X) assert type(ft_X) == type(X) indicator.fit(X) t_X = indicator.transform(X) assert type(t_X) == type(X) indicator = skMissingIndicator(missing_values=missing_values, features=features) sk_ft_X = indicator.fit_transform(X_np) indicator.fit(X_np) sk_t_X = indicator.transform(X_np) assert_allclose(ft_X, sk_ft_X) assert_allclose(t_X, sk_t_X)
def test_missing_indicator_sparse(sparse_int_dataset, # noqa: F811 features): X_np, X = sparse_int_dataset indicator = cuMissingIndicator(features=features, missing_values=1) ft_X = indicator.fit_transform(X) # assert type(ft_X) == type(X) assert cp.sparse.issparse(ft_X) or scipy.sparse.issparse(ft_X) indicator.fit(X) t_X = indicator.transform(X) # assert type(t_X) == type(X) assert cp.sparse.issparse(t_X) or scipy.sparse.issparse(t_X) indicator = skMissingIndicator(features=features, missing_values=1) sk_ft_X = indicator.fit_transform(X_np) indicator.fit(X_np) sk_t_X = indicator.transform(X_np) assert_allclose(ft_X, sk_ft_X) assert_allclose(t_X, sk_t_X)