Rank-one updates for faster matrix inversion
来源:互联网 发布:胡退位真相知乎 编辑:程序博客网 时间:2024/06/07 03:23
Making a “rank-one update” to a matrix means adding to the matrix another matrix of rank one:
This actually occurs quite a bit in statistics and optimisation – I’m interested in the topic because rank-one updates occur in certain applications of Expectation Propagation, but a perhaps more important case is in sequential regression problems. Imagine doing linear regression, but being given the datapoints one-by-one. Because the regression coefficients are given by the famous least-squares equation:
you seem to need to invert the matrix each time you get a new datapoint. This is expensive because matrix inversion is a operation. Thanks to rank-one updates, we can bring that cost down to . At each step if is the current design matrix, our new datapoint is , then the updated version of is:
and
so that we have a rank-one update to for each new datapoint. There are many ways we can take advantage of that, but I’ll only look at two:
- Updating the inverse of using the matrix inversion lemma (AKA the Woodbury-Sherman-Morrison formula)
- Updating the Cholesky decomposition of
For the first one, say that , and we have already computed the inverse of . The matrix inversion lemma tells us that:
(what this formula does becomes clearer if you imagine that is an eigenvector of A). From a computational point of view, the important point is that we can update the inverse using just matrix products, a division and an addition, which brings the cost down to .
The second solution is often recommended by linear algebra specialists because it has better numerical stability. It is a bit slower in practice, and I haven’t seen it do much of a difference in my own problems, but YMMV. It might become important when the matrices are poorly conditioned. Inverting a positive-definite matrix can be done via the Cholesky decomposition:
where is an upper-triangular matrix. The trick is simply that:
and inverting a triangular matrix is easy, so that the expensive part is to get in the first place.
In R I find it useful to define a cholsolve function as such:
#Compute A\b, given U=chol(A)
cholsolve <- function(U,b)
{
backsolve(U,forwardsolve(t(U),b))
}
It is possible to update a Cholesky decomposition following a rank-one update in time, see for example this tech report by Matthias Seeger. A year ago I wrote my own C function for doing that, which managed to be slower than the for most practical values of (a bit of a disappointment). Fortunately, a package called SamplerCompare has a function called chud which is very fast, so that there’s no excuse anymore for not using that trick.
- Rank-one updates for faster matrix inversion
- Cholesky decomposition for Matrix Inversion
- The Approximation of One Matrix by Another of Lower Rank
- Segmentation Driven Low-rank Matrix Recovery for Saliency Detection
- Matrix Inversion Alogrithm (I)
- matrix inversion in boost
- rank() one way useful
- Low-Rank Matrix Fitting
- 矩阵求逆引理(matrix inversion lemma)
- 矩阵求逆引理(matrix inversion lemma)
- Matrix Inversion (using partial pivoting)
- 矩阵求逆引理(matrix inversion lemma)
- 矩阵求逆引理(matrix inversion lemma)
- Check for Updates Once a Day
- 关掉MyEclipse checking for updates(检查更新)
- Check for updates from your iOS app
- Thread updates not available for selected client
- Faster Input for Java
- iOS-Cocos2d----CCScene切换的所有特效,以及设置屏幕横竖屏!
- Android UI开发第二十篇——仿launcher的左右滑动
- 登录GMail提示“...未通过审核”
- 【iOS-Cocos2d游戏开发之四】独自收集Cocos2d提供的字体!共57种(有对照的字体图)
- Objective-C 1
- Rank-one updates for faster matrix inversion
- DataGridView 取得或者修改当前单元格的内容
- 安卓上传文件到服务器源码 - 云代码
- android中include标签的使用
- 读书笔记 : 同步
- 三层架构
- 如何在LoadRunner场景设计中设置串行脚本执行
- 如何创建dynamic web project项目
- Spring3 MVC