Neuro-Fyzzy Methods for Modeling and Identification Part 2 : Examples

40
Neuro-Fyzzy Methods for Modeling and Identification Part 2 : Examples Presented by: Ali Maleki

description

Neuro-Fyzzy Methods for Modeling and Identification Part 2 : Examples. Presented by: Ali Maleki. Presentation Agenda. Introduction Tools for Fuzzy Identification and Modelling MATLAB – Fuzzy Logic Toolbox – ANFIS Fuzzy Modeling and Identification Toolbox Examples : - PowerPoint PPT Presentation

Transcript of Neuro-Fyzzy Methods for Modeling and Identification Part 2 : Examples

Page 1: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Neuro-Fyzzy Methods

for

Modeling and Identification

Part 2 : ExamplesPresented by:Ali Maleki

Page 2: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Presentation Agenda

Introduction Tools for Fuzzy Identification and Modelling MATLAB – Fuzzy Logic Toolbox – ANFIS Fuzzy Modeling and Identification Toolbox Examples :

Example 1: Hair DryerExample 2: Static FunctionExample 3: Neutralization Process

Page 3: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Introduction Control Systems

CompetionEnvironment requirementsEnergy and material costsDemand for robust, fault-tolerant systems

Extra needs for Effective process modeling techniques

Conventional modeling?

Lack precise and formal knowledg about the system

Strongly nonlinear behavior,High degree of uncertainty,Time varying characteristics

Page 4: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Introduction (cont.) Solution: Neuro-fuzzy modeling

A powerful tool which can facilitate the effective development of models by combining information from different source:

Empirical modelsHeuristicsData

Neuro-fuzzy modelsDescribe systems by means of fuzzy if-then rulesRepresented in a network structureApply algorithms from the area of Neural Networks

Page 5: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Zero-order TS fuzzy model

Typical membership function

Input-output equation

Introduction (cont.)

Page 6: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Introduction (cont.)System identification steps:

• Structure identification• Parameter estimation

• choice of the model’s structure determines the flexibility of the model in the approximation of (unknown) systems

• model with a rich structure can approximate more complicated functions, but, will have worse generalization properties

• Good generalization means that a model fitted to one data set will also perform well on another data set from the same process.

Page 7: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Tools for Fuzzy Modeling & Identification

Fuzzy Modelling and Identification Toolbox

• Develped by R. Babuska• http://Lcewww.et.tudelft.nl/~Babuska• Installation• Version 3.03 , April 2001

Fuzzy Logic Toolbox for MATLAB

• www.Mathworks.com/products/fuzzylogic • Version 2.1.3 , June 2004

Page 8: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Fuzzy Modeling and Identification Toolbox

Page 9: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Fuzzy Modeling and Identification Toolbox (cont.)

Page 10: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

FMSIM function:

Simulate a MIMO input-output fuzzy model

Fuzzy Modeling and Identification Toolbox (cont.)

Page 11: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Structure of FM (fmstruct function):

Fuzzy Modeling and Identification Toolbox (cont.)

Page 12: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Structure of FM (fmstruct function):

Fuzzy Modeling and Identification Toolbox (cont.)

Page 13: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

plotmfs function:Plot membership functions

rms function:Root mean square between two signals

vaf function:Percentile variance accounted for (VAF) between two

signals

Fuzzy Modeling and Identification Toolbox (cont.)

Page 14: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

MATLAB - Fuzzy Toolbox

anfis function:Training routine for Sugeno-type FIS

anfisedit function:Open the ANFIS Editor GUI

genfis1 function:Generate an FIS structure from data without data

clustering

genfis2 function:Generate an FIS structure from data using subtractive

clustering

Page 15: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

MATLAB - Fuzzy Toolbox (cont.)

ANFIS Editor GUI

Page 16: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Example 1 : Hair Dryer (Fuzzy Logic Toolbox)

Nonlinear dynamical system identificationWith use of ANFIS function in the Fuzzy Logic ToolboxData set was obtained from a laboratory device called Feedback's Process Trainer PT 326,L. Ljung, "System Identification, Theory for the User", Prentice-Hall, 1987 – Chapter 17The device's function is like a hair dryer:

Input u(k) : Voltage over the mesh of resistor wiresOutput y(k) : Outlet air temperature

Page 17: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Input u(k) : Binary random signal shifting between 3.41 and 6.41 V Output y(k) : Outlet air temperatureSampling Time : 0.08 sec

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 18: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Linear ARX model:

y(k)+a1*y(k-1)+...+am*y(k-m)=b1*u(k-d)+...+bn*u(k-d-n+1)

ai and bj are linear parameters to be determined by least-squares methodsThis structure is exactly specified by three integers [m, n, d]

Remind: System Identification : structure selection + parameter estimation

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 19: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Remove the means from the data

The data set was divided into a training set and a checking setTraining data set : (k = 1 to 300) Checking data set : (k = 301 to 600)

An exhaustive search was performed to find the best combination [m, n, d]each of the integer is allowed to changed from 1 to 10 independently

Run through all different models: V = arxstruc(ze, zv, struc(1:10, 1:10, 1:10));

Find the best model: nn = selstruc(V, 0);

The best ARX model : [m, n, d] = [5, 10, 2]

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 20: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Training RMSE = 0.1122 Checking RMSE = 0.0749

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 21: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Advantage of ARX model:Rapid model structure selectionRapid parameter identification

The performance in the above plots appear to be satisfactory.

If a better performance level is desired, we might want to resort to a nonlinear model.

Neuro-fuzzy modeling approach, ANFIS

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 22: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Use ANFIS for system identification:

First step: input selectionTo determine which variables should be the input arguments to an ANFIS model.For simplicity, we suppose that there are 10 input candidates

y(k-1), y(k-2), y(k-3), y(k-4), u(k-1), u(k-2), u(k-3), u(k-4), u(k-5), u(k-6)

Two approaches for input selection:Sequential searchExhaustive search

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 23: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Sequential search for input selection: can be done by the function seqsrch

10 + 9 + 8=27

Selected inputs : y(k-1), u(k-3), and u(k-4)Training RMSE = 0.0609 Checking RMSE = 0.0604.

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 24: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Exhaustive search on all possible combinations of the input candidatesCan be done by function exhsrch We want to selects 3 inputs from 10 candidates, therefore, the total number of ANFIS models is

Fortunately, for dynamical system identification, we do know that the inputs should not come from either of the following two sets of input candidates exclusively:Y = {y(k-1), y(k-2), y(k-3), y(k-4)}

U = {u(k-1), u(k-2), u(k-3), u(k-4), u(k-5), u(k-6)}

A reasonable guess: two inputs from Y and one from U

120

7!3!

10!

366*

22

4

!!

!

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 25: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Exhaustive search

Selected inputs : y(k-1), y(k-2) , u(k-3)Training RMSE = 0.0474 Checking RMSE = 0.0485

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 26: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

ARX model

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 27: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

ANFIS model

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 28: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Comparision

If fast modeling is the goal, then ARX is the right choice,If precision is the utmost concern, then we can go for ANFIS that is designed for nonlinear modeling and higher precision

Example 1 : Hair Dryer (Fuzzy Logic Toolbox) (cont.)

Page 29: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Example 2 - Static Function

ANFIS model with linear consequent functionNumber of rules: five rulesConstruction of initial model:

Gustafson-Kessel algorithm

Fit of the function with initial model – local models - membership functions

Page 30: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Example 2 - Static Function (cont.)

this initial model can easily be interpreted in terms of the local behavior

It is reasonably accurate (RMS= 0.0258)

ANFIS method, 100 learning epochsanfis function of the MATLAB Fuzzy Logic Toolbox

Fit of the function with fine-tuned model, local models, membership functions

Page 31: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

RMS error is about 23 times better than the initial model

Initial model Fine-tuned modelRMS error = 0.0258 RMS error =

0.0011

Example 2 - Static Function (cont.)

Page 32: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

after learning, the local models are much further from the true local description of the function

Initial model Fine-tuned model

Fine-tuned model are thus less accurate in describing the system locally

Example 2 - Static Function (cont.)

Page 33: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Example 3 – pH Neutralization Process

Neutralization tank Effluent stream

Acid Buffer Base

Influent streams

Neutralization tank pH in the tank

Acid flowrate = cteBuffer flowrate = cteBase stream flowrate

Page 34: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Example 3 - pH Neutralization Process (cont.)

Identification and validation data sets:• Simulating the model by Hall and Seborg for random change of

the influent base stream flow rate• N = 499 samples with the sampling time of 15 s.

The process is approximated as a first–order discrete-time NARX model

Page 35: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Membership functions

Befor training After training

Example 3 - pH Neutralization Process (cont.)

Page 36: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Rules: Initial Rules:

Fine Tuned Rules: after 1000 epochs of hybrid learning using the ANFIS function of the MATLAB Fuzzy Logic Toolbox

Example 3 - pH Neutralization Process (cont.)

Page 37: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Overtraining Problem: • Comparision of RMS ERROR befor and after training

• Prediction befor and after training

Example 3 - pH Neutralization Process (cont.)

Page 38: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

References

[1] Robert Babuska, “Neuro-Fuzzy Methods for Modeling and Identification”, Recent Advances in Intelligent Paradigms and Application, Springer-Verilag, 2002

[2] Robert Babuska, “Fuzzy Modeling and Identification Toolbox User’s Guide - For Use with MATLAB”, 1998.

[3] MathWorks Inc., “Fuzzy Logic Toolbox – Users Guide – Version 2”, 2004.

[4] L. Ljung, “System Identification, Theory for the User”, Prentice-Hall, 1987.

Page 39: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

THANK YOU VERY MUCH

For your

Attention

Presented by:Ali Maleki

Page 40: Neuro-Fyzzy  Methods for  Modeling and Identification Part 2 : Examples

Introduction - appendix

Types of fuzzy models: (depending on the structure of if-then rules)

Mamdani Model

IF D1 is low and D2 is high THEN D is medium

Takagi-Sugeno Model

IF D1 is low and D2 is high THEN D=k (zero-order)

IF D1 is low and D2 is high THEN D=0.7D1+0.2D2+0.1 (first-order)