def test_imbalance(): X, y = make_multiplexer_dataset(address_bits=2, sample_size=1000, positive_class_ratio=0.3) np.bincount(y) == (700, 300), np.bincount(y) X, y = make_multiplexer_dataset(address_bits=2, sample_size=1000, positive_class_ratio=0.7) np.bincount(y) == (300, 700), np.bincount(y)
def test_defaults(): X, y = make_multiplexer_dataset() assert X.shape == (100, 6), X.shape assert X.dtype == np.int assert y.shape == (100, ), y.shape assert y.dtype == np.int
def test_class_labels(): X, y = make_multiplexer_dataset(address_bits=2, sample_size=10, random_seed=0) assert np.array_equal(y, np.array([1, 1, 1, 1, 1, 0, 0, 0, 0, 0])) features = np.array([[0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 1, 0], [1, 0, 1, 0, 1, 1], [0, 1, 1, 1, 1, 1], [0, 1, 0, 1, 1, 1], [0, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1], [1, 0, 1, 0, 0, 1]]) print(X) assert np.array_equal(X, features)
def test_class_labels_shuffle(): X, y = make_multiplexer_dataset(address_bits=2, sample_size=10, random_seed=0, shuffle=True) print(y) assert np.array_equal(y, np.array([0, 1, 0, 0, 1, 0, 1, 0, 1, 1])) features = np.array([[0, 1, 1, 0, 1, 1], [0, 1, 1, 1, 1, 0], [1, 0, 1, 0, 0, 1], [1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [0, 1, 0, 1, 1, 1], [0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 1, 1], [0, 1, 1, 1, 1, 1]]) assert np.array_equal(X, features)
def test_address_bits(): X, y = make_multiplexer_dataset(address_bits=3, sample_size=100) assert X.shape == (100, 11)