Description
There's a benchmark script in benchmarks/bench_plot_nmf.py
that compares our implementation Lin's projected gradient algorithm against Lee & Seung's old gradient descent algorithm, which it implements in 20 lines of code. Turns out that the PG algorithm is completely incapable of beating that baseline, regardless of initialization and despite all the recent optimizations to it. In fact, the baseline is typically faster by a significant margin.
One problem with ProjectedGradientNMF
is that its default tolerance is much too small. When I set the tolerance in the benchmark to a lower value, PG-NMF comes closer to the baseline and can beat it some of the time, but often enough the baseline is still faster than the fastest PG-NMF run.
(I'd have included the plot here, but it seems to be broken and doesn't display the Lee/Seung algorithm's timings.)
I've already tried rewriting the PG algorithm in Cython, leaving only the dot products to Python. That shaves off about a quarter of the running time of fit_transform
, not enough to make it really fast.