[Python] Sliding window Singular Value Decomposition

Discussão em 'Python' iniciado por Stack, Março 17, 2025.

  1. Stack

    Stack Membro Participativo

    Throughout the question, I will use Python notation. Suppose I have a matrix A of shape (p, nb) and I create a sliding window, taking the submatrix of p rows and n columns Am = A[:, m : m + n]. Now I want to compute it singular value decomposition (SVD):

    U_m, S_m, Vh_m = svd(Am) = svd(A[:, m:m+n]


    and then go to the next window m+1 and compute its SVD:

    U_m1, S_m1, Vh_m1 = svd(Am1) = svd(A[:, m+1:m+1+n]


    Computing full SVD from scratch has the complexity of o(min(m*n**2, n*m**2)).

    I want to compute the SVD of the m+1 window using the SVD of the m window without computing the full SVD from scratch, so it will be more efficient (with less complexity) than doing a full SVD from scratch. Also I prefer it won't resort to low-rank approximation but will assume that rank(Am) = min(p, n).

    U_m1, S_m1, Vh_m1 = sliding_svd(U_m, S_m, Vh_m, A[:,m+1:m+1+n], A[:,m],A[:,m+n])


    A similar problem is called incremental SVD. To my problem, I call sliding SVD or moving SVD or sliding window SVD.

    I asked a similar question in Math Stack Exchange: https://math.stackexchange.com/ques...ar-value-decomposition-sliding-svd-moving-svd

    I am looking for code or a paper that can be implemented in Python using NumPy and SciPy to solve this problem, or at least some guiding (e.g. related papers that deal with a similar problem).

    Continue reading...

Compartilhe esta Página