Exemplo n.º 1
0
def test_sparse():
    copy = CopyTransformer()
    tfidf = TfidfTransformer()
    X_t = tfidf.fit_transform([[1, 2, 3]])
    assert issparse(X_t)
    X_dense = copy.transform(X_t).toarray()
    expect = np.array([[0.26726124, 0.53452248, 0.80178373]])
    assert np.allclose(X_dense, expect)
Exemplo n.º 2
0
def test_sparse():
    copy = CopyTransformer()
    tfidf = TfidfTransformer()
    X_t = tfidf.fit_transform([[1, 2, 3]])
    assert issparse(X_t)
    X_dense = copy.transform(X_t).toarray()
    expect = np.array([[0.26726124, 0.53452248, 0.80178373]])
    assert np.allclose(X_dense, expect)
Exemplo n.º 3
0
def test_copy():
    copy = CopyTransformer()
    np.testing.assert_array_equal(X, copy.transform(X))
Exemplo n.º 4
0
def test_copy():
    copy = CopyTransformer()
    np.testing.assert_array_equal(X, copy.transform(X))