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)
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)
def test_copy(): copy = CopyTransformer() np.testing.assert_array_equal(X, copy.transform(X))
def test_copy(): copy = CopyTransformer() np.testing.assert_array_equal(X, copy.transform(X))