570 likes | 1.03k Views
FUZZY LOGIC. WHAT IS FUZZY LOGIC?. Definition of fuzzy Fuzzy – “not clear, distinct, or precise; blurred” Definition of fuzzy logic A form of knowledge representation suitable for notions that cannot be defined precisely, but which depend upon their contexts.
E N D
WHAT IS FUZZY LOGIC? • Definition of fuzzy • Fuzzy – “not clear, distinct, or precise; blurred” • Definition of fuzzy logic • A form of knowledge representation suitable for notions that cannot be defined precisely, but which depend upon their contexts.
TRADITIONAL REPRESENTATION OF LOGIC Slow Fast Speed = 0 Speed = 1 bool speed; get the speed if ( speed == 0) { // speed is slow } else { // speed is fast }
FUZZY LOGIC REPRESENTATION Slowest • For every problem must represent in terms of fuzzy sets. • What are fuzzy sets? [ 0.0 – 0.25 ] Slow [ 0.25 – 0.50 ] Fast [ 0.50 – 0.75 ] Fastest [ 0.75 – 1.00 ]
FUZZY LOGIC REPRESENTATION CONT. Slowest Slow Fast Fastest float speed; get the speed if ((speed >= 0.0)&&(speed < 0.25)) { // speed is slowest } else if ((speed >= 0.25)&&(speed < 0.5)) { // speed is slow } else if ((speed >= 0.5)&&(speed < 0.75)) { // speed is fast } else // speed >= 0.75 && speed < 1.0 { // speed is fastest }
ORIGINS OF FUZZY LOGIC • Traces back to Ancient Greece • Lotfi Asker Zadeh ( 1965 ) • First to publish ideas of fuzzy logic. • Professor Toshire Terano ( 1972 ) • Organized the world's first working group on fuzzy systems. • F.L. Smidth & Co. ( 1980 ) • First to market fuzzy expert systems.
FUZZY LOGIC VS. NEURAL NETWORKS • How does a Neural Network work? • Both model the human brain. • Fuzzy Logic • Neural Networks • Both used to create behavioral systems.
FUZZY LOGIC IN CONTROL SYSTEMS • Fuzzy Logic provides a more efficient and resourceful way to solve Control Systems. • Some Examples • Temperature Controller • Anti – Lock Break System ( ABS )
TEMPERATURE CONTROLLER • The problem • Change the speed of a heater fan, based off the room temperature and humidity. • A temperature control system has four settings • Cold, Cool, Warm, and Hot • Humidity can be defined by: • Low, Medium, and High • Using this we can define the fuzzy set.
FUZZY LOGIC IN OTHER FIELDS • Business • Hybrid Modeling • Expert Systems
Application Predicting consumption of fuel in Automobiles.
Partitioning Data • Input Selection exhsrch(1, trn_data, chk_data, input_name); Train 6 ANFIS models, each with 1 inputs selected from 6 candidates... ANFIS model 1: Cylinder --> trn=4.6400, chk=4.7255 ANFIS model 2: Disp --> trn=4.3106, chk=4.4316 ANFIS model 3: Power --> trn=4.5399, chk=4.1713 ANFIS model 4: Weight --> trn=4.2577, chk=4.0863 ANFIS model 5: Acceler --> trn=6.9789, chk=6.9317 ANFIS model 6: Year --> trn=6.2255, chk=6.1693
Figure 1: Every input variable's influence on fuel consumption The left-most input variable in Figure 1 has the least error or in other words the most relevance with respect to the output.
input_index = exhsrch(2, trn_data, chk_data, input_name); Train 15 ANFIS models, each with 2 inputs selected from 6 candidates... ANFIS model 1: Cylinder Disp --> trn=3.9320, chk=4.7920 ANFIS model 2: Cylinder Power --> trn=3.7364, chk=4.8683 ANFIS model 3: Cylinder Weight --> trn=3.8741, chk=4.6764 ANFIS model 4: Cylinder Acceler --> trn=4.3287, chk=5.9625 ANFIS model 5: Cylinder Year --> trn=3.7129, chk=4.5946 ANFIS model 6: Disp Power --> trn=3.8087, chk=3.8594 ANFIS model 7: Disp Weight --> trn=4.0271, chk=4.6349 ANFIS model 8: Disp Acceler --> trn=4.0782, chk=4.4890 ANFIS model 9: Disp Year --> trn=2.9565, chk=3.3905 ANFIS model 10: Power Weight --> trn=3.9310, chk=4.2974 ANFIS model 11: Power Acceler --> trn=4.2740, chk=3.8738 ANFIS model 12: Power Year --> trn=3.3796, chk=3.3505 ANFIS model 13: Weight Acceler --> trn=4.0875, chk=4.0095 ANFIS model 14: Weight Year --> trn=2.7657, chk=2.9954 ANFIS model 15: Acceler Year --> trn=5.6242, chk=5.6481
Figure 2: All two input variable combinations and their influence on fuel consumption The results from exhsrch indicate that 'Weight' and 'Year' form the optimal combination of two input attributes. The training and checking errors are getting distinguished, indicating the outset of overfitting.
exhsrch(3, trn_data, chk_data, input_name); Train 20 ANFIS models, each with 3 inputs selected from 6 candidates...
Figure 3: All three input variable combinations and their influence on fuel consumption
Training the ANFIS model The function exhsrch only trains each ANFIS for a single epoch in order to be able to quickly find the right inputs. Now that the inputs are fixed, we can spend more time on ANFIS training (100 epochs). The genfis1 function generates an initial FIS from the training data, which is then finetuned by ANFIS to generate the final model. in_fismat = genfis1(new_trn_data, 2, 'gbellmf'); [trn_out_fismat trn_error step_size chk_out_fismatchk_error] = ... anfis(new_trn_data, in_fismat, [100 nan 0.01 0.5 1.5], [0,0,0,0], new_ch k_data, 1); ANFIS returns the error with respect to training data and checking data in the list of its output parameters. The plot of the errors provides useful information about the training process. [a, b] = min(chk_error); plot(1:100, trn_error, 'g-', 1:100, chk_error, 'r-', b, a, 'ko'); title('Training (green) and checking (red) error curve'); xlabel('Epoch numbers'); ylabel('RMS errors');
Analyzing the ANFIS Model The variable chk_out_fismat represents the snapshot of the ANFIS model at the minimal checking error during the training process. The input-output surface of the model is shown in the plot below. chk_out_fismat = setfis(chk_out_fismat, 'input', 1, 'name', 'Weight'); chk_out_fismat = setfis(chk_out_fismat, 'input', 2, 'name', 'Year'); chk_out_fismat = setfis(chk_out_fismat, 'output', 1, 'name', 'MPG');
% Generating the FIS output surface plot gensurf(chk_out_fismat); Figure 5: Input-Output surface for trained FIS
Limitations and Cautions We can see some spurious effects at the far-end corner of the surface. The elevated corner says that the heavier an automobile is, the more gas-efficient it will be. This is totally counter-intuitive, and it is a direct result from lack of data. plot(new_trn_data(:,1), new_trn_data(:, 2), 'bo', new_chk_data(:,1), new_chk_data(:, 2), 'rx'); xlabel('Weight'); ylabel('Year'); title('Training (o) and checking (x) data');
Figure 6: Weight vs Year plot showing lack of data in the upper-right corner This plot above shows the data distribution. The lack of training data at the upper right corner causes the spurious ANFIS surface mentioned earlier. Therefore the prediction by ANFIS should always be interpreted with the data distribution in mind.
Fuzzy logic provides an alternative way to represent linguistic and subjective attributes of the real world in computing. • It allows membership degrees to the variables. • It is able to be applied to control systems and other applications in order to improve the efficiency and simplicity of the design process.
Different cases of each input’s fuzzy sets are evaluated according to if-then rules of the fuzzy system • As a result of this operation, the optimum outputs are obtained much close to the target outputs
Neural networks are adaptive networks which are • composed of simple elements operating in parallel • These elements are inspired by biological nervous • Systems • Neural networks have been trained to • perform complex functions in various fields of • applications including pattern recognition, • identification, classification, speech, vision and • control systems