Smart Systems Lecture 8 PDF
Document Details
Uploaded by Deleted User
Alexandria University
Tags
Summary
These lecture notes cover smart systems and computational intelligence, focusing on types of clustering methods, fuzzy logic, and fuzzy inference systems. The document includes diagrams, tables, and examples to illustrate the concepts.
Full Transcript
# Smart Systems and Computational Intelligence ## Lecture 8 Smart Systems and Computational Intelligence Course ## Types of Clustering Methods - **Hard clustering:** Clusters do not overlap elements, either belong to the cluster or it does not. Each document belongs to exactly one cluster. - **Soft...
# Smart Systems and Computational Intelligence ## Lecture 8 Smart Systems and Computational Intelligence Course ## Types of Clustering Methods - **Hard clustering:** Clusters do not overlap elements, either belong to the cluster or it does not. Each document belongs to exactly one cluster. - **Soft clustering (Fuzzy):** Clusters may overlap. A document can belong to more than one cluster. ## Types of Clustering Methods ### Hard Clustering | Nodes | Cluster 1 | Cluster 2 | Cluster 3 | |---|---|---|---| | 1 2 3 4 5 6 7 | 1100000 | 0011000 | 0000111 | ### Soft Clustering | Nodes | Cluster 1 | Cluster 2 | Cluster 3 | |---|---|---|---| | 1 2 3 4 5 6 7 | 1100100 | 0011001 | 0000111 | ## Fuzzy Logic and Fuzzy Inference System ## Fuzzy Logic - Fuzzy logic is an approach to computing based on "degrees of truth" rather than the usual "true or false" (1 or 0) Boolean logic on which the modern computer is based. - First introduced by Dr. Lotfi Zadeh in the 1965's to model the uncertainty of natural language. - Uses the mathematical theory of fuzzy sets - Simulates the process of normal human reasoning - Allows the computer to behave less precisely - Decision-making involves gray areas - Fuzzy logic variables may have different degrees, called grades of membership, that range in degrees between 0 and 1. ## Fuzzy Logic - Looking up in the dictionary - Fuzzy = "not clear, distinct, precise, blurred" - The world is imprecise, not clear, blurred, - The word is Fuzzy - Definition of fuzzy logic - A dorm of Knowledge representation suitable for notations that cannot be defined precisely, but which depend upon their contexts - Let's go from true and false (traditional logics) to something more powerful ## Traditional Representation of Logic - Logic Representation - Slow-> Speed=0 - Fast-> Speed=1 ## Fuzzy Logic - How fast is fast? - The definition of slow and fast depends on the eyes of the beholder. - Nature language contains many subjective terms - How can deal with this? - These four are linguistic terms - Still, I need to define the semantics of each linguistic term ## Fuzzy Logic ### Classical view - Define intervals: - Very slow [0 – 0.25] - Slow [0.25 - 0.5] - Fast [0.5-0.75] - Very fast [0.75 -1] ### Fuzzy Logic View - Consider the degree to which each observation belongs to each linguistic term - Define a membership function ## Fuzzy Logic - Member ship functions - Semantics of the system ## Foundation of Fuzzy Logic - Fuzzy set - Membership Function - Logical operations - If - then Rules ## Fuzzy Sets - It is required to define, in some way, how to go back and forth between the description of speed in numbers and the description of speed in words. - This is done by defining membership functions. ## Crisp Sets vs. Fuzzy Sets - The **crisp set** is defined in such a way as to the individuals in some given universe of discourse into two groups: members and nonmembers. - However, many classification concepts do not exhibit this characteristic. - For example, the set of tall people, expensive cars, or sunny days. - A **fuzzy set** can be defined mathematically by assigning to each possible individual in the universe of discourse a value representing its grade of membership in the fuzzy set. - For example: a fuzzy set representing our concept of sunny might assign a degree of membership of 1 to a cloud cover of 0%, 0.8 to a cloud cover of 20%, 0.4 to a cloud cover of 30%, and 0 to a cloud cover of 75%. ## Fuzzy Logic Example: Tallness - The classical example in fuzzy sets is tall men. The elements of the fuzzy set "tall men" are all men, but their degrees of membership depend on their height. | Name | Height, cm | |---|---| | Chris | 208 | | Mark | 205 | | John | 198 | | Tom | 18 | | David | 179 | | Mike | 172 | | Bob | 167 | | Steven | 158 | | Bill | 155 | | Peter | 152 | ## Crisp and Fuzzy Sets of “Tall Men” - Crisp Sets - Degree of Membership - Fuzzy Sets - Degree of Membership ## Crisp and Fuzzy Sets of Short, Average, and Tall Men - Crisp Sets - Degree of Membership - Short - Average - Tall - Fuzzy Sets - Degree of Membership - Short - Average - Tall ## Fuzzy Logic Example: Tallness | Name | Height, cm | Crisp | Fuzzy | |---|---|---|---| | Chris | 208 | 1 | 1.00 | | Mark | 205 | 1 | 1.00 | | John | 198 | 1 | 0.98 | | Tom | 181 | 1 | 0.82 | | David | 179 | 0 | 0.78 | | Mike | 172 | 0 | 0.24 | | Bob | 167 | 0 | 0.15 | | Steven | 158 | 0 | 0.06 | | Bill | 155 | 0 | 0.01 | | Peter | 152 | 0 | 0.00 | ## Membership Functions - A Membership Function (MF) is a curve that defines how each point in the input space is mapped to a membership value (or degree of membership) between 0 and 1. ## Membership Functions - There are different forms of membership functions, such as triangular, trapezoidal, or Gaussian. - The most common types of membership functions are triangular and trapezoidal shapes. - The type of the membership function can be context dependent, and it is generally chosen arbitrarily according to the user's experience. ## Membership Functions for Fuzzy Set "Speed" - 1000 - 500 - 0 - Speed 0 - 20 - 30 - 40 - 60 - 80 - Slow - Medium - Fast ## Fuzzy Inference System (FIS) = Expert System + Fuzzy Logic - A Fuzzy Inference System (FIS) is a way of mapping an input space to an output space using fuzzy logic. - FIS uses a collection of fuzzy membership functions and rules, instead of Boolean logic, to reason about data. ## Fuzzy Inference System (FIS) - The rules in FIS (sometimes may be called as fuzzy expert system) are fuzzy production rules of the form: - if p then q, where p and q are fuzzy statements. - For example, in a fuzzy rule, if x is low and y is high then z is medium. - Here x is low, y is high, z is medium are fuzzy statements, x and y are input variables, z is an output variable, low, high, and medium are fuzzy sets. ## Fuzzy Inference System (FIS) - Most tools for working with fuzzy expert systems allow more than one conclusion per rule. - The functional operations in the fuzzy expert system proceed in the following steps: - Fuzzification - Fuzzy Inference (apply implication method) Rule Evaluation - Aggregation of all outputs - Defuzzification ## Structure of a Fuzzy Expert System Diagram of a fuzzy expert system showing a knowledge base, inference engine, fuzzification, and defuzzification. ## Fuzzy Inferencing Process - Fuzzy Inferencing Process - Crisp Inputs - Fuzzification - Inferencing - Composition - Defuzzification - Crisp Outputs - Membership functions - Fuzzy rules - Composition heuristics - Defuzzification heuristics ## Fuzzification - The first step in fuzzy logic processing involves a domain transformation called fuzzification. - Crisp inputs are transformed into fuzzy inputs. - To transform crisp inputs into fuzzy inputs, member functions are needed. ## Fuzzification - In the process of fuzzification, membership functions defined on input variables are applied to their actual values so that the degree of truth for each rule premise can be determined. - Fuzzy statements in the antecedent are resolved to a degree of membership between 0 and 1. - If there is only one part to the antecedent, then this is the degree of support for the rule. - If there are multiple parts to the antecedent, apply fuzzy logic operators and resolve the antecedent to a single number between 0 and 1. ## Fuzzy Inferencing or Rule Evaluation - In step two of fuzzy logic processing, the fuzzy processor uses linguistic rules to determine what control action should occur in response to a given set of input values. - Rule Evaluation, also referred to as Fuzzy Inference, applies and evaluates the rules (fuzzy rules) to the fuzzy inputs that were generated in the fuzzification process. ## Fuzzy Inferencing - In the process of inference: - Truth value for the premise of each rule is computed and applied to the conclusion part of each rule. - This results in one fuzzy set to be assigned to each output variable for each rule. - The use of degree of support for the entire rule is to shape the output fuzzy set. ## Aggregation of All Outputs - It is the process where the outputs of each rule are combined into a single fuzzy set. - The input of the aggregation process is the list of truncated output functions returned by the implication process for each rule. - The output of the aggregation process is one fuzzy set for each output variable. ## Aggregation of All Outputs - Here, all fuzzy sets assigned to each output variable are combined to form a single fuzzy set for each output variable using a fuzzy aggregation operator. - Some of the most commonly used aggregation operators are: - The maximum: point-wise maximum over all of the fuzzy sets - The sum: point-wise sum over all of the fuzzy - The probabilistic sum. ## Defuzzification - In Defuzzification, the fuzzy output set is converted to a crisp number. - Some commonly used techniques are the centroid and maximum methods. - In the centroid method, the crisp value of the output variable is computed by finding the variable value of the centre of gravity of the membership function for the fuzzy value. - In the maximum method, one of the variable values at which the fuzzy set has its maximum truth value is chosen as the crisp value for the output variable. ## Fuzzy Rules - Fuzzy rules are usually if-then statements that describe the action to be taken in response to various fuzzy inputs - Rules follow the common sense behavior of the system and are written in terms of the membership function linguistic labels. ## Fuzzy Rules Diagram of a fuzzy expert system showing the antecedent and consequent of a fuzzy rule. ## Logical Operations - AND - OR - NOT ## Example - We will explain these steps using an example of **Tipping Problem** - Two inputs: Quality of food and Service at a restaurant rated at scale from 0-10 - One output: Amount of tip to be given - Tip should reflect the quality of the food and service. - The tip might be in the range 5-25% of total bill paid. ## Rules for Tipping - Let us consider the following three rules. - If service is poor or food is bad, then tip is cheap. - If service is good, then tip is average. - If service is excellent or food is delicious, then tip is generous. - Input variables - Service: represented by poor, good, excellent. - Food: represented by bad, delicious. - Output Variable: - Tip: represented by cheap, average, generous. ## The Reasoning Process for FIS (the tipping example) - "Given the quality of service and the food, how much should I tip?" - Example: What % tip to leave at a restaurant? - Input 1 - Service (0-10) - Input 2 - Food (0-10) - Rule 1: IF service is poor or food is bad THEN tip is low - Rule 2: IF service is good THEN tip is average - Rule 3: IF service is excellent or food is delicious THEN tip is generous - Crisp Inputs - Fuzzification - Inferencing - Composition - Defuzzification - Crisp Outputs - Membership functions - Fuzzy rules - Composition heuristics - Defuzzification heuristics ## Antecedent for Each Rule - 1. Fuzzify inputs - 2. Apply OR operator (max) - Antecedent of the rule: service is excellent or food is delicious - service = 3 (Input 1) - food = 8 (Input 2) - Result ## Rule's Conclusion - 1. Fuzzify inputs - 2. Apply OR operator (max) - 3. Apply implication operator (min.) - Antecedent of the rule: if service is excellent or food is delicious - Consequent: then tip is generous - service = 3 (Input 1) - food = 8 (Input 2) - Result of implication ## Aggregate Conclusions - 1. Fuzzify inputs - 2. Apply OR operator (max) - 3. Apply implication operator (min.) - 4. Apply aggregation method (max) - 1. if service is poor or food is rancid then tip is cheap - 2. if service is good then tip is average (rule 2 has no dependency on input 2) - 3. if service is excellent or food is delicious then tip is generous ## Fuzzy Applications ### In Manufacturing - **Space shuttle vehicle orbiting** - **Regulation of water temperature in shower heads** - **Selection of stocks to purchase** - **Inspection of beverage cans for printing defects** - **Matching of golf clubs to customers' swings** - **Risk assessment, project selection** - **Consumer products (air conditioners, cameras, dishwashers)** ### In Business - **Strategic planning** - **Real estate appraisals and valuation** - **Bond evaluation and portfolio design** ## Advantages of Fuzzy Logic - More natural to construct - Easy to understand - Frees the imagination - Provides flexibility - More forgiving - Shortens system development time - Increases the system’s maintainability - Uses less expensive hardware - Handles control or decision-making problems not easily defined by mathematical models - …more… ## Any Questions??? ## Thanks