def test_inverse_transform():
# We need a lot of components for the reconstruction to be "almost
# equal" in all positions. XXX Test means or sums instead?
a = dd.TruncatedSVD(n_components=52, random_state=42, n_iter=5)
b = sd.TruncatedSVD(n_components=52, random_state=42)
b.fit(Xdense)
Xt = a.fit_transform(dXdense)
Xinv = a.inverse_transform(Xt)
assert_array_almost_equal(Xinv.compute(), Xdense, decimal=1)
评论列表
文章目录