News for hackers. Stuff that matters.
Re:Machine Learning from scratch: Bare bones implementations... by JustFinishedBSG on Saturday February 25, 2017 @03:00PM (#13733517)
It's usually even better to use iterative methods
Re:Machine Learning from scratch: Bare bones implementations... by thearn4 on Saturday February 25, 2017 @03:10PM (#13733567)
GMRES is definitely my go-to these days. Though it is worth noting that direct methods do have a benefit of letting you quickly solve many successive linear problems involving the same matrix, but different right-hand sides. But iterative methods scale very well for large sparse problems that they are very often the only tool to consider.

Block Krylov methods are a thing , but I haven't experimented with them yet.

Re:Machine Learning from scratch: Bare bones implementations... by JustFinishedBSG on Saturday February 25, 2017 @03:22PM (#13733627)
For solving linear systems there are recent mind-blowing methods by R. M. Gower and P. Richtarik:

https://arxiv.org/abs/1506.03296

http://www.maths.ed.ac.uk/~richtarik/papers/SDA.pdf

Plus R. M. Gower is fantastically nice and enthusiastic so there's that

And thanks for the link !

Re:Machine Learning from scratch: Bare bones implementations... by stabbles on Sunday February 26, 2017 @04:41AM (#13736472)
Only scrolled through it, but AFAIK if its results are comparable to Kaczmarz, then note that it is extremely slow.

If your goal is to solve say a LS problem, why not go for CGLS? http://web.stanford.edu/group/SOL/software/cgls/

Re:Machine Learning from scratch: Bare bones implementations... by zzleeper on Saturday February 25, 2017 @11:13PM (#13735633)
Has anyone implemented them in production? I read their paper a while ago, but thought that the dual methods they showed might have practical limitations (like insane cache misses, compared to more standard methods)
Re:Machine Learning from scratch: Bare bones implementations... by stabbles on Sunday February 26, 2017 @04:29AM (#13736438)
These problems you sketch can already be overcome by using the approximate eigenspectrum info of the matrix obtained as a by-product of Krylov methods. This has been invented many times, and is used in 'thick restart', 'augmented Krylov subspace methods', 'deflation'. In particular this was developed for scattering problems with many electromagnetic incident waves hitting an object, changing only the rhs.

Also, you can also use an approximate LU-decomp as a preconditioner for Krylov methods.

Similarly, Tykhonov regularization (solving for a range of slightly perturbed matrices "A + labda I" where labda is a parameter) are easily tackled using Krylov subspace methods by noting that the Krylov subspace is invariant under shifts like these. So only once an orthonormal basis must be found for the Krylov subspace, which can then be used for every lamda of interest.

Re:Machine Learning from scratch: Bare bones implementations... by stabbles on Sunday February 26, 2017 @04:49AM (#13736493)
Depends on the number of unknowns, sparsity of the matrix, whether you want 3 correct digits or 16, etc.

Direct methods as Gaussian elimination with pivoting are proven to be stable. Iterative methods are not but can be a lot cheaper in computational costs. Also they can stop when a certain relative residual is reached, unlike direct methods.

If iterative methods like Krylov subspace methods where stable, then they could actually be seen as direct methods themselves, as the Krylov subspace has at most a dimension of N, where N is the number of unknowns; so after at most N iterations the solution could be extracted exactly from the search space. In practice this is not the case due to rounding errors.