Ejemplo n.º 1
0
def test_filter_high_couts_sparse():
    X = np.ones((100, 100))
    X *= np.arange(len(X))
    X_filtered_dense = filter_high_counts(X)

    X_filtered_sparse_csr = filter_high_counts(sparse.csr_matrix(X))
    X_filtered_sparse_coo = filter_high_counts(sparse.coo_matrix(X))

    assert_array_equal(X_filtered_dense,
                       np.array(X_filtered_sparse_csr.todense()))
    assert_array_equal(X_filtered_dense,
                       np.array(X_filtered_sparse_coo.todense()))
Ejemplo n.º 2
0
def test_filter_high_counts():
    X = np.ones((100, 100))
    X *= np.arange(len(X))
    X_filtered_true = X.copy()
    X_filtered_true[-1] = np.nan
    X_filtered_true[:, -1] = np.nan
    X_filtered = filter_high_counts(X)
    assert_array_equal(X_filtered, X_filtered_true)