Chapter9 RLS Algorithms Pp40
Chapter9 RLS Algorithms Pp40
Chapter-9 :
Recursive Least Squares (RLS) Algorithms
Marc Moonen
Dept. E.E./ESAT-STADIUS, KU Leuven
[Link]@[Link]
[Link]/stadius/
Chapter-11
Kalman Filters
1
Recap 1/4
filter input
Design filter such that for a given
(i.e. ‘statistical info available’)
input signal, filter output signal is filter filter parameters
‘optimally close’ (to be defined)
to a given ‘desired output signal’. filter output
+
Recap 2/4
PS: Shorthand notation uk =u[k], yk =y[k], dk =d[k], ek=e[k],
Filter coefficients (‘weights’) are wl (replacing bl of
27
yk = ∑ wl .uk−l = w .u k = u .w
l=0
T T
k
w0[k] w1[k] w2[k] w3[k]
0
l=0 yk = wT · uk
previous chapters)
e[k]
filter output y[k]
where +
2
Recap 3/4
2 Will use
30
Recap 4/4
• Depending on the application, either the filter parameters, the filter output
or the error signal is of interest
3
Overview
Lk
! Lk
! k
2 "L 2
JJLS
LS (w) =
(w) = e 2 2=
∑ |d − y |2=
∑ dlk −−uwTlTw
ekl = ( kdl − kyl ) = k=1 |d uk |2 ∑( )
k=1
l=1 k=1
l=1 l=1
4
Least Squares & RLS Estimation 6
(w)==∑ eL
2
cost function :JJLSLS (w) l =e e=2 "e"
k=1 k
= d=−"d
2
Uw − 2Uw"22
l=1
Lk
!
JJLS (w) =
LS (w) =
ee2kl2==!e!
∑ 22 T e = !d − Uw!22
e 2 ==eeT· .e = d −Uw 2
2 2
k=1
l=1
10
5
Least Squares & RLS Estimation 9
11
k
1 !1 1
L
lim k→∞ u.k∑
= lim
ℵX̄dudu = dl 1=Xdulim k→∞ .ℵdu
· dku=l . lim
L→∞ L
k=1
k l=1 L→∞ L k
so that
lim
lim k→∞ w
L→∞ wLSLS ==ww F.
WWF
12
6
Least Squares (LS) Estimation
In words:
Whenever statistical info (autocorrelation and
crosscorrelation) is missing, this can be estimated
from observed data (assuming ergodicity)
The Wiener filter solution, with true statistical
quantities replaced by estimated quantities, then
turns out to be the same as the LS solution
LS approach in itself optimizes a different (LS)
criterion, without any need for statistical
assumptions (e.g. ergodicity..)
13
Overview
14
7
Least Squares & RLS Estimation 11
−1
T #U
$ . k U k %& .U k d k
T T
w[k]
w
−1
= ℵ T[ k ] −1
.ℵ [ k ] =
LS = [Uuu U] du· U d
Wanted : recursive/adaptive algorithms
L → L +@
Can LS solution 1, time
slidingk be
windows, etc... from solution @ time k-1 ?
computed
15
T
Xuu
It is observed that ℵ [k] =ℵ= [k (L) +u [Link]+1
Xuu−1]+ k u(and
T ℵ [k] =ℵ [k −1]+ u k .dk )
uu(L + 1) uu L+1 du du
The matrix inversion lemma states that (check ‘matrix inversion lemma’ in Wikipedia)
1[Xuu(L)]−1u uT T [Xuu(L)]−1
[k]−1 =ℵ 1)][k−1−1]
ℵ [X −1
= [X−uu( (L)]T−1 − 1+u ).k kL+1
L+1 kk with k k =ℵ [k −1]−1 u k
uu uu(L +uu uu
1+ u kℵ [k −1]−1TL+1 u k[Xuu(L)]−1uL+1
uu
With this it is proved that:
Result : 'Kalman
!###gain "### vector'
$ ! 'a ##
priori residual'
#" ### $
w LS [k ] = w LS [k −1] + −1
ℵ [k ]−1 u k . (dk T− u Tk w LS [k −1])
wLS (L + 1) = wLS (L) +% [X###
uu (L
uu+ 1)]
& uL+1 · (d'
### L+1 − uL+1wLS (L))
! "# $ ! 1
"# $
=(
Kalman
1+u T gain −1 u k ). k k
k ℵuu [ k−1]
a priori residual
O(N22) instead
Remark : O(L operations
of per 3
O(Ltime
) update
Remark : square-root algorithms with better numerical properties
see below
16
8
Next to a mechanism for adding new observations, also need a mechanism
Least Squares & RLS Estimation
for removing old observations. First approach is as follows… 14
e
2.2 Sliding Window RLS
id
sl
Sliding window RLS
!
JLS (w) = L 2
k=L−M+1 ek
M = length of the data window
is
th
wLS (L) = [U (L)T U (L)]−1 [U (L)T d(L)]
" #$ %" #$ %
[Xuu(L)]−1 Xdu (L)
p
with
i
dL−M+1 uTL−M+1
k
dL−M+2 uT
d(L) = U (L) = L−M+2 .
S
.. .
dL uTL
17
e
2.2 Sliding Window RLS
id
sl
It is observed that Xuu(L + 1) = Xuu(L) − uL−M+1uTL−M+1 +uL+1uTL+1
! "# $
L|L+1
Xuu
is
th
• downdating is not well behaved numerically, hence to be avoided...
kip
S
DSP-CIS 2022-2023 / Chapter-9: RLS Algorithms 18 / 40
18
9
Next to a mechanism for adding new observations, also need a mechanism
Least Squares & RLS Estimation
for removing old observations. Simpler approach is as follows… 16
Exponentially weighted RLS : Goal is to give a smaller weight to ‘older’ data, i.e.
L!k
JLS (w)== ∑
LS (w) k=1
2(L−k)
λλ2(k−l ) 22
eel k
l=1
λ0dL λ0−1
uTL
w[k] = ℵuu [ k ]−1 .ℵdu [ k ] = #$U kTU k %& .U kT d k
DSP-CIS 2022-2023 / Chapter-9: RLS Algorithms 19 / 40
19
It is observed that X
ℵuu(L 2
[k]+=1)λ = .ℵλ2X[k .uTk uTL+1
(L) +uukL+1
−1]+ (and ℵ [k] = λ 2 .ℵ [k −1]+ u k .dk )
uu uu uu du du
hence
1 1 1
ℵ [k]−1 = 2 ℵ−1 [k −1] −1 − ( ℵ [k −1]−1 u k
1 [X −1 T 1T[X (L)]−1
2 uu (L)] uL+1 u ).k kk
uu with kk =
uu[Xuu(L +λ 1)]uu = λ12 [Xuu(L)]−1 λ2k
L+1
1 −T λ 1+ 1 uT−1 [X (L)] −1u λ 2 uu
1+ 2 u kℵ [k −1] 2 L+1u kuu L+1
λ uu λ
wwLSLS[k]
(L + = wwLS
1) = (L) +
LS[k [Xuu+ℵ uL+1−1
(L + 1)]−1[k] · (dL+1 uTL+1w
u k−.(d T .
LS (L))
−1] k − u k w LS [k −1])
uu
i.e. exponential weighting hardly changes RLS formulas.. (easy!)
20
10
Recursive Least Squares
Computational Complexity:
Standard RLS algorithm has O(L2) computational
complexity per update
Compare to O(L) for LMS (=cheaper, but slow convergence)
21
Numerical Analysis/Stability:
Standard RLS algorithm has been shown to have
unstable quantization error propagation (in low-
precision implementation)
i.e. when an infinite precision version is run next to a finite precision version
(both fed with the same input signals), then after xx iterations the finite precision
version produces results (far) away from the infinite precision results
22
11
Overview
23
minw !d − Uw!22
24
12
Least Squares & RLS Estimation 21
Example :
U Q
Q
!
"# $ ! "# $ ! R
1 6 10 0.182 0.816 0.174 "# $
2 5.477 14.605 −5.112
7 −11 0.365 0.408 −0.619
3 = · 0 4.082 8.981
8 12 0.547 0 0.716
0 0 20.668
4 9 −13 0.730 −0.408 −0.270
Remark : U T · U = RT · R
R is Cholesky factor or square-root of U T · U
→ ‘square-root’ algorithms !
25
! R $
U Q .# !
Q . R
! = ! &= ! !
= Q · R kxk
Ukx ( L+1) "!0 % Q(:,1:L+1) ( L+1) x ( L+1)
kx ( L+1)
then
2
! " 2!(**) " 2 " z % " R %
QT w· dU −Uw
T
min d =2 =Rmin
z w Q (d −Uw) = min w $ '−$ 'w
2
# * & # 0 & 2
26
13
Square Root RLS Algorithms
PS: This (= QRD + backsubstitution) is also the way Matlab™
solves LS problems ( cfr “w=U\d” or “w=mldivide(U,d)” )
27
28
14
Least Squares & RLS Estimation 24
29
30
15
Least Squares & RLS Estimation 26
31
QRD updating
32
16
Least Squares & RLS Estimation 28
QRD updating
x x x x x x x x xx x x xxxx
x x x x x x x x x
x x x
→ →
→
x x x x x x x x
x x x x x x x x x !
33
34
17
29
Least Squares
!"
R[k]&z[k] RLS %" Estimation!
" R[k
$ R(k + 1) z(k + 1) ' = Q[k] ⋅ $
−1]
R(k)
"
z(k) z[k −1] T
%
'
→ Q(k + 1)$T · uT T
# 0!0
$ 0 ∗
! '
& # uk+1
k dk+1 dk '
&
u(1) u(2) u(3) u(4) d
u[k] u[k-1] u[k-2] u[k-3] d[k]
rotation cell
R11 R12 R13 R14 z11 a a’
0
b b’
R22 R23 R24 z21
0
memory cell
R33 R34 z31
(delay)
4-by-4 example
0
R44 z41
0
*
35
Overview
36
18
Square Root RLS Algorithms
Residual Extraction
37
Residual extraction
ddk+1 T w
u Tkuw ! ε
k −− LS [k
k+1 LS−1] = #N L+1
(k) =
i=1 cos(θ i) θ ) Hence ε is geometric mean of
∏ cos(
i=1 i
a posteriori & a priori residual
38
19
32
Least
Residual Squares
extraction (v1.1)&: RLS Estimation
u[k]
u(1) u[k-1]
u(2) u[k-2]
u(3) u[k-3]
u(4) d[k]
d 1
0 rotation cell
R11 R12 R13 R14 z11 a a’
0 0 b b’
R22 R23 R24 z21
0 0
memory cell
R33 R34 z31
(delay)
0 0
R44 z41
0
ε cos
L+1 !N
ddkk+1
−u T
−kuw
T ⋅∏
w[k](k=+ε1) =!· cos( θ i )i)
cos(θ
LS
k+1 LS i=1 output1
i=1
39
far-end signal
Example
Acoustic Echo Cancellation
u[k] u[k-1] u[k-2] u[k-3]
near-end signal
+ residual echo
d
1
0
0 0
0 0
0 0
40
20