def test_balanced_batch_generator_class_sparse(keep_sparse): training_generator = BalancedBatchGenerator(sparse.csr_matrix(X), y, batch_size=10, keep_sparse=keep_sparse, random_state=42) for idx in range(len(training_generator)): X_batch, y_batch = training_generator.__getitem__(idx) if keep_sparse: assert sparse.issparse(X_batch) else: assert not sparse.issparse(X_batch)
def test_balanced_batch_generator_class_sparse(is_sparse): training_generator = BalancedBatchGenerator(sparse.csr_matrix(X), y, batch_size=10, sparse=is_sparse, random_state=42) for idx in range(len(training_generator)): X_batch, y_batch = training_generator.__getitem__(idx) if is_sparse: assert sparse.issparse(X_batch) else: assert not sparse.issparse(X_batch)
def test_balanced_batch_generator_class_sparse(data, keep_sparse): X, y = data training_generator = BalancedBatchGenerator( sparse.csr_matrix(X), y, batch_size=10, keep_sparse=keep_sparse, random_state=42, ) for idx in range(len(training_generator)): X_batch, _ = training_generator.__getitem__(idx) if keep_sparse: assert sparse.issparse(X_batch) else: assert not sparse.issparse(X_batch)