chapter 11: recurrent neuro fuzzy systemsfuzzy.cs.ovgu.de/wiki/uploads/lehre.nn2009/nn-07.pdfchapter...
TRANSCRIPT
SNFEURO
UZZYProf. Dr. Rudolf Kruse 1
Chapter 11:Recurrent Neuro Fuzzy Systems
SNFEURO
UZZYProf. Dr. Rudolf Kruse 2
Neuro-fuzzy models are usually used if
Vague knowledge can be included into the solution(i.e. we know something about our data or a possible solution)
The solution should be interpretable in form of rules(i.e. we want to learn something about our data/problem)
From an applicational point of view the solution should be easy to implement, to use and to understand.
Interpretation is more important than performance
Motivation
SNFEURO
UZZYProf. Dr. Rudolf Kruse 3
Conventional (feedforward) neuro-fuzzy models less appropriate for control / analysis of higher order dynamic systems or time series data:
obtained systems usually very complex (i.e. number of inputs and rules very high) obtained systems are usually hard to interpretperformance decreasesinitialization by use of linguistic rules usually impossible
Motivation
SNFEURO
UZZYProf. Dr. Rudolf Kruse 4
Recurrent Neural Networks
Backward connections are used to model time delayed feedback(‚information of the past‘)
Mathematical complexity increases: RCNN‘s are universal approximators and can be used to model systems of higher order ordinary differential equations [Funashi/Nakamura, 1993]
Different architectures have been proposed, e.g.:
Hopfield networks [Hopfield, 1982]
Partially recurrent networks (e.g. recurrent multilayer perceptron[Puskorius/Feldkamp, 1994])
Fully recurrent networks
SNFEURO
UZZYProf. Dr. Rudolf Kruse 5
Recurrent Neural Networks (Examples)
∑ Δ−+Δ−==i
jijijj ttextwttoftnetfto ))()(())(()(
∑ ++−=i
jijijj extwofo
dtdo
)(
(difference equation)
(differential equation)
SNFEURO
UZZYProf. Dr. Rudolf Kruse 6
Recurrent Neural Networks
Basic learning methods:
Backpropagation through time [Rumelhart et al., 1986]
Real time recurrent learning [Williams and Zipser, 1989]
o1
o2
w12 w21
w11
w22
o1(0) w11(1)
o2(0)
o1(1)
o2(1)w22(1)
w12(1)
w21(1)
w11(t)
o1(t)
o2(t)w22(t)
w12(t)
w21(t)
o2(t-1)
o1(t-1)
0 1 t-1 t time
SNFEURO
UZZYProf. Dr. Rudolf Kruse 7
Fuzzy System (hierarchical)
u
yx
R1 R2 R3
large
z
R4
Input variables: x, y Output variables: z Inner variables: u R1: If x is large then u is small R2: If x is small and y is large then u is zero R3: If y is small then u is large R4: If u is large then z is small R5: If u is small and y is large then z is zero R6: If y is small then z is large
R5 R6
small
large small
large zero small
large small
large small
large zero small
Subsystem z
Subsystem u
SNFEURO
UZZYProf. Dr. Rudolf Kruse 8
Fuzzy System (hierarchical and recurrent)
u
yx
R1 R2 R3
large
z
R4
Input variables: x, y Output variables: z Inner variables: u R1: If x(t) is large and z(t-1) is large then u(t) is small R2: If x(t) is small and y(t) is large then u(t) is zero R3: If y(t) is small then u(t) is large R4: If z(t-1) is large then z(t) is small R5: If u(t) is small and y(t) is large then z(t) is zero R6: If y(t) is small then z(t) is large
R5 R6
small
large small
large zero small
large small
large small
large zero small
Subsystem z
Subsystem u
z-1
small
SNFEURO
UZZYProf. Dr. Rudolf Kruse 9
Fuzzy System (recurrent)
A recurrent fuzzy system of the formRr : If y (t-1) is μr then y (t) is νr
can be used to approximate an initial value problem of the form),(yfy =& cty =)( 0
)()()(1 iiiiii ySyghyyftyy =⋅+=⋅Δ+=+
),(yfty=
ΔΔ cty =)( 0
(difference quotient)
),(1 iii yftyy ⋅Δ+=+ cy =0 (iterative solution)
)()( iii yghyyS ⋅+= (S defined by fuzzy system)
SNFEURO
UZZYProf. Dr. Rudolf Kruse 10
Recurrent Fuzzy Systems (First order)
A first order recurrent fuzzy system consist of rules of the form:
If x(t-1) is A and y (t-1) is B’ then y (t) is B
RCFSrulebase
x(t-1)y(t)
z-1
y(t-1)
System state diagram
If y(t-1) is negative and x(t-1) is negative then y(t) is negativeIf y(t-1) is negative and x(t-1) is zero then y(t) is negativeIf y(t-1) is negative and x(t-1) is positive then y(t) is zeroIf y(t-1) is zero and x(t-1) is negative then y(t) is negativeIf y(t-1) is zero and x(t-1) is zero then y(t) is zeroIf y(t-1) is zero and x(t-1) is positive then y(t) is positiveIf y(t-1) is positive and x(t-1) is negative then y(t) is zeroIf y(t-1) is positive and x(t-1) is zero then y(t) is positiveIf y(t-1) is positive and x(t-1) is positive then y(t) is positive
Rule base of a simple limited integrator
SNFEURO
UZZYProf. Dr. Rudolf Kruse 11
Recurrent Fuzzy Systems (Higher order example)
Using rules of the formIf x(t-1) is Ai and s(t-1) is Ci then s(t) is Ci’If y(t-1) is Bi and s(t-1) is Ci then y(t) is Bi’
we obtain the following system: x(t-1)
s(t)z-1
s(t-1)
y(t)
z-1
y(t-1)
s(t-1)
So, we are able to define the following functions:)),(),(()( 11 −−= ii txtsfts ))(),(()( 11 −−= ii tstyfty
These functions may be used to compute a system of two first order differential equations.
SNFEURO
UZZYProf. Dr. Rudolf Kruse 12
A Hierarchical Hybrid Model
∏
∑
∏ ∏
…
ν1(1)
… …
…
∑
…
x1 xn
y1 yk
∑
xj
yj
νl(j)
…
νk(n)
z-1
)1(1μ
)1(1nμ
…
… )(1
jμ )( jn j
μ … )(1
nμ )(nnn
μ
∑…
yn
∏…
based on recurrent hierarchical fuzzy system
heuristics and GA applied for rule base learning
optimization using gradient descent considering time delayed feed back
interpretability enforced by:
coupled fuzzy sets
constraints
SNFEURO
UZZYProf. Dr. Rudolf Kruse 13
A Hierarchical Hybrid Model (optimization)
∑ ∑∑==
==T
t kk
T
t
tEtEE0
2
0
))((21)(
⎪⎩
⎪⎨⎧ −=
otherwise.0 ,given is at time node
for output theif)()()( tkotytotE
kkk
k
∑ ∂∂
−=∂
∂
k
kk p
tytEptE )()()(
∑
∑
∈
∈
∂∂
∂∂
+∂∂
=
∂∂
∂∂
+∂
∂∂∂
=∂
∂
)(:
)(:
)(
)(
)()()(
)()(
)()()()(
)()()(
rConr
r
r
k
p
k
rConr
r
r
k
p
kk
krl
krl
pta
taty
pfty
pta
taty
ppf
pfty
pty
ν
ν
Learning method minimizes error:
Gradient for parameter p:
∑
∑
∈
∈
∂∂
∂∂
+∂∂
=
∂∂
∂∂
+∂
∂∂∂
=∂
∂
)(:
)(:
)(
)(
)()()(
)()(
)()()()(
)()()(
rAnti
i
i
r
p
r
rAnti
i
i
r
p
rr
i
rj
i
rj
ptx
txta
pfta
ptx
txta
ppf
pfta
pta
μ
μ
with
with
SNFEURO
UZZYProf. Dr. Rudolf Kruse 14
A Hierarchical Hybrid Model (optimization)
Finally we obtain:
∑ ∑∈ ∈ ⎥
⎥
⎦
⎤
⎢⎢
⎣
⎡
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
∂∂
∂∂
+∂∂
⋅∂∂
+∂∂
=∂
∂
)(: )(:)( )(
)()()(
)()(
)()(
)()()(
rConr rAnti
i
i
r
p
r
r
k
p
kk
krl
i
rjptx
txta
pfta
taty
pfty
pty
ν μ
where
⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪
⎨
⎧
∂∂∂
∂∂
−∂
−∂
∂∂
−∂∂
∂∂
∂
=∂
∂
input. externalan )(
if0
feedback, local a )(
if)1(
),1(feedback delayed timea )(
if)1(
),(feedback alhierarchic a )(
if)(
)(
ptx
ptx
ptx
typtx
pty
typtx
pty
ptx
i
ij
jij
jij
i
SNFEURO
UZZYProf. Dr. Rudolf Kruse 15
A Hierarchical Hybrid Model (optimization)
Updating parameter:
Time complexity: O( (#variables)4 · (#fuzzy sets)3 · (#rules) )Memory complexity: O( (#variables)2 · (#fuzzy sets) )
Online learning: )1()()1()()1( −Δ⋅+Δ⋅−+=+ tptptptp ββ , with
∑ ∂∂
=∂
∂−=Δ
k
kkpp p
tytEptEtp )()()()( ηη
Batch learning: ∑∑=
−
=
+ Δ⋅+Δ⋅−+=T
t
nT
t
nnn tptppp1
)1(
1
)()()1( )()()1()0()0( ββ
∑ ∂∂
=∂
∂−=Δ
k
kkpp
n
ptytE
ptEtp )()()()()( ηη
SNFEURO
UZZYProf. Dr. Rudolf Kruse 16
Rule Base Learning
Learning a hierarchically structured rule base of localsubsystems
Here: Domains are partitioned
Use of rule templates to define subsystems, e.g.:
Two learning methods:
Heuristics: Iterative creation of rules
Genetic Algorithm
IF (x[t-1] LIKE ‘*S1') AND (v[t-1] LIKE '*S1') THEN (x[t] LIKE '*S0') IF (y[t] LIKE '*') AND (v[t-1] LIKE '*S2') THEN (v[t] LIKE '*S0').
SNFEURO
UZZYProf. Dr. Rudolf Kruse 17
Rule Base Learning
Heuristics:Two learning parts:
Rule base learning (iterative creation of rules)Re-assigning consequents
Genetic Algorithm: IF (x[t-1] IS neg2 AND v[t-1] IS neg1) THEN x IS neg0IF (x[t-1] IS neg2 AND v[t-1] IS zero1) THEN x IS neg0IF (x[t-1] IS neg2 AND v[t-1] IS pos1) THEN x IS zero0IF (x[t-1] IS zero2 AND v[t-1] IS neg1) THEN x IS neg0IF (x[t-1] IS zero2 AND v[t-1] IS zero1) THEN x IS zero0IF (x[t-1] IS zero2 AND v[t-1] IS pos1) THEN x IS pos0IF (x[t-1] IS pos2 AND v[t-1] IS neg1) THEN x IS zero0IF (x[t-1] IS pos2 AND v[t-1] IS zero1) THEN x IS pos0IF (x[t-1] IS pos2 AND v[t-1] IS pos1) THEN x IS pos0
IF (x[t-1] IS neg1 AND v[t-1] IS neg2) THEN v IS zero0IF (x[t-1] IS neg1 AND v[t-1] IS zero2) THEN v IS pos0IF (x[t-1] IS neg1 AND v[t-1] IS pos2) THEN v IS pos0IF (x[t-1] IS zero1 AND v[t-1] IS neg2) THEN v IS neg0IF (x[t-1] IS zero1 AND v[t-1] IS zero2) THEN v IS zero0IF (x[t-1] IS zero1 AND v[t-1] IS pos2) THEN v IS pos0IF (x[t-1] IS pos1 AND v[t-1] IS neg2) THEN v IS neg0IF (x[t-1] IS pos1 AND v[t-1] IS zero2) THEN v IS neg0IF (x[t-1] IS pos1 AND v[t-1] IS pos2) THEN v IS zero0
Sub system
1
Ordered Rule Base
Sub system
2
112123133233123112
Chromosome
Assume full rule baseEach Chromosome encodes complete rule base (Pittsburgh approach)
SNFEURO
UZZYProf. Dr. Rudolf Kruse 18
Software Implementation
SNFEURO
UZZYProf. Dr. Rudolf Kruse 19
A Simple Physical System: Mass On a Spring
With the physical laws
xmamF &&⋅=⋅= (Newton’s second law)
xclcF ⋅−=Δ⋅−= (Hooke’s law)
we can describe the system by a second order differential equation
xmcx −=&& 0)0()0(,)0( 0 === xvxx &, with
or by a system of two first order differential equations
vx =& .xmcv −=&and
SNFEURO
UZZYProf. Dr. Rudolf Kruse 20
Application Example (Spring-mass model)
Initial partitioning:
(FS’s: neg0, neg1, neg2, zero0, zero1, zero2,pos0, pos1, pos2)
Initial rules (not covered by simulation):Rule 1: IF (x@t-1 IS zero2 AND v@t-1 IS zero1) THEN x IS zero0Rule 2: IF (x@t-1 IS zero1 AND v@t-1 IS zero2) THEN v IS zero0
Training data: Simulation of the modell for a period of 20 sec.
Templates used for rule base learning:IF (x[t-1] LIKE '*2') AND (v[t-1] LIKE '*1') THEN (x[t-0] LIKE '*0') IF (x[t-1] LIKE '*1') AND (v[t-1] LIKE '*2') THEN (v[t-0] LIKE '*0')
SNFEURO
UZZYProf. Dr. Rudolf Kruse 21
Application Example (Spring-mass model)
-6.5
-4.5
-2.5
-0.5
1.5
3.5
5.5
0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190
v train v (x given) v (v given) v (x and v given)
0
200
400
600
800
1000
1200
1400
1600
1800
2000
0 500 1000 1500 2000 2500 3000 3500 4000
cycle
x and v given
-8
-6
-4
-2
0
2
4
6
8
-1.5 -1 -0.5 0 0.5 1 1.5
x
v
training data(Runge-Kutta)
initial rule base
x given
v given
x and v given
SNFEURO
UZZYProf. Dr. Rudolf Kruse 22
Application Example (Spring-mass model)
Rule 9: IF (x[t-1] IS neg2 AND v[t-1] IS neg1) THEN x IS neg0Rule 11: IF (x[t-1] IS neg2 AND v[t-1] IS zero1) THEN x IS neg0Rule 13: IF (x[t-1] IS neg2 AND v[t-1] IS pos1) THEN x IS zero0Rule 7: IF (x[t-1] IS zero2 AND v[t-1] IS neg1) THEN x IS neg0Rule 1: IF (x[t-1] IS zero2 AND v[t-1] IS zero1) THEN x IS zero0Rule 15: IF (x[t-1] IS zero2 AND v[t-1] IS pos1) THEN x IS pos0Rule 5: IF (x[t-1] IS pos2 AND v[t-1] IS neg1) THEN x IS zero0Rule 3: IF (x[t-1] IS pos2 AND v[t-1] IS zero1) THEN x IS pos0Rule 17: IF (x[t-1] IS pos2 AND v[t-1] IS pos1) THEN x IS pos0
Rule 10: IF (x[t-1] IS neg1 AND v[t-1] IS neg2) THEN v IS zero0Rule 12: IF (x[t-1] IS neg1 AND v[t-1] IS zero2) THEN v IS pos0Rule 14: IF (x[t-1] IS neg1 AND v[t-1] IS pos2) THEN v IS pos0Rule 8: IF (x[t-1] IS zero1 AND v[t-1] IS neg2) THEN v IS neg0Rule 2: IF (x[t-1] IS zero1 AND v[t-1] IS zero2) THEN v IS zero0Rule 16: IF (x[t-1] IS zero1 AND v[t-1] IS pos2) THEN v IS pos0Rule 6: IF (x[t-1] IS pos1 AND v[t-1] IS neg2) THEN v IS neg0Rule 4: IF (x[t-1] IS pos1 AND v[t-1] IS zero2) THEN v IS neg0Rule 18: IF (x[t-1] IS pos1 AND v[t-1] IS pos2) THEN v IS zero0
)()()( 11 −− ⋅Δ+= iii tvttxtx )()()( 11 −− ⋅Δ−= iii txtmctvtv
SNFEURO
UZZYProf. Dr. Rudolf Kruse 23
Recurrent Neuro-Fuzzy Systems (Cooperative approach)
Motivation/Problem: Modeling, identification and simulation of viscoelastic models in virtual reality applications
Existing approaches: Model creation usually expensive, cannot be optimized by measured data
Idea: Support developer with a generic framework for model creation and definition / optimization of its parameters:
Enable use of standard 3D models (triangular meshes)
Fuzzy system for interactive definition of model parametersand initialization of the learning process
Recurrent neural network architecture for simulation and model optimization if measured data is available
Cooperative neuro-fuzzy architecture
SNFEURO
UZZYProf. Dr. Rudolf Kruse 24
RCNN describing viscoelastic models
ai vi pi
fj
sj
cj ak vk pk
+1
-1
)1()())(()( −+== tototttenfto pvcpppϖϖϖϖϖ
)1()())(()( −+== tototttenfto vacvvvϖϖϖϖϖ
))()(())(()(1
texttowwttenfto ffi
imaaa +== ∑ ϖϖϖϖ
)()())(()( tostocttenfto scccfffϖϖϖϖϖ +==
))()(())(()(21
totofttenfto ppssssϖϖϖϖϖϖ −==
))()(())(()(21
totofttenfto vvccccϖϖϖϖϖϖ −==
node node
viscosity
spring constantmass mass
xmamF &&⋅=⋅=ldlcF ⋅−Δ⋅=
SNFEURO
UZZYProf. Dr. Rudolf Kruse 25
Parameter determination (Learning considerations)
Requirements:Learning by use of time series data (node positions)Changing external forces Missing data for (inner) nodesMissing data for „intermediate“ time steps
Problems:Large number of time steps between attractorsGreat time delay between weight modification and effect on positionsMissing data
Combination of BPTT and RTRL with teacher forcing
SNFEURO
UZZYProf. Dr. Rudolf Kruse 26
Parameter determination (Initialization)
Initialization by „real“ physical parameters
Initialization by use of a fuzzy system:Fuzzy system describes the relations between vague knowledge of the object and the network parameters
Some fuzzy rules for the description of tissue
if hardness is soft and elasticity is bigthen spring constant is low
if shiftability is high then spring constant is very low and
viscosity is highif consistency is chapped
then fraction force is low andspring constant is very high
if consistency is slightly hardthen spring constant is slightly high and
viscosity is low
SNFEURO
UZZYProf. Dr. Rudolf Kruse 27
Parameter determination (Initialization)
Screenshot of the tool 'Elastodynamic Shape Modeler'
SNFEURO
UZZYProf. Dr. Rudolf Kruse 28
SUSILAP-G(SUrgical SImulator for LAParoscopy in Gynaecology)
SNFEURO
UZZYProf. Dr. Rudolf Kruse 29
Conclusions
Recurrent fuzzy systems can be used to approximate dynamic systems
Proposed recurrent neuro-fuzzy system can be used to:
optimize recurrent and/or hierarchical fuzzy systems
learn rule base by use of rule templates
Constraints must be used more carefully than in feed-forward systems