CLASE 19
15 de abril de 2004
ANFIS STRUCTURE
The adaptive network-based fuzzy inference systems (ANFIS) is used to solve
problems related to parameter identification. This parameter identification is
done through a hybrid learning rule combining the back-propagation gradient
descent and a least-squares method.
ANFIS is basically a graphical network representation of Sugeno-type fuzzy
systems endowed with the neural learning capabilities. The network is
comprised of nodes with specific functions collected in layers. ANFIS is able
to construct a network realization of IF / THEN rules.
Consider a Sugeno type of fuzzy system having the rule base
1. If x is A1 and y is B1, then f1 = c11x+c12y+c10
2. If x is A2 and y is B2, then f2 = c21x+c22y+c20
Let the membership functions of fuzzy sets Ai, Bi, i=1,2, be , Ai Bi.
In evaluating the rules, choose product for T-norm (logical and).
1. Evaluating the rule premises results in
2. Evaluating the implication and the rule consequences gives
Or leaving the arguments out
This can be separated to phases by first defining
Then f can be written as
All computations can be presented in a diagram form. ANFIS normally has 5
layers of neurons of which neurons in the same layer are of the same function
family.
Figure 1: Structure of the ANFIS network.
Figure 2: ANFIS Architecture
Layer 1 (L1): Each node generates the membership grades of a linguistic
label.
An example of a membership function is the generalised bell
function:
where {a, b, c} is the parameter set. As the values of the
parameters change, the shape of the bell-shaped function
varies. Parameters in that layer are called premise parameters.
Layer 2 (L2): Each node calculates the firing strength of each rule using the
min or prod operator. In general, any other fuzzy AND
operation can be used.
Layer 3 (L3): The nodes calculate the ratios of the rules firing strength to the
sum of all the rules firing strength. The result is a normalised
firing strength.
Layer 4 (L4): The nodes compute a parameter function on the layer 3 output.
Parameters in this layer are called consequent parameters.
Layer 5 (L5): Normally a single node that aggregates the overall outputas the
summation of all incoming signals
The ANFIS learning algorithm
When the premise parameters are fixed, the overall output is a linear
combination of the consequent parameters. In symbols, the output f can be
written as
f w1 x c11 w1 y c12 w1c10 w2 x c21 w2 y c22 w2 c20
which is linear in the consequent parameters cij (i = 1,2 j = 0,1,2). A hybrid
algorithm adjusts the consequent parameters cij in a forward pass and the
premise parameters {ai, bi, ci} in a backward pass (Jang et al., 1997). In the
forward pass the network inputs propagate forward until layer 4, where the
consequent parameters are identified by the least-squares method. In the
backward pass, the error signals propagate backwards and the premise
parameters are updated by gradient descent.
Because the update rules for the premise and consequent parameters are
decoupled in the hybrid learning rule, a computational speedup may be
possible by using variants of the gradient method or other optimisation
techniques on the premise parameters.
MATLAB GENFIS1 AND ANFIS COMMANDS
In Fuzzy Control Toolbox a useful command called anfis exists. This provides
an optimization scheme to find the parameters in the fuzzy system that best fit
the data. It is explained in the Toolbox manual that since most (not all)
optimization algorithms require computation of the gradient, this is done with
a neural network. Then, in principle, any of the optimization schemes, say
those in the MATLAB Optimization Toolbox, can be used.
It is not clear at the beginning, what the initial fuzzy system should be, that is,
the type and number of membership functions, command genfis1 may be
used. This command will go over the data in a crude way and find a good
starting system (See genfis1_use.m).
EXAMPLE 1.
Consider fitting a fuzzy system on a nonlinear function on [-1,1] consisting of
sum of three sinusoidal functions
SOLUTION: EXAMPLE1.m
EXERCISE 1.
Let y = f(x) = -2x - x2.
a) Form a fuzzy system, which approximates function f, when x [10 ,10].
Repeat the same by adding random, normally distributed noise with zero
mean and unit variance.
b) Simulate the output when the input is sin(t). Observe what happens to the
signal shape at the output.
SOLUTION: EXERCISE1.m
EXERCISE 2.
Study how the nonlinearity modeled with the fuzzy system fismat1 distorts a
sinusoidal signal. Assume sin(t) at the input.
Remark: Clearly higher order harmonics are generated. Such phenomenon can
be observed e.g. in electrical transformers.
SOLUTION: EXERCISE2.mdl
EXERCISE 3.
Simulate the system
with different initial conditions. Here f(x) = -2x - x2 as before. Start with x(0) =
-0.2 and (dx/dt)(0) = 0.5.
Study both the exact relationship and the fuzzy approximation determined in
the previous example. Are there any differences?
SOURCES
Heikki Koivo, ANFIS (Adaptive Neuro-Fuzzy Inference System). 2000
Jan Jantzen, Neurofuzzy Modelling. Technical University of Denmark,
Department of Automation, Bldg 326, DK-2800 Lyngby, DENMARK.
Tech. report no 98-H-874 (nfmod), 30 Oct 1998.