Sparse modeling: Chapter 3 Tracking algorithm

Sparse modeling Chapter 3 Implemented the algorithm of the tracking algorithm in Python.

Jupyter notebook summarizing the code and experimental results.

Implemented the following greedy algorithm and convex relaxation method. IRLS is a little suspicious ...

Greedy algorithm

Convex relaxation method

Overview of greedy algorithm

Initialization

As $ k = 0 $

Main loop

Perform the following steps as $ k \ leftarrow k + 1 $.

  1. Error calculation, support update: Column $ \ mathbf {a} _ {j} $ that can reduce the most residual $ \ mathbf {r} ^ {k} $ from $ \ mathbf {A} $ To $ S ^ k $ 1.Provisional World Update:\\| \mathbf{Ax}-\mathbf{b}\\|^{2}_{2} \, \rm{subject} \, \rm{to} \, \rm{Support}\\{\mathbf{x}\\}=S^{k}Optimal solution of\mathbf{x}^{k}Let.
  2. Update the residuals: Calculate $ \ mathbf {r} ^ {k} = \ mathbf {b}-\ mathbf {Ax} ^ {k} . 1.Stop condition: If\|\mathbf{r}^{k}\|<\epsilon_{0}$If so, it ends, otherwise it repeats.

In error calculation and support update, the inner product of all columns $ \ mathbf {a} _ {j} $ of $ \ mathbf {A} $ and the residual $ \ mathbf {r} $ is calculated, and the absolute value of the inner product is calculated. Add the column that maximizes to the support. In other words, columns parallel to $ \ mathbf {r} $ are added in order.

Differences in greedy algorithm

IRLS overview

Initialization

As $ k = 0 $

Main loop

Perform the following steps as $ k \ leftarrow k + 1 $.

  1. Least Squares: Linear simultaneous equations $ \ mathbf {x} \ _ {k} = \ mathbf {X} \ _ {k-1} ^ {2} \ mathbf {A} ^ {T} (\ mathbf Solve and approximate {A} \ mathbf {X} _ {k-1} ^ {2} \ mathbf {A} ^ {T}) ^ {+} \ mathbf {b} $ directly or using iterative methods Get the solution $ \ mathbf {x} \ k . 1.Weight update:X{k}(j,j)=|x_{k}(j)|^{0.5}As a weighted diagonal matrix\mathbf{X}Update 1.Stop condition: If\|\mathbf{x}_{k}-\mathbf{x}_{k-1}\|_{2}$If is less than the pre-given threshold, it ends, otherwise it repeats.

Experiment

simulation

$ \ mathbf {x} $ 50 dimensional vector $ \ mathbf {b} $ 30 dimensional vector $ \ mathbf {A} $ 30 × 50 dimensional matrix, column normalization of uniform random numbers of $ [-1, 1) $

index

result

Average $ L_ {2} $ error l2_err.png

Average distance between supports dist_S.png

X_1.png X_3.png X_5.png

Consideration

Recommended Posts

Sparse modeling: Chapter 3 Tracking algorithm
Sparse modeling: Chapter 5 From exact solution to approximate solution
<Course> Machine Learning Chapter 6: Algorithm 2 (k-means)
Sparse modeling: 2.3 Construction of Glasman matrix