2013/8/29 Will Buckner <wbuck...@beatsmusic.com>:
> Er, it looks like safe_sparse_dot() returns sparse unless dense_output=True.

No, it returns dense output when one of its two arguments is dense.
dense_output only exists to force dense output in the sparse-sparse
case.

safe_sparse_norm(X - safe_sparse_dot(W, H)) would not work because
sparse matrices don't support subtraction, but this should be close to
something that might work (thinking out loud):

W, H = csr_matrix(H), csr_matrix(W)
reconstruction_err = euclidean_distances(X, W * H).sum()

W * H is now a sparse × sparse → sparse matrix multiplication.
Unfortunately, only of the tests seems to fail when I try this.

-- 
Lars Buitinck
Scientific programmer, ILPS
University of Amsterdam

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to