Artificial Intelligence
24.04.2025
─
Prof. Saba
Govt. Graduate College of Commerce, Kamoke
1
Fuzzy System
Here’s a clear and concise explanation of the Fuzzy System, its
theory, and how fuzzy inference is used in Artificial Intelligence
(AI):
---
1. Fuzzy System Theory
Fuzzy system theory deals with reasoning that is approximate
rather than fixed and exact. It’s based on fuzzy logic, which
allows for degrees of truth (i.e., values between 0 and 1), unlike
classical Boolean logic which only allows true (1) or false (0).
Key Concepts:
Fuzzy Set: A set where elements have degrees of membership.
2
E.g., the term “hot” temperature: 30°C might be 0.7 “hot”, while
40°C is 1.0 “hot”.
Membership Function: Defines how each input is mapped to a
value between 0 and 1.
Linguistic Variables: Variables described using words (like
“low”, “medium”, “high”).
---
2. Fuzzy Inference in Artificial Intelligence
Fuzzy inference is the process of formulating the mapping from
a given input to an output using fuzzy logic. It is widely used in
AI to deal with uncertainty and approximate reasoning,
especially in expert systems, decision-making, and control
systems.
3
Steps in Fuzzy Inference:
1. Fuzzification: Convert crisp inputs into fuzzy values.
2. Rule Evaluation (Inference): Apply fuzzy rules from a rule
base.
E.g., IF temperature is high AND humidity is low THEN fan
speed is high
3. Aggregation: Combine the results of all rules.
4. Defuzzification: Convert the fuzzy output into a crisp value.
Applications in AI:
● Smart appliances (e.g., air conditioners)
● Autonomous vehicles
4
● Medical diagnosis systems
● Natural language processing
---
Example: Fuzzy Inference System for Controlling a Fan
Goal: Control the fan speed based on temperature and humidity
using fuzzy logic.
---
1. Inputs and Output
Inputs (crisp values):
Temperature: 30°C
Humidity: 40%
5
Output:
Fan Speed
---
2. Fuzzification
Convert inputs into fuzzy values using membership functions:
Temperature Membership Functions:
Low: 0°C–20°C
Medium: 15°C–30°C
High: 25°C–40°C
At 30°C:
Medium: 0.4
6
High: 0.6
Humidity Membership Functions:
Low: 0%–50%
High: 40%–100%
At 40%:
Low: 0.8
High: 0.2
---
3. Fuzzy Rules
7
Sample fuzzy rules:
1. IF Temp is High AND Humidity is Low THEN Fan Speed is
High
2. IF Temp is Medium AND Humidity is Low THEN Fan Speed
is Medium
3. IF Temp is Low AND Humidity is High THEN Fan Speed is
Low
---
4. Inference Engine
Apply the rules using min operator (AND = min):
8
Rule 1: min(High Temp 0.6, Low Humidity 0.8) = 0.6 → Fan
Speed = High (0.6)
Rule 2: min(Medium Temp 0.4, Low Humidity 0.8) = 0.4 →
Fan Speed = Medium (0.4)
---
5. Aggregation
Combine the outputs from all active rules:
Fan Speed has:
High: 0.6
Medium: 0.4
---
9
6. Defuzzification
Convert fuzzy output to a crisp value using centroid method:
Final fan speed = Weighted average of the output values.
---
Diagram
I’ll create a visual representation of this fuzzy inference system.
One moment…
It looks like you might be referring to "mining frequent patterns"
— a key concept in data mining. Let me explain it clearly:
---
10
Frequent Pattern Mining
Frequent pattern mining is the process of finding patterns (like
sets of items, subsequences, or substructures) that appear
frequently in a dataset.
Common in:
● Market Basket Analysis
● Web Usage Mining
● Bioinformatics
● Intrusion Detection
---
Key Concepts:
11
Itemset: A collection of one or more items (e.g., {milk, bread})
Support: How often an itemset appears in the dataset.
Minimum Support Threshold: Only itemsets appearing more
frequently than this threshold are considered frequent.
---
Example: Market Basket Analysis
Suppose we have a set of transactions like:
12
If the support threshold is 50%, the algorithm will find patterns
like:
{Milk} → appears in 3 out of 4 transactions → 75% → frequent
{Bread, Milk} → 2 out of 4 → 50% → frequent
13
---
Popular Algorithms:
Apriori: Classic algorithm, generates candidate sets and filters
them by support.
FP-Growth (Frequent Pattern Growth): More efficient, uses a
tree-based structure called FP-Tree.
---
14
Association and correlation:
1. Association
Association refers to rules that imply relationships between
items in large datasets.
Used in:
● Market basket analysis (e.g., Amazon, Walmart)
● Recommendation systems
● Retail analytics
Example:
If many customers who buy milk also buy bread, we can form a
rule:
"Milk → Bread"
15
This doesn’t mean milk causes bread to be bought — it just
shows they occur together frequently.
Key Metrics:
Support: How often the items appear together.
Confidence: How often the rule is true.
Lift: How much more likely bread is bought if milk is bought,
compared to chance.
---
2. Correlation
Correlation measures the strength and direction of a relationship
between two numerical variables.
Used in:
16
● Statistical analysis
● Predictive modeling
● Data science
Example:
If the number of hours studied increases, and exam scores also
increase, they are positively correlated.
Correlation Coefficient (r):
r = +1 → perfect positive correlation
r = 0 → no correlation
r = –1 → perfect negative correlation
Diagram:
visual comparison or a real dataset example to see both in action
17
18
What is Evolutionary Computing?
Evolutionary Computing is a subfield of artificial intelligence
(AI) that uses natural selection and genetics-inspired techniques
to solve complex problems.
It mimics biological evolution — survival of the fittest — to
evolve better solutions over time.
---
Key Features:
● Population of potential solutions
● Fitness evaluation
● Selection based on performance
Genetic operations: mutation, crossover (recombination), and
selection
19
---
Main Techniques in Evolutionary Computing:
1. Genetic Algorithms (GA):
Most popular.
Uses binary strings to represent solutions.
2. Genetic Programming (GP):
Evolve computer programs or expressions.
3. Evolution Strategies (ES):
Focused on real-valued optimization.
4. Differential Evolution (DE):
20
Good for numerical problems.
5. Evolutionary Programming (EP):
Originally for evolving finite state machines.
---
General Steps in Evolutionary Algorithm:
1. Initialization: Create a random population.
2. Evaluation: Measure fitness of each individual.
3. Selection: Choose better solutions.
4. Crossover & Mutation: Create new individuals.
5. Replacement: Form the next generation.
6. Termination: Repeat until stopping condition is met.
21
---
Applications:
● Optimizing design parameters
● Machine learning hyperparameter tuning
● Game playing AI
● Robotics
● Scheduling and planning
---
What is a Genetic Algorithm (GA)?
A Genetic Algorithm is an optimization technique inspired by
natural evolution. It finds good solutions to problems by
simulating the process of natural selection.
22
---
Key Concepts:
Chromosome (Individual): A possible solution (usually encoded
as a string of bits, numbers, or symbols).
Population: A group of chromosomes.
Fitness Function: Measures how good a solution is.
Selection: Chooses the fittest individuals for reproduction.
Crossover (Recombination): Combines parts of two
chromosomes to create a new one.
Mutation: Randomly changes part of a chromosome to maintain
diversity.
Generation: One cycle of selection, crossover, and mutation.
23
---
How GA Works (Step-by-Step):
1. Initialization:
Generate a random population of solutions.
2. Evaluation:
Use the fitness function to evaluate each solution.
3. Selection:
Select the fittest individuals for reproduction (e.g., roulette
wheel or tournament selection).
4. Crossover:
Combine parts of selected individuals to create offspring.
24
5. Mutation:
Randomly change parts of offspring to introduce variation.
6. Replacement:
Replace the old population with the new one.
7. Termination:
Stop if a solution is good enough or after a certain number of
generations.
---
Example:
Problem: Maximize the number of 1s in a binary string of
length 8.
Chromosome: 10101011
Fitness: Number of 1s = 6
25
---
Applications:
● Engineering design
● Scheduling problems
● Game strategies
● Feature selection in machine learning
● Optimization in AI systems
---
Applications of Genetic Algorithms
Genetic Algorithms are powerful for solving optimization
and search problems where traditional methods struggle.
26
Common Applications:
1. Function Optimization:
Find the maximum/minimum of complex mathematical
functions.
2. Scheduling Problems:
Optimize task or job schedules (e.g., timetables, airline
schedules).
3. Route Planning:
Solve problems like the Traveling Salesman Problem
(TSP).
4. Game Playing & AI:
Evolve strategies for bots or characters.
27
5. Machine Learning:
Feature selection, hyperparameter tuning.
6. Robotics:
Path planning and control system design.
7. Engineering Design:
Structural optimization, antenna design.
---
Example: Maximize the Number of 1s in a Binary String
28
Problem:
Find a binary string of length 6 that has the maximum
number of 1s.
Chromosome:
Each solution is a 6-bit binary string.
E.g., 101011, 110110, 000111
Fitness Function:
Number of 1s in the string.
E.g., 101011 → fitness = 4
Steps:
1. Initial Population: Random strings like:
100101, 111000, 001111
29
2. Evaluate Fitness:
Count number of 1s in each.
3. Selection:
Pick the best (most 1s) for reproduction.
4. Crossover:
Combine parts of parents:
Parent 1: 101100
Parent 2: 110011
Offspring: 101011
5. Mutation:
Randomly flip a bit: `101
30
In Genetic Algorithms (GA), genetic operators are the core
mechanisms that mimic natural evolution. They are used to
generate new solutions from existing ones.
---
Main Genetic Operators
1. Selection
Purpose: Choose the best individuals (parents) for
reproduction based on fitness.
Common methods:
31
Roulette Wheel Selection: Probability of selection is
proportional to fitness.
Tournament Selection: Randomly select a group, and
choose the best from them.
Rank Selection: Rank individuals and select based on their
position.
---
2. Crossover (Recombination)
Purpose: Combine genetic material from two parents to
produce offspring.
Types:
32
Single-Point Crossover: A point is selected, and the tail
parts are swapped.
Parent1: 110|101
Parent2: 011|010
Offspring: 110010
Two-Point Crossover: Two points are chosen, and the
middle part is swapped.
Uniform Crossover: Each gene is randomly selected from
one of the parents.
33
---
3. Mutation
Purpose: Introduce diversity and prevent premature
convergence.
How it works: Randomly flips bits or changes values.
E.g., 101011 → 100011 (flipped 2nd bit)
---
4. Replacement
Purpose: Decide which individuals survive to the next
generation.
34
Strategies:
● Replace the worst individuals.
● Keep some best ones (elitism).
● Replace randomly.
---
5. Elitism (optional)
Purpose: Ensure the best solutions are carried forward.
How: Keep top 1 or more individuals unchanged in each
generation.
35
---