Fuzzy Logic - Department Of Systems Engineering And Engineering .

Transcription

Fuzzy LogicnnFuzzy set to quantify on something impreciseIt is intimately tied with a membershipfunction199Some basic notationnFuzzy set A200

Representation of fuzzy setnAs fuzzy singletonsnExample201Integral representation to expresscontinuumnMath function can also be used insteadof values202

Standard functions are often usedfor convenience (e.g. S -function)203Pi-function (from S -function)204

Complement is a fuzzy setoperation205Set union and intersectionrequires max and min206

Linguistic variables as fuzzy setsnHuman, or natural languages are fuzzyWe attach a fuzzyset to quantify thislinguistic value207Hedges are commonly used208

(Binary) Fuzzy relation relatestwo fuzzy setsnCartesian product defines the joint domain ofdiscoursenThe general case can handle more than twofuzzy sets209Fuzzy relationWe only consider the binary caseinvolving two component fuzzy setsn It is commonly represented as a matrixRn It can be visualized as a 33-D graph (withmembership function (or matrix values)over the Cartesian product)n210

Fuzzy relation and its projection211Constructing fuzzy relation fromits componentsnFrom one component as cylindricalextension212

Relating two components hasdifferent alternativesnThe “minmin”” operator is often used for rulerepresentation213Operating on fuzzy relationsnThe maxmax-min composition rule is usedfor propagating fuzzy relations214

Max-min rule as simple matrixcalculationnMax as “ ” and min as “*” in ordinarymatrix multiplication215Max-min rule is useful forinference as wellnGiven R(x,y) and R’R’(x), deduce R’R’(y)216

Example (applied to linguisticvariables)nGiven217Calculation in progress218

Interpreting the results219A rule and a fuzzy relationnConsider a simple rule “If A then B”B ” where Aand B are fuzzy sets e.g., If clever then successfulnnnHow should this be represented so thatinference can be performed?Using a fuzzy relation?If yes, then we can use the maxmax-min rule toinfer B’B ’once given A’A ’and the simple rule220

If A then B221Recall geometric interpretation222

Fuzzy reasoning usinggeneralized “ modus ponens”223Using mathA bit more difficult to understandn But the formulation can be rere-arrangedto give useful graphical interpretationand constructionnUsing min here224

Shuffling around with max-min,and min225Fuzzy reasoning in graphicalform226

A simple way to perform fuzzyreasoning toonnnGraphical appealNo lengthy math calculations to get exact MF values(just let the computers do them)Sometimes we use maxmax--prod instead of maxmax-min227Another way of interpretation ismore general. Why?228

229Handling multiple antecedentsnIf (A and B) then C, and given A’A ’, B’B’. Why?230

Understanding FuzzificationnnnHow should we treat crisp value?As a limiting case of a fuzzy setFuzzified input of a crisp value231Operating on fuzzified inputs232

Fuzzy rules operate on crispinputs as well233Looking closer234

Another way of looking at fuzzyinference system235DefuzzificationnWe want to get back a crisp value fromfuzzy inference236

A practical example of usingfuzzy rulesR1: If Mix is too wet, then add sand andcoarse aggregaten R2: If Mix is workable, then leave alonen R3, If Mix is too stiff, then decreasesand and coarse aggregatennWhat should we do when the concrete slumpis 6 inches? How about 4.8 inches?237238

239Putting side by side4.8 inches6 inchesCrisp InputsCrisp Outputs240

Crisp outputs requiredefuzzificationnCentre of gravity (COG)241Using COG defuzzification242

Matlab implementation243The “ Tipping” rule base244

Knowing the representation245More on representation246

Writing the program is then easy247Checking on performance248

Fuzzy systems for financialapplicationnnnnnIt now looks straightforward by adapting thedesign methodology of the exampleDefine the rule base (e.g. your goldentechnical analysis rules)Define the necessary fuzzy sets (i.e.membership functions)Define the relevant inputs and outputs (e.g.,what technical indicators will be used? BuyBuy -inor sellsell -out output signals?)System integration is easy too (e.g., with NN)249Genetic algorithms revisitedFitness function and a basic set of GAoperatorsn A global optimization technique usefulfor searching in illill-defined problems thatdefy structural representation ormodelingn Iterative procedure that proceeds overmany generationsn250

Basic operatorsnMutationnMutation Rate is the probability of mutationoccurring.Mutation is the random flipping of one of thebits or genes (i.e., change a 0 to 1).Mutation is employed to give new informationto the population. It also prevents thepopulation from becoming saturated withchromosomes that all look alike (prematureconvergence).251nnMutationnnLarge mutation rates increase the probabilityof destroying a good chromosome, butprevents premature convergence.The best mutation rate is applicationdependent and related to both the length ofthe chromosome and the size of thepopulation. For most applications a mutationrate of 0.1 to 0.01 is employed.252

CrossovernnCrossover Rate is the probability of crossoverreproduction being performed. A highcrossover is used to encourage good mixingof the chromosomes. For most applications acrossover rate of 0.75 to 0.95 is employed.Crossover Type is the type of crossoverreproduction that is employed. Some basictypes of crossover: single, double, anduniform.253ElitistnElitist Operator determines whether the bestchromosome for each population is placedinto the next generation unchanged. If theelitist operator is turned on, the best fitnessscore from one population to the next willnever decrease.254

Matlab implementationnThere are many existing that demonstrate thepower of the techniqueOne is that based on the work of Ron Shaffer(1998), Naval Research LaboratoryChemistry Divisionnhttp://chem1.nrl.navy.mil/ shaffer/practga.htmlnSimple examples are used (e.g., fitnessfunction to push all binary code to 1)Implementation can be readily enhanced forpractical usenn255Mutate.m256

Test run on using simple fitnessfunctionnSumming up the values on the chromosomes257Graphical plot to show theconvergence258

Using GAnnnnDefine the meaning of the chromosomes -what do the “0”and “1” stand for the specificapplication?Define a meaningful fitness function toevaluate the quality of the chromosomesInterpret the results (Is the quality of thechromosomes good?)Modify the operators, e.g., mutation andcrossover rates, and rere -interpret results259

Mutation nLarge mutation rates increase the probability of destroying a good chromosome, but prevents premature convergence. nThe best mutation rate is application dependent and related to both the length of the chromosome and the size of the population. For most applications a mutation rate of 0.1 to 0.01 is employed.