52
Negnevitsky, Pearson Education, 2005 1 Lecture Lecture 10 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks Evolutionary neural networks Fuzzy evolutionary systems Fuzzy evolutionary systems Summary Summary brid intelligent systems: brid intelligent systems:

© Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

Embed Size (px)

Citation preview

Page 1: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 1

Lecture 10Lecture 10

IntroductionIntroduction

Neural expert systemsNeural expert systems

Evolutionary neural networksEvolutionary neural networks

Fuzzy evolutionary systemsFuzzy evolutionary systems

SummarySummary

Hybrid intelligent systems:Hybrid intelligent systems:

Page 2: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 2

IntroductionIntroduction A A hybrid intelligent system hybrid intelligent system is one that combinesis one that combines at at

least two intelligent technologies. For example, least two intelligent technologies. For example, combining a fuzzy systemcombining a fuzzy system with evolutionary with evolutionary computation.computation.

The combination of probabilistic reasoning, fuzzyThe combination of probabilistic reasoning, fuzzy logic, neural networks and evolutionarylogic, neural networks and evolutionary computation computation forms the core of forms the core of soft computingsoft computing, an, an emerging emerging approach to building hybrid intelligentapproach to building hybrid intelligent systems capable systems capable of reasoning and learning in anof reasoning and learning in an uncertain and imprecise uncertain and imprecise environment. environment. One character of One character of softsoft computing is the computing is the using of words but not numbers in systemsusing of words but not numbers in systems..

Page 3: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 3

Although words are less precise than numbers, Although words are less precise than numbers, precision carries a high cost. We use wordsprecision carries a high cost. We use words when there is a tolerance for imprecision. Softwhen there is a tolerance for imprecision. Soft computing exploits the tolerance for uncertaintycomputing exploits the tolerance for uncertainty and imprecision to achieve greater tractabilityand imprecision to achieve greater tractability and and robustness, and lower the cost of solutions.robustness, and lower the cost of solutions.

We also use words when the available data isWe also use words when the available data is not precise enough to use numbers. This isnot precise enough to use numbers. This is often the case with complex problems, andoften the case with complex problems, and while “hard” computing fails to produce anywhile “hard” computing fails to produce any solution, soft computing is still capable ofsolution, soft computing is still capable of finding good solutions.finding good solutions.

Page 4: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 4

Lotfi ZadehLotfi Zadeh is reputed to have said that a goodis reputed to have said that a good hybrid would be “British Police, Germanhybrid would be “British Police, German Mechanics, French Cuisine, Swiss Mechanics, French Cuisine, Swiss Banking andBanking and Italian Love”. But Italian Love”. But “British Cuisine, German“British Cuisine, German Police, Police, French Mechanics, Italian Banking andFrench Mechanics, Italian Banking and Swiss Love” would be a bad one. Likewise, Swiss Love” would be a bad one. Likewise, aa hybrid intelligent system can be hybrid intelligent system can be good or bad good or bad – it– it depends on which depends on which components constitute thecomponents constitute the hybrid. hybrid. So our goal is to So our goal is to select the rightselect the right components for building a good hybrid system.components for building a good hybrid system.

Page 5: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 5

Comparison of Expert Systems, FuzzyComparison of Expert Systems, Fuzzy Systems, Systems, Neural Networks and Genetic AlgorithmsNeural Networks and Genetic Algorithms

Knowledge representation

Uncertaintytolerance

Imprecisiontolerance

Adaptability

Learningability

Explanationability

Knowledge discovery and data mining

Maintainability

ES FS NN GA

* The terms used for grading are:

- bad, - ratherbad, - good- rather good and

Page 6: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 6

Let’s compare neural networks with expert systems:Let’s compare neural networks with expert systems:

• Expert systems rely on logical inferences andExpert systems rely on logical inferences and decision trees and focus on modelling humandecision trees and focus on modelling human reasoning. Neural networks rely on parallel datareasoning. Neural networks rely on parallel data processing and focus on modelling a human brain.processing and focus on modelling a human brain.

• Expert systems treat the brain as a black-box. Expert systems treat the brain as a black-box. Neural networks look at its structure and functions, Neural networks look at its structure and functions, particularly at its ability to learn.particularly at its ability to learn.

• Knowledge in a rule-based expert system isKnowledge in a rule-based expert system is represented by IF-THEN production rules. represented by IF-THEN production rules. Knowledge in neural networks is stored asKnowledge in neural networks is stored as synaptic weights between neurons.synaptic weights between neurons.

Neural expert systemsNeural expert systems

Page 7: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 7

• In expert systems, knowledge can be divided intoIn expert systems, knowledge can be divided into individual rules and the user can see andindividual rules and the user can see and understand the piece of knowledge understand the piece of knowledge applied by theapplied by the system. system.

• In neural networks, one cannot select a singleIn neural networks, one cannot select a single synaptic weight as a discrete piece of synaptic weight as a discrete piece of knowledge. knowledge. Here knowledge is Here knowledge is embedded in the entireembedded in the entire network; it network; it cannot be broken into individualcannot be broken into individual pieces, and any change of a synaptic weight maypieces, and any change of a synaptic weight may lead to unpredictable results. A lead to unpredictable results. A neural network is,neural network is, in fact, a in fact, a black-black-boxbox for its user.for its user.

Page 8: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 8

Can we combine advantages of expert systemsCan we combine advantages of expert systems and neural networks to create a and neural networks to create a more powerfulmore powerful and effective and effective expert system?expert system?

A hybrid system that combines a neural networkA hybrid system that combines a neural network and a rule-based expert system is called aand a rule-based expert system is called a neuralneural expert systemexpert system (or a (or a connectionist expert connectionist expert systemsystem).).

Page 9: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 9

Basic structure of a neural expert systemBasic structure of a neural expert system

Inference E ngine

Neural Knowledge Base Rule Extraction

Explanation Facilities

User Interface

User

Rule: IF - THEN

Training Data

NewData

Page 10: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 10

The heart of a neural expert system is theThe heart of a neural expert system is the inference engineinference engine. It controls the . It controls the informationinformation flow in the system flow in the system and initiates inference overand initiates inference over the the neural knowledge base. neural knowledge base.

Based on the neural knowledge base (a special Based on the neural knowledge base (a special neural network), inference derive the outputs neural network), inference derive the outputs based on the inputs. based on the inputs.

The most important thing about neural expert The most important thing about neural expert system is that it can derive the rules from the system is that it can derive the rules from the neural network. neural network. That’s why the it is called a That’s why the it is called a neural expert system but not a neural networkneural expert system but not a neural network

Page 11: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 11

Example: The neural knowledge base (a special NN)Example: The neural knowledge base (a special NN)

-0.8

-0.2

-0.1-1.1

2.20.0

-1.0

2.8-1.6

-2.9

-1.3

Bird

Plane

Glider

+1

Wings

Tail

Beak

Feathers

Engine

+1

0

+1

+1

1

-1.6 -0.7

-1.1 1.9

1

1

Rule 1

Rule 2

Rule 3

1.0

1.0

1.0

Page 12: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 12

If we set each input of the input layer to either +1If we set each input of the input layer to either +1 (true), (true), 1 (false), or 0 (unknown), we can give a1 (false), or 0 (unknown), we can give a semantic interpretation for the activation ofsemantic interpretation for the activation of any outputany output neuron. neuron.

For example, we can have following For example, we can have following IF-THEN ruleIF-THEN rule: : if the object has if the object has Wings Wings (+1), (+1), Beak Beak (+1) and (+1) and Feathers Feathers (+1), but does not have(+1), but does not have Engine Engine ((1), then we can 1), then we can conclude that this object isconclude that this object is Bird Bird (+1):(+1):

03.5)1.1()1(8.212.21)2.0(0)8.0(11 RuleX

11 BirdRule YY

Page 13: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 13

We can similarly conclude that this object is notWe can similarly conclude that this object is not PlanePlane::

and not and not GliderGlider::

02.49.1)1()6.1(10.01)1.0(0)7.0(12 RuleX

12 PlaneRule YY

02.4)3.1()1()9.2(1)0.1(1)1.1(0)6.0(13 RuleX

13 GliderRule YY

Page 14: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 14

By attaching a corresponding question to each inputBy attaching a corresponding question to each input neuron, we can enable the system to prompt the userneuron, we can enable the system to prompt the user for initial values of the input variables:for initial values of the input variables:

Neuron: Neuron: WingsWings Question: Does the object have wings? Question: Does the object have wings? Neuron: Neuron: TailTail Question: Does the object have a tail? Question: Does the object have a tail? Neuron: Neuron: BeakBeak Question: Does the object have a beak? Question: Does the object have a beak? Neuron: Neuron: FeathersFeathers

Question: Does the object have feathers? Question: Does the object have feathers? Neuron: Neuron: EngineEngine

Question: Does the object have an engine?Question: Does the object have an engine?

Based on these inputs, we can determine the type of objectsBased on these inputs, we can determine the type of objects ..

Page 15: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 15

More interestingly, we do not need all the answers of More interestingly, we do not need all the answers of questions to make the decision.questions to make the decision.

An inference can be made if the known netAn inference can be made if the known net weighted input to a neuron is greater than theweighted input to a neuron is greater than the sum of the absolute values of the weights sum of the absolute values of the weights ofof the unknown inputs.the unknown inputs.

where where i i known, known, j j known and known and nn is the numberis the number of neuron inputs.of neuron inputs.

n

jj

n

iii wwx

11

Page 16: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 16

Enter initial value for the input Feathers:Enter initial value for the input Feathers: +1+1

Example:Example:

KNOWN = 1KNOWN = 12.8 = 2.82.8 = 2.8 UNKNOWN = UNKNOWN = 0.80.8+ + 0.20.2+ + 2.22.2+ + 1.11.1= 4.3= 4.3 KNOWN KNOWN UNKNOWNUNKNOWN

KNOWN = 1KNOWN = 12.8 + 12.8 + 12.2 = 5.02.2 = 5.0 UNKNOWN = UNKNOWN = 0.80.8+ + 0.20.2+ + 1.11.1= 2.1= 2.1 KNOWN KNOWN UNKNOWNUNKNOWN

Enter initial value for the input Beak:Enter initial value for the input Beak:+1+1

CONCLUDE: Bird is TRUECONCLUDE: Bird is TRUE

Page 17: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 17

An example of a multi-layer knowledge baseAn example of a multi-layer knowledge base

ConjunctionLayer

InputLayer

R1

R2

R3

R4

a1

a2

a3

a4

a5 R5

b2

b1

b3

0.2

0.8

-0.1

0.9

0.6

R6

R7

R8

c1

c2

0.1

0.9

0.7

DisjunctionLayer

ConjunctionLayer

DisjunctionLayer

Rule 1: Rule 5:IF a1 AND a3 THEN b1 (0.8) IF a5 THEN b3 (0.6)

Rule 2: Rule 6:IF a1 AND a4 THEN b1 (0.2) IF b1 AND b3 THEN c1 (0.7)

Rule 3: Rule 7:IF a2 AND a5 THEN b2 (-0.1 ) IF b2 THEN c1 (0.1)

Rule 4: Rule 8:IF a3 AND a4 THEN b3 (0.9) IF b2 AND b3 THEN c2 (0.9)

1.0

1.0

1.0

1.0

1.0

1.0

1.0

1.0

1.0

1.0

1.0

1.0

1.0

1.0

Page 18: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 18

Although neural networks are used for solving a Although neural networks are used for solving a variety of problems, they still have some variety of problems, they still have some limitations.limitations.

One of the most common is associated with neural One of the most common is associated with neural network training. The back-propagation learning network training. The back-propagation learning algorithm cannot guarantee an optimal solution. algorithm cannot guarantee an optimal solution. In real-world applications, the back-propagation In real-world applications, the back-propagation algorithm might converge to a set of sub-optimal algorithm might converge to a set of sub-optimal weights from which it cannot escape. As a result, weights from which it cannot escape. As a result, the neural network is often unable to find a the neural network is often unable to find a desirable solution to a problem at hand.desirable solution to a problem at hand.

Evolutionary neural networksEvolutionary neural networks

Page 19: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 19

Another difficulty is related to selecting an Another difficulty is related to selecting an optimal topology for the neural network. The optimal topology for the neural network. The “right” network architecture for a particular “right” network architecture for a particular problem is often chosen by means of heuristics, problem is often chosen by means of heuristics, and designing a neural network topology is still and designing a neural network topology is still more art than engineering.more art than engineering.

Genetic algorithms are an effective optimisation Genetic algorithms are an effective optimisation technique that can guide both weight optimisation technique that can guide both weight optimisation and topology selection.and topology selection.

Page 20: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 20

Encoding a set of weights in a chromosomeEncoding a set of weights in a chromosome

y

0.91

3

4x1

x3

x22

-0.8

0.4

0.8

-0.7

0.2

-0.2

0.6-0.3 0.1

-0.2

0.9

-0.60.1

0.3

0.5

From neuron:To neuron:

12 34 5678

12345678

00 00 000000 00 000000 00 0000

0.9 -0.3 -0.7 0 0000-0.8 0.6 0.3 0 00000.1 -0.2 0.2 0 00000.4 0.5 0.8 0 000000 0 -0.6 0.1 -0.2 0.9 0

Chromosome: 0.9 -0.3 -0.7 -0.8 0.6 0.3 0.1 -0.2 0.2 0.4 0.5 0.8 -0.6 0.1 -0.2 0.9

Page 21: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 21

The second step is to define a fitness function for The second step is to define a fitness function for evaluating the chromosome’s performance. This evaluating the chromosome’s performance. This function must estimate the performance of a function must estimate the performance of a given neural network. We can apply here a given neural network. We can apply here a simple function defined by the sum of squared simple function defined by the sum of squared errors.errors.

The training set of examples is presented to the The training set of examples is presented to the network, and the sum of squared errors is network, and the sum of squared errors is calculated. The smaller the sum, the fitter the calculated. The smaller the sum, the fitter the chromosome. chromosome. The genetic algorithm attempts The genetic algorithm attempts to find a set of weights that minimises the sum to find a set of weights that minimises the sum of squared errors.of squared errors.

Page 22: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 22

The third step is to choose the genetic operators – The third step is to choose the genetic operators – crossover and mutation. A crossover operator crossover and mutation. A crossover operator takes two parent chromosomes and creates a takes two parent chromosomes and creates a single child with genetic material from both single child with genetic material from both parents. Each gene in the child’s chromosome is parents. Each gene in the child’s chromosome is represented by the corresponding gene of the represented by the corresponding gene of the randomly selected parent.randomly selected parent.

A mutation operator selects a gene in a A mutation operator selects a gene in a chromosome and adds a small random value chromosome and adds a small random value between –1 and 1 to each weight in this gene.between –1 and 1 to each weight in this gene.

Page 23: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 23

Crossover in weight optimisationCrossover in weight optimisation

4

5

y

x22

-0.3

0.9-0.7

0.5

-0.8

-0.6

Parent1 Parent2

x11

-0.2

0.1

0.44

5

y

x22

-0.1-0.5

0.2-0.9

0.6

0.3x11

0.9

0.3

-0.8

0.1 -0.7 -0.6 0.5 -0.8-0.2 0.9 0.4 -0.3 0.3 0.2 0.3 -0.9 0.60.9 -0.5 -0.8 -0.1

0.1 -0.7 -0.6 0.5 -0.80.9 -0.5 -0.8 0.1

4y

x22

-0.1

-0.5-0.7

0.5

-0.8

-0.6

Child

x11

0.9

0.1

-0.8

Page 24: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 24

Mutation in weight optimisationMutation in weight optimisation

Original network3

4

5

y6

x22

-0.3

0.9-0.7

0.5

-0.8

-0.6x11

-0.20.1

0.4

0.1 -0.7 -0.6 0.5 -0.8-0.2 0.9

3

4

5

y6

x22

0.2

0.9-0.7

0.5

-0.8

-0.6x11

-0.20.1

-0.1

0.1 -0.7 -0.6 0.5 -0.8-0.2 0.9

Mutated network

0.4 -0.3 -0.1 0.2

Page 25: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 25

Can genetic algorithms help us in selecting Can genetic algorithms help us in selecting the network architecture?the network architecture?

The architecture of the network (i.e. the number of The architecture of the network (i.e. the number of neurons and their interconnections) often determines neurons and their interconnections) often determines the success or failure of the application. Usually the success or failure of the application. Usually the network architecture is decided by trial and error; the network architecture is decided by trial and error; there is a great need for a method of automatically there is a great need for a method of automatically designing the architecture for a particular designing the architecture for a particular application. Genetic algorithms may well be application. Genetic algorithms may well be suited for this task.suited for this task.

Page 26: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 26

The basic idea behind evolving a suitable network The basic idea behind evolving a suitable network architecture is to conduct a genetic search in a architecture is to conduct a genetic search in a population of possible architectures.population of possible architectures.

We must first choose a method of encoding a We must first choose a method of encoding a network’s architecture into a chromosome.network’s architecture into a chromosome.

Page 27: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 27

The connection topology of a neural network can The connection topology of a neural network can be represented by a square connectivity matrix.be represented by a square connectivity matrix.

Each entry in the matrix defines the type of Each entry in the matrix defines the type of connection from one neuron (column) to another connection from one neuron (column) to another (row), where 0 means no connection and 1 (row), where 0 means no connection and 1 denotes connection for which the weight can be denotes connection for which the weight can be changed through learning.changed through learning.

To transform the connectivity matrix into a To transform the connectivity matrix into a chromosome, we need only to string the rows of chromosome, we need only to string the rows of the matrix together.the matrix together.

Encoding the network architectureEncoding the network architecture

Page 28: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 28

Encoding of the network topologyEncoding of the network topology

Fromneuron:To neuron:

1 2

0

5

0

3

0

4

0

6

123456

0 00 0

0

0

00

00

00

00

00

00

1 1

11 1 1 1

01 00 00 0

3

4

5

y6

x22

x11

Chromosome:0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 0

Page 29: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 29

The cycle of evolving a neural network topologyThe cycle of evolving a neural network topologyNeural Network j

Fitness = 117

Neural Network j

Fitness = 117Generation i

Training Data Set0 0 1.0000

0.1000 0.0998 0.88690.2000 0.1987 0.75510.3000 0.2955 0.61420.4000 0.3894 0.47200.5000 0.4794 0.33450.6000 0.5646 0.20600.7000 0.6442 0.08920.8000 0.7174 -0.01430.9000 0.7833 -0.10381.0000 0.8415 -0.1794

Child 2

Child 1

CrossoverParent 1

Parent 2

Mutation

Generation (i + 1)

Page 30: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 30

Evolutionary computation is also used in the design Evolutionary computation is also used in the design of fuzzy systems, particularly for generating of fuzzy systems, particularly for generating fuzzy rules and adjusting membership functions of fuzzy rules and adjusting membership functions of fuzzy sets. fuzzy sets.

In this section, we introduce an application of In this section, we introduce an application of genetic algorithms to select an appropriate set of genetic algorithms to select an appropriate set of fuzzy IF-THEN rules for a classification problem.fuzzy IF-THEN rules for a classification problem.

For a classification problem, a set of fuzzy For a classification problem, a set of fuzzy IF-THEN rules is generated from numerical data.IF-THEN rules is generated from numerical data.

First, we use a grid-type fuzzy partition of an input First, we use a grid-type fuzzy partition of an input space.space.

FuzzyFuzzy evolutionary systemsevolutionary systems

Page 31: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 31

Fuzzy partition by a 3Fuzzy partition by a 33 fuzzy grid3 fuzzy grid

0 1

A1 A2 A3

X1

B2

B1

B3

0

1X2

Class1:

Class2:

(x1)

(x2)

0

101

1

2

3

6

7

45

9

8

1110

12

16

15

14

13

x11

x21

Page 32: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 32

Fuzzy partitionFuzzy partition

Black and white dots denote the training patterns Black and white dots denote the training patterns of of Class Class 1 and 1 and Class Class 2, respectively.2, respectively.

The grid-type fuzzy partition can be seen as a The grid-type fuzzy partition can be seen as a rule table.rule table.

The linguistic values of input The linguistic values of input xx1 (1 (AA11, , AA22 and and AA33) ) form the horizontal axis, and the linguistic form the horizontal axis, and the linguistic values of input values of input xx2 (2 (BB11, , BB22 and and BB33) form the ) form the vertical axis.vertical axis.

At the intersection of a row and a column lies the At the intersection of a row and a column lies the rule consequent.rule consequent.

Page 33: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 33

In the rule table, each fuzzy subspace can have In the rule table, each fuzzy subspace can have only one fuzzy IF-THEN rule, and thus the total only one fuzzy IF-THEN rule, and thus the total number of rules that can be generated in a number of rules that can be generated in a KKK K grid is equal to grid is equal to KKKK..

Page 34: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 34

Fuzzy rules that correspond to the Fuzzy rules that correspond to the KKK K fuzzy fuzzy partition can be represented in a general form as:partition can be represented in a general form as:

where xwhere xp p is a training pattern on input space is a training pattern on input space XX11XX2, 2,

P P is the total number of training patterns, is the total number of training patterns, CCnn is the is the

rule consequent (either rule consequent (either Class Class 1 or 1 or Class Class 2), and 2), and is the certainty factor that a pattern in fuzzy is the certainty factor that a pattern in fuzzy subspace subspace AAiiBBj j belongs to class belongs to class CCnn..

CFAi Bj

Cn

is Ai i = 1, 2, . . . , K

is Bj j = 1, 2, . . . , K

RuleRij :IF x1p

THEN xp

AND x2p

Cn

n

ji

CBACF xp = (x1p, x2p), p = 1, 2, . . . , P

Page 35: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 35

To determine the rule consequent and the certainty To determine the rule consequent and the certainty factor, we use the following procedure:factor, we use the following procedure:

Step 1Step 1: : Partition an input space into Partition an input space into KKK K fuzzy fuzzy subspaces, and calculate the strength of each class subspaces, and calculate the strength of each class of training patterns in every fuzzy subspace. of training patterns in every fuzzy subspace.

Each class in a given fuzzy subspace is represented Each class in a given fuzzy subspace is represented by its training patterns. The more training by its training patterns. The more training patterns, the stronger the class patterns, the stronger the class in a given fuzzy in a given fuzzy subspace, the rule consequent becomes more subspace, the rule consequent becomes more certain when patterns of one particular class appear certain when patterns of one particular class appear more often than patterns of any other class.more often than patterns of any other class.

Page 36: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 36

The Strength of class CThe Strength of class Cnn in fuzzy subspace A in fuzzy subspace AiiBBjj can be can be determined as:determined as:

Page 37: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 37

Step 2Step 2: : Determine the rule consequent and the certainty Determine the rule consequent and the certainty factor in each fuzzy subspace.factor in each fuzzy subspace.

As the rule consequent is determined by the strongest class As the rule consequent is determined by the strongest class we need to find class Cwe need to find class Cmm such that, such that,

Page 38: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 38

Page 39: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 39

The certainty factor can be interpreted as The certainty factor can be interpreted as follows:follows:

If all the training patterns in fuzzy subspace If all the training patterns in fuzzy subspace AAi i BBjj

belong to the same class, then the certainty belong to the same class, then the certainty factor is maximum and it is certain that any new factor is maximum and it is certain that any new pattern in this subspace will belong to this class.pattern in this subspace will belong to this class.

If, however, training patterns belong to different If, however, training patterns belong to different classes and these classes have similar strengths, classes and these classes have similar strengths, then the certainty factor is minimum and it is then the certainty factor is minimum and it is uncertain that a new pattern will belong to any uncertain that a new pattern will belong to any particular class.particular class.

Page 40: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 40

This means that patterns in a fuzzy subspace can This means that patterns in a fuzzy subspace can be misclassified. Moreover, if a fuzzy subspace be misclassified. Moreover, if a fuzzy subspace does not have any training patterns, we cannot does not have any training patterns, we cannot determine the rule consequent at all.determine the rule consequent at all.

If a fuzzy partition is too coarse, many patterns If a fuzzy partition is too coarse, many patterns may be misclassified. On the other hand, if a may be misclassified. On the other hand, if a fuzzy partition is too fine, many fuzzy rules fuzzy partition is too fine, many fuzzy rules cannot be obtained, because of the lack of cannot be obtained, because of the lack of training patterns in the corresponding fuzzy training patterns in the corresponding fuzzy subspaces.subspaces.

Page 41: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 41

Training patterns are not necessarily Training patterns are not necessarily distributed evenly in the input space. As a distributed evenly in the input space. As a result, it is often difficult to choose an result, it is often difficult to choose an appropriate density for the fuzzy grid. To appropriate density for the fuzzy grid. To overcome this difficulty, we use overcome this difficulty, we use multiple multiple fuzzy rule tablesfuzzy rule tables..

Page 42: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 42

Multiple fuzzy rule tablesMultiple fuzzy rule tables

Fuzzy IF-THEN rules are generated for each fuzzy Fuzzy IF-THEN rules are generated for each fuzzy subspace of multiple fuzzy rule tables, and thus a subspace of multiple fuzzy rule tables, and thus a complete set of rules for our case can be specified complete set of rules for our case can be specified as:as:

2222 + 3 + 333 + 4 + 444 + 5 + 555 + 6 + 666 = 90 rules. = 90 rules.

K = 2 K = 3 K = 4 K = 5 K = 6

Page 43: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 43

Once the set of rules Once the set of rules SSALLALL is generated, a new is generated, a new

pattern, pattern, x x = (= (xx1, 1, xx2), can be classified by the 2), can be classified by the following procedure:following procedure:

Step 1Step 1: : In every fuzzy subspace of the multiple In every fuzzy subspace of the multiple fuzzy rule tables, calculate the degree of fuzzy rule tables, calculate the degree of compatibility of a new pattern with each class.compatibility of a new pattern with each class.

Page 44: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 44

Step 2Step 2: : Determine the maximum degree of Determine the maximum degree of compatibility of the new pattern with each class.compatibility of the new pattern with each class.

Page 45: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 45

Step 3Step 3: : Determine the class with which the new Determine the class with which the new pattern has the highest degree of compatibility, pattern has the highest degree of compatibility, and assign the pattern to this class.and assign the pattern to this class.

Page 46: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 46

• The number of multiple fuzzy rule tables The number of multiple fuzzy rule tables required for an accurate pattern classification required for an accurate pattern classification may be large. may be large.

• Consequently, a complete set of rules can be Consequently, a complete set of rules can be enormous. enormous.

• Meanwhile, these rules have different Meanwhile, these rules have different classification abilities, and thus by selecting classification abilities, and thus by selecting only rules with high potential for accurate only rules with high potential for accurate classification, we reduce the number of classification, we reduce the number of rules.rules.

Page 47: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 47

The problem of selecting fuzzy IF-THEN rules The problem of selecting fuzzy IF-THEN rules can be seen as a combinatorial optimisation can be seen as a combinatorial optimisation problem with two objectives.problem with two objectives.

The first, more important, objective is to The first, more important, objective is to maximise the number of correctly classified maximise the number of correctly classified patterns.patterns.

The second objective is to minimise the number The second objective is to minimise the number of rules.of rules.

Genetic algorithms can be applied to this Genetic algorithms can be applied to this problem.problem.

Can we use genetic algorithms for selecting Can we use genetic algorithms for selecting fuzzy IF-THEN rules ?fuzzy IF-THEN rules ?

Page 48: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 48

A basic genetic algorithm for selecting fuzzy IF-A basic genetic algorithm for selecting fuzzy IF- THEN rules THEN rules includes the following steps:includes the following steps:

Step 1Step 1: : Randomly generate an initial population of Randomly generate an initial population of chromosomes. The population size may be relatively small, chromosomes. The population size may be relatively small, say 10 or 20 chromosomes. Each gene in a chromosome say 10 or 20 chromosomes. Each gene in a chromosome corresponds to a particular fuzzy IF-THEN rule in the rule set corresponds to a particular fuzzy IF-THEN rule in the rule set defined by defined by SSALLALL..

• e.g. the chromosome can be specified by a 90-bit string. e.g. the chromosome can be specified by a 90-bit string. Each bit can assume 1, -1, 0.Each bit can assume 1, -1, 0.

• 1 for a particular rule belongs to set S, -1 for not 1 for a particular rule belongs to set S, -1 for not belonging, and 0 for dummy rule.belonging, and 0 for dummy rule.

Step 2Step 2: : Calculate the performance, or fitness, of each individual Calculate the performance, or fitness, of each individual chromosome in the current population.chromosome in the current population.

Page 49: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 49

• The problem of selecting fuzzy rules has two objectives: The problem of selecting fuzzy rules has two objectives: to maximise the accuracy of the pattern classification to maximise the accuracy of the pattern classification and to minimise the size of a rule set. and to minimise the size of a rule set.

• The fitness function has to accommodate both these The fitness function has to accommodate both these objectives. This can be achieved by introducing two objectives. This can be achieved by introducing two respective weights, respective weights, wwPP and and wwNN , in the fitness function:, in the fitness function:

where where PPSS the number of patterns classified successfully, the number of patterns classified successfully, PPALLALL is the total number of patterns presented to the is the total number of patterns presented to the classification system, classification system, NNSS and and NNALLALL are the numbers of are the numbers of fuzzy IF-THEN rules in set fuzzy IF-THEN rules in set S S and set and set SSALLALL , , respectively.respectively.

ALL

SN

ALLP N

Nw

PP

wSf s )(

Page 50: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 50

The classification accuracy is more important than The classification accuracy is more important than the size of a rule set. That is,the size of a rule set. That is,

ALL

S

ALL NN

PP

Sf s 10)(

Page 51: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 51

Step 3Step 3: : Select a pair of chromosomes for mating. Select a pair of chromosomes for mating. Parent chromosomes are selected with a Parent chromosomes are selected with a probability associated with their fitness; a better probability associated with their fitness; a better fit chromosome has a higher probability of being fit chromosome has a higher probability of being selected.selected.

Step 4Step 4: : Create a pair of offspring chromosomes Create a pair of offspring chromosomes by applying a standard crossover operator. by applying a standard crossover operator. Parent chromosomes are crossed at the randomly Parent chromosomes are crossed at the randomly selected crossover point.selected crossover point.

Step 5Step 5: : Perform mutation on each gene of the Perform mutation on each gene of the created offspring. The mutation probability is created offspring. The mutation probability is normally kept quite low, say 0.01. The mutation normally kept quite low, say 0.01. The mutation is done by multiplying the gene value by –1. is done by multiplying the gene value by –1.

Page 52: © Negnevitsky, Pearson Education, 2005 1 Lecture 10 Introduction Introduction Neural expert systems Neural expert systems Evolutionary neural networks

© Negnevitsky, Pearson Education, 2005 52

Step 6Step 6: : Place the created offspring chromosomes in Place the created offspring chromosomes in the new population.the new population.

Step 7Step 7: : Repeat Repeat Step 3 Step 3 until the size of the new until the size of the new population becomes equal to the size of the initial population becomes equal to the size of the initial population, and then replace the initial (parent) population, and then replace the initial (parent) population with the new (offspring) population.population with the new (offspring) population.

Step 9Step 9: : Go to Go to Step 2Step 2, and repeat the process until a , and repeat the process until a specified number of generations (typically several specified number of generations (typically several hundreds) is considered.hundreds) is considered.

The number of rules can be cut down to less than The number of rules can be cut down to less than 2% of the initially generated set of rules.2% of the initially generated set of rules.