Intelligent Computing - Note
Intelligent Computing - Note
This is the simplest form of artificial neuron, introduced by Frank Rosenblatt in the 1950s. It takes multiple
numerical inputs, assigns weights to each input, sums them, and applies an activation function to produce a
single output.
● Inputs: These are numerical values representing the data being processed.
● Weights: These are coefficients assigned to each input, signifying their importance to the output.
● Summation: A weighted sum of the inputs is calculated.
● Activation Function: This function transforms the weighted sum into a meaningful output value. A
common activation function used in Rosenblatt's neuron is the threshold function, which outputs 1 if the
sum is greater than a threshold value and 0 otherwise.
This algorithm allows a perceptron to learn from data. It iterates through training examples, adjusts the weights
based on the difference between the desired output and the actual output of the neuron.
1. The perceptron receives an input and calculates the weighted sum.
2. The activation function is applied to get the output.
3. The difference between the desired output (correct answer) and the actual output (perceptron's
prediction) is calculated (error).
4. The weights are adjusted proportionally to the error, bringing the output closer to the desired value.
5. Steps 1-4 are repeated for all training examples until the perceptron achieves a satisfactory level of
accuracy.
This theorem states that a single perceptron can learn and perfectly classify any set of linearly separable data. In
simpler terms, if the data can be separated by a straight line in the input space, a perceptron can be trained to
correctly classify it. However, for more complex datasets that are not linearly separable, a single perceptron is
limited.
4. Activation Functions:
Page 1 of 5
These are mathematical functions applied to the weighted sum of inputs in an artificial neuron. They introduce
non-linearity into the network, allowing it to learn more complex patterns. Here are some commonly used
activation functions:
● Threshold Function: Outputs 1 if the input is greater than a threshold, 0 otherwise (used in Rosenblatt's
neuron for simple binary classification).
● Sigmoid Function: Outputs a value between 0 and 1, often used for representing probabilities.
● Tanh Function: Outputs a value between -1 and 1, similar to the sigmoid function but with a steeper
slope.
● ReLU (Rectified Linear Unit): Outputs the input directly if it's positive, otherwise outputs 0. This
function is popular due to its computational efficiency.
This is a single-layer neural network introduced by Bernard WidrSow in the 1960s. It builds upon the
perceptron by using a linear combination of inputs and a continuous, differentiable activation function (like the
sigmoid function). This allows ADALINE to use a more robust learning algorithm called the Widrow-Hoff rule
for weight updates, overcoming some limitations of the perceptron training algorithm.
Overall, these concepts lay the foundation for understanding more complex neural network architectures that
are widely used in various applications today.
● Forward Pass: The input data propagates through the network, with each layer applying its weights and
activation function. The final output is obtained.
● Error Calculation: The difference (error) between the network's output and the desired output is calculated.
● Backward Pass: The error is propagated backward through the network layer by layer. The weights are adjusted
proportionally to their contribution to the error, using techniques like gradient descent.
● Iteration: The forward and backward passes are repeated for multiple training examples until the overall error on
the training data is minimized.
●
Page 3 of 5
(centers and widths). The weights in the output layer are often solved using linear regression, making
training faster than some other neural network architectures.
Advantages of RBFNs:
● Fast Learning: Due to the simpler training process, RBFNs can learn from data relatively quickly.
● Universal Approximation: Similar to multi-layer neural networks with one hidden layer and non-linear
activation, RBFNs can theoretically approximate any continuous function to an arbitrary degree of
accuracy.
● Effective for Interpolation: RBFNs excel at finding a function that passes exactly through a set of data
points (interpolation problems).
Disadvantages of RBFNs:
● Choice of Centers and Spreads: Selecting appropriate centers and spreads is critical and can be
challenging.
● Scalability: The number of hidden neurons can become large for complex problems, leading to
increased computational cost.
● Memory Usage: Storing the centers and spreads for a large number of radial basis functions can require
significant memory.
● Selection of RBF Parameters: Choosing the right number, centers, and widths of RBFs can be
challenging and can significantly impact the network's performance.
● Overfitting: Like other neural networks, RBFNs are susceptible to overfitting if not trained carefully
with techniques like cross-validation.
Applications of RBFNs:
● Normalized Hidden Unit Activations: This approach improves stability and generalization by
normalizing the outputs of hidden layer units.
● Soft Competition: Introduces a competition mechanism among hidden units based on their activations.
Units with outputs closer to the desired outcome have a greater influence on the final output.
In conclusion, RBFNs are a powerful tool for function approximation and various applications. Their fast
learning speed and strong theoretical foundation make them a valuable choice for specific tasks. However,
careful consideration of RBF parameters and training strategies is crucial to achieve optimal performance.
1. Select Centers: Choose the centers cj\mathbf{c}_jcjfor the RBFs, often done through clustering techniques like
k-means.
2. Compute RBF Values: Calculate the RBF values for each input data point.
3. Linear Weight Calculation: Solve a linear system to determine the weights that minimize the error between the
network output and the actual output.
● Normalized Hidden Unit Activations: This technique normalizes the sum of activations from all
hidden units. This can improve the stability and performance of the network.
● Soft Competition: This approach introduces a competition mechanism among hidden units. Units that
contribute more to the output receive a higher weight, promoting sparsity and potentially faster training.
Kernel Regression
Kernel regression is a non-parametric technique to estimate the conditional expectation of a random variable.
The idea is to predict the value of a dependent variable based on a weighted sum of the observed values, where
the weights are given by a kernel function. In the context of RBF networks, it can be described as:
Page 5 of 5
Unit :-1 Introduction to Computational Intelligence
Intelligent systems are systems that can reason, learn, and act autonomously. They are inspired by the human brain and
nervous system, and they are designed to solve problems that are difficult or impossible for traditional computers. There
are many different types of intelligent systems, including:
Expert systems are systems that contain knowledge about a specific domain and can use that knowledge to solve
problems.
Machine learning systems are systems that can learn from data without being explicitly programmed.
Natural language processing systems are systems that can understand and generate human language.
Robotics systems are systems that can sense and manipulate their environment.
A.Intelligent Systems
Intelligent Systems are designed to emulate aspects of human intelligence. These systems can process
information, learn from data, make decisions, and solve problems. They find applications in robotics,
natural language processing, expert systems, and more.
Page 1 | 5
Computational Intelligence involves the use of nature-inspired computational methodologies and
approaches to create intelligent systems. It includes methods that can handle imprecise, uncertain, and
incomplete information. The main paradigms in CI include:
1. Supervised Learning In supervised learning, the model is trained on a labeled dataset, which means
that each training example is paired with an output label. This is commonly used in classification and
regression tasks.
2. Unsupervised Learning In unsupervised learning, the model is trained on data without labeled
responses. The goal is to infer the natural structure present within a set of data points. Clustering and
dimensionality reduction are typical tasks.
3. Reinforcement Learning This paradigm involves an agent learning to make decisions by performing
actions in an environment to maximize cumulative reward. It is extensively used in robotics, game
playing, and autonomous systems.
4. Hybrid Systems Combining multiple CI techniques to leverage their complementary strengths.
For instance, neuro-fuzzy systems integrate neural networks and fuzzy logic, and evolutionary neural
networks use evolutionary algorithms to optimize neural network architectures.
Page 2 | 5
● Natural Immune System: This is your body's defense system against infections and illnesses. It's a
complex network of organs, cells, and tissues that work together to identify and eliminate germs like
bacteria and viruses. The natural immune system has two main branches: the innate immune system
and the adaptive immune system.
o The innate immune system is the first line of defense and provides a general response to germs.
It includes physical barriers like skin and mucous membranes, white blood cells, and
inflammatory responses. The adaptive immune system is more specific and develops immunity
to specific germs over time. It includes B cells and T cells, which produce antibodies and target
infected cells directly.
● Antibodies:These are Y-shaped proteins produced by B cells of the adaptive immune system.
Antibodies are designed to recognize and attach to specific antigens (foreign substances) like bacteria
or viruses. Once attached, antibodies can neutralize the germ, flag it for destruction by other immune
cells, or prevent it from infecting healthy cells.
● Antigen:These are foreign substances that trigger an immune response. They can be molecules on the
surface of bacteria, viruses, fungi, or parasites. Antigens can also be toxins or pollen. When an antigen
enters the body, the immune system identifies it as a threat and starts producing antibodies to fight it.
● Lymphocytes: These are white blood cells that are the main players in the adaptive immune system.
There are two main types of lymphocytes: B cells and T cells.
o B cells mature in the bone marrow and produce antibodies.
o T cells mature in the thymus and attack infected cells directly or help regulate the immune
response.
● Lymphoid Organs: These are the organs and tissues where lymphocytes are produced, mature, and
stored. The major lymphoid organs include the thymus, bone marrow, spleen, and lymph nodes.
o The thymus is located in the chest and is responsible for maturing T cells.
o The bone marrow is found in the center of bones and is where B cells mature.
o The spleen is a fist-sized organ located in the upper left part of the abdomen that filters blood,
stores immune cells, and helps produce antibodies.
o Lymph nodes are small, bean-shaped structures located throughout the body that are
connected by lymphatic vessels. They filter lymph fluid, which contains white blood cells, and
help launch an immune response.
● Danger Theory:This theory proposes that the immune system doesn't just respond to foreign
substances (antigens), but also to signs of cellular damage or distress within the body. These danger
signals can be released by damaged or dying cells, or by pathogens (disease-causing germs) that are
trying to invade cells. By recognizing these danger signals, the immune system can initiate an
inflammatory response to isolate and destroy damaged cells or invading germs.
The natural immune system is a complex and fascinating system that helps keep us healthy. By understanding
how it works, we can take steps to support our immune system and fight off infection.
The Artificial Immune System (AIS) is a field of computational intelligence inspired by the principles and processes of the
biological immune system. It aims to develop algorithms and systems that can solve complex problems in various
domains, such as anomaly detection, optimization, and machine learning. Here's an overview of the key concepts and
models in AIS, particularly focusing on the classical view model:
Page 3 | 5
C. Artificial Immune Model
Artificial Immune Systems (AIS) are a subfield of Artificial Intelligence inspired by the workings of the natural
immune system. They borrow concepts from immunology to develop algorithms that can solve problems in
various domains.
There are different approaches to designing AIS, and the classical view model is one of them. This model draws
inspiration from the way T-cells in the immune system identify and eliminate "self" (healthy cells) from
"non-self" (pathogens).
Here's a breakdown of the classical view model in AIS:
● Antibodies (detectors): In the classical view, AIS uses detectors inspired by antibodies. These detectors
represent potential solutions to a problem.
● Antigens (data): The data or problem instances are mapped to antigens, which the detectors
(antibodies) interact with.
● Affinity function: A function determines how well a detector matches the antigen. This reflects how
suitable a potential solution is for the given data point.
● Selection: Detectors with high affinity for the "self" data (representing correct solutions) are selected
and potentially cloned. This mimics how the immune system selects effective T-cells.
● Diversity: Mechanisms are introduced to maintain diversity among the detectors. This ensures the
system can adapt to new challenges, similar to how the immune system learns to recognize new
pathogens.
● Anomaly detection: Identifying unusual patterns in data, mimicking how the immune system detects
foreign agents.
● Pattern recognition: Classifying data points into different categories based on their characteristics.
● Optimization problems: Finding the best solution among a set of possibilities.
● Antibodies (detectors): In the classical view, AIS uses detectors inspired by antibodies. These detectors
represent potential solutions to a problem.
● Antigens (data): The data or problem instances are mapped to antigens, which the detectors
(antibodies) interact with.
● Affinity function: A function determines how well a detector matches the antigen. This reflects how
suitable a potential solution is for the given data point.
● Selection: Detectors with high affinity for the "self" data (representing correct solutions) are selected
and potentially cloned. This mimics how the immune system selects effective T-cells.
● Diversity: Mechanisms are introduced to maintain diversity among the detectors. This ensures the
system can adapt to new challenges, similar to how the immune system learns to recognize new
pathogens.
Page 4 | 5
● Anomaly detection: Identifying unusual patterns in data, mimicking how the immune system detects
foreign agents.
● Pattern recognition: Classifying data points into different categories based on their characteristics.
● Optimization problems: Finding the best solution among a set of possibilities.
Page 5 | 5
Unit 6: Deep Learning
A. Basic Idea: Introduction to Deep Learning
Deep learning is a subfield of artificial intelligence (AI) that's rapidly transforming how machines learn and
interact with the world. Inspired by the structure and function of the human brain, deep learning utilizes artificial
neural networks to extract meaningful patterns from massive amounts of data.
1
Common architectural principles of Deep Networks (Parameters,Layers, Activation functions, Loss functions,
Optimization algorithm, Hyper parameters)
2
3
4
5
6
Major Architectures of Deep Networks: Generative Adversarial Networks, Convolutional Neural Network (CNN
Architecture, Input layers, Convolution layers, Pooling layers, Fully connected layers), Recurrent Neural Network
(RNN architecture, Modeling the time dimension, LSTM networks)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Transformers: Encoder decoder architecture (Encoder only, Decoder only, Encoder-decoder), LLM (Large
Language Models, Pre-training, fine-tuning), Issues with RNN encoder decoder, Attention mechanism
21
22
Large Language Models (LLMs):
Imagine an LLM as a super-powered language learner. These models are trained on massive amounts of text
data, allowing them to grasp the nuances of language, including grammar, syntax, and even some aspects of
semantics. They can perform a variety of tasks, such as:
● Text generation: Creating different creative text formats, like poems, code, scripts, musical pieces,
emails, letters, etc.
● Machine translation: Converting text from one language to another.
● Question answering: Providing summaries or answers to questions posed in natural language.
● Text summarization: Condensing lengthy pieces of text into shorter summaries.
Pre-training:
Think of pre-training as giving the LLM a strong foundation in general language understanding. It involves
training the model on a vast corpus of unlabeled text data, like books, articles, or code. This data doesn't have
specific labels or tasks associated with it. During pre-training, the LLM learns to identify patterns and
relationships within language, like predicting the next word in a sequence or understanding the overall
sentiment of a piece of text.
Fine-tuning:
Here's where LLMs become true specialists. Fine-tuning takes a pre-trained LLM and tailors it for a specific
task. This involves training the model on a smaller dataset of labeled data relevant to the desired task. For
example, to create a machine translation model for French to English, you would fine-tune the LLM on a
dataset of French-English text pairs. Fine-tuning leverages the general language understanding from
pre-training and refines it for the specific task, significantly improving performance.
23
Unit 5: Computational Swarm Intelligence
Particle Swarm Optimization: Basic principles of computational swarm intelligence (Swarm in Known andUnknown
environments), Particle swarm optimization (Influence of the parameters, Turbulence factor, Boundary handling, Global
best and local best PSO), Social network structures, Basic variations (Velocity clamping, Inertia weight, Construction
coefficient, Synchronous vs Asynchronous updates, Velocity models)
Single Solution Particle Swarm Optimization: Guaranteed convergence PSO, Social based PSO, Hybrid
algorithm, Sub swarm based PSO, Multi start PSO algorithm, Repelling models, Binary PSO, Multi-objective
PSO (Leader selection mechanism)
Optimization
Unit 4: Evolutionary Computation (8 Hrs.)
Introduction to Computation
Evolutionary Computation (EC) is a problem-solving technique inspired by biological evolution which
mimics natural selection, survival of the fittest, and reproduction.
Advantages of Computation
Effective exploration of large solution spaces.
Ability to handle complex, non-linear optimization problems.
Versatility across domains: engineering, finance, biology, Al.
Iterative refinement mirrors adaptive processes in nature.
Biological evolution is the process through which living organisms change over successive generations,
driven by two fundamental principles: variation and natural selection.
1. Variation: Within a population of organisms, there exists genetic diversity due to mutations, genetic
recombination, and other factors. This variation results in individuals having different traits and
characteristics.
2. Natural Selection: Organisms with traits that offer advantages for survival and reproduction in their
environment are more likely to pass on their genes to the next generation. This process, known as
natural selection, leads to the gradual accumulation of beneficial traits and the elimination of less
advantageous ones.
Representation — The Chromosome
In nature, chromosomes determine an organism's traits.
Similarly, in EC, each individual (potential solution) has a chromosome that represents its
characteristics.
The chromosome, also called a genome, encodes the variables being optimized.
Fitness Function
The fitness function (denoted as f) quantifies the quality of a solution represented by a chromosome in
an evolutionary algorithm. It maps a chromosome representation to a scalar value.
The fitness function can be represented as f: Tn -+ R, where T represents the data type of chromosome
elements and n represents the chromosome dimensions.
The fitness function typically represents the objective function of the optimization problem being
solved by the EA.
Fitness functions can provide either absolute measures of fitness, directly evaluating the solution using
the objective function, or relative fitness measures, comparing an individual's performance to others in
the population.
Fitness Function
The type of optimization problem influences the fitness function design
Unconstrained: The fitness function directly corresponds to the objective function.
Constrained: Penalty functions might be added to account for constraints alongside the original
objective.
Multi-Objective: The fitness function can be a weighted sum of sub-objectives.
Dynamic/Noisy: The function might change over time or incorporate noise.
Selection
• Selection is indeed a fundamental aspect of evolutionary algorithms (EAs), mirroring the principles of
natural selection.
• It plays a crucial role in shaping the population of candidate solutions over successive generations.
Selective Pressure
Selection operators are characterized by their selective pressure, also referred to as the takeover time, which
relates to the time it requires to produce a uniform population. It is defined as the speed at which the best
solution will occupy the entire population by repeated application of the selection operator alone. An operator
with a high selective pressure decreases diversity in the population more rapidly than operators with a low
selective pressure, which may lead to premature convergence to suboptimal solutions. A high selective
pressure limits the exploration abilities of the population.
Random selection
Random selection is the simplest selection operator, where each individual has the same probability of l/n
(where n is the population size) to be selected. No fitness information is used, which means that the best and
the worst individuals have exactly the same probability of surviving to the next generation. Random selection
has the lowest selective pressure among other selection operators.
Proportional Selection
Proportional selection, proposed by Holland, biases selection towards the most-fit individuals. A
probability distribution proportional to the fitness is created, and individuals are selected by sampling
the distribution, f(xz)
(þ(Xi)
Where, n = total number of individuals in the is the probability that x will be selected, f(x.) is the scaled
fitness of x
Two popular sampling methods used in proportional selection are
Tournament
Tournament selection selects a group of t individuals randomly from the population, where t < n (n is the total
number of individuals in the population). The performance of the selected t individuals is compared and the
best individual from this group is selected and returned by the operator. For crossover with two parents,
tournament selection is done twice, once for the selection of each parent.
Provided that the tournament size, t, is not too large, tournament selection prevents the best individual from
dominating, thus having a lower selection pressure. On the other hand, if t is too small, the chances that bad
individuals are selected increase.
Even though tournament selection uses fitness information to select the best individual of a tournament,
random selection of the individuals that make up the tournament reduces selective pressure compared to
proportional selection. However, note that the selective pressure is directly related to t. If t = n, the best
individual will always be selected, resulting in a very high selective pressure. On the other hand, if t = 1,
random selection is obtained.
Boltzmann
Boltzmann selection is based on the thermodynamical principles of simulated annealing. It has been
used in different ways, one of which computes selection probabilities as follows:
1
Where T is temperature parameter. A temperature schedule is used to reduce T from its initial large value to
a small value. The initial large value ensures that all individuals have an equal probability of being selected.
As T becomes smaller, selection focuses more on the good individuals.
Elitism
Elitism refers to the process of ensuring that the best individuals of the current population survive to the next
generation. The best individuals are copied to the new population without being mutated. The more individuals
that survive to the next generation, the less the diversity of the new population.
Hall of Fame
The hall of fame is a selection scheme similar to the list of best players of an arcade game. For each generation,
the best individual is selected to be inserted into the hall of fame. The hall of fame will therefore contain an
archive of the best individuals found from the first generation. The hall of fame can be used as a parent pool
for the crossover operator, or, at the last generation, the best individual is selected as the best one in the hall
of fame.
Reproduction Operators
Reproduction is the process of producing offspring from selected parents by applying crossover and/or
mutation operators.
Crossover is the process of creating one or more new individuals through the combination of genetic
material randomly selected from two or more parents.
Mutation is the process of randomly changing the values of genes in a chromosome.
Reproduction can be applied with replacement, in which case newly generated individuals replace
parent individuals only if the fitness of the new offspring is better than that of the corresponding parents.
Evolutionary Optimization
Evolutionary Optimization is a technique inspired by evolution to find optimal solutions to problems.
There are two main types of evolutionary optimization:
• Quantitative: Uses numerical measures (functions) to assess the quality of potential solutions. Examples
include minimizing distance or maximizing profit.
Halting Criteria: The process may stop after a certain number of generations or when the score of the best
solution falls below a threshold, such as 10-6 if it's known that zero is the minimum for f(x)=x2
Example in One Dimension
Generation 1:
1. Initialization: Generate 5 random candidate solutions, , , x3,
x4, a:5, uniformly chosen between -100 and +100.
— —23, 45, = 12, — O, = 87
2. Mutation: Generate 5 offspring by adding a random number
from a standard Gaussian distribution to each parent.
Let's say after mutation:
.T6 = —23.1, .T,7 = 45.8, = 11.3, = 0.5, = 87.2
3. Evaluation: Evaluate the fitness (score) of each solution by
computing f (Xi) = for each i in the population.
f(œl) = 529, f(œ2) = 2025, f(œ3) = 144, f(œ4) = O, f(œ5) 7569
f(œ6) = 532.81, f@7) = 2101.64, f@8) = 127.69, f(œ9) = 0.25,
= 7594.84
4. Selection: Select the 5 best-ranking solutions to become the
parents for the next generation.
Generation 2:
ChatGPT: Calculation might be wrong
• Comparative studies using different operators reveal their effectiveness in finding optimal solutions.
• PMX combined with inversion shows promise, outperforming individual operators in certain scenarios.
• The need for dynamic operator selection to adapt to the evolving search process is highlighted.
Extension to Real-World Problems:
• These problems require tailored approaches that leverage evolutionary algorithms to efficiently explore
solution spaces.
Niching
Niching in Evolutionary Strategies (ES) is a technique used to find multiple solutions to a problem,
particularly in scenarios with multiple local optima (peaks) in the fitness landscape. Here's a breakdown of
two niching approaches for ES:
Multipopulation ES with Clusters by Aichholzer et al.:
This method utilizes multiple subpopulations (T) to explore different regions of the search space.
Each individual has a lifespan of K generations within its subpopulation.
Recombination:
One parent is chosen from the current subpopulation using roulette wheel selection.
The second parent is selected from any subpopulation, but with a bias towards individuals from closer
subpopulations. This promotes exploration within clusters formed around local optima.
Niching
Dynamic Niching Algorithm by Shir and Bäck:
This algorithm identifies fitness peaks using a peak identification algorithm, with each peak
corresponding to a niche.
In each generation, mutation is applied to individuals, and then a dynamic peak identification algorithm
identifies niches.
Individuals are assigned to their closest niche, and recombination is applied within niche boundaries.
Niches are populated with offspring, ensuring diversity and exploration of multiple solutions.
New niches are generated at each generation, allowing for continuous exploration of diverse solutions.
Parameters
Strategy parameters are used to control the amount of change that is introduced into an individual during
mutation.
Static strategy parameters:
In this approach, the strategy parameters are fixed for the entire evolutionary run. This is the simplest
approach, but it can be difficult to find good values for the strategy parameters that will work well for all
problems.
Self Adaptation
The ability of an evolutionary algorithm to adjust its variation operators during the search process to
improve performance.
In evolutionary algorithms, parameters such as mutation rates or step sizes significantly impact the
algorithm's performance.
Self-adaptation involves allowing these parameters to evolve over time during the optimization process.
The problem: Standard EAS use fixed parameters for variation operators (e.g., mutation step size). This can
lead to a trade-off between exploration (finding new areas) and exploitation (refining good solutions)
Epistasis
Similarly encoded candidate solutions should have a similar fitness.
In biology epistasis means the phenomenon that one allele of a gene (the so-called epistatic gene) suppresses
the effect of all possible alleles of another gene.
In evolutionary algorithms, epistasis refers to the interaction between genes in a chromosome, where
modifying one gene can significantly affect the fitness of the solution candidate, potentially leading to
difficulties in optimization.
The issue:
• In high epistasis cases, a small change in the genotype (chromosome) can cause a large change in the
phenotype (solution candidate) and its fitness. This violates the assumption that gradual
improvements are possible through minor genetic modifications.
Epistasis - Example TSP
Low Epistasis Encoding:
Represented by a permutation of cities, where each city's position in the permutation corresponds
to its visitation order in the round trip.
Modifying genes (swapping cities) results in comparable changes in fitness, regardless of which
genes are swapped.
Changes to the tour are localized, affecting only nearby cities, as the rest of the tour remains
unaffected.
High Epistasis Encoding:
Genetic Operators
Mutation Operators
Genetic one-parent operators are generally referred to as mutation or variation operators. Such operators
mainly serve the purpose to introduce an element of local search, that is, to produce a solution candidate that
is (very) similar to its parent.
Different types of mutation operators include:
Bit Mutation: Used for binary encoded chromosomes, where randomly selected bits are flipped.
Gaussian Mutation: Applied to chromosomes represented by real-valued numbers, where random
numbers from a Gaussian distribution are added to each gene.
Self-adaptive Gaussian Mutation: Each chromosome has its own mutation step width, which evolves
over generations based on its performance.
3144361
123456 123456
5212546
Fig. 12.13 Example of one-point crossover
5214361 5142546
123456 123456
3214346
Fig. 12.14 Example of two-point crossover
3 2
5 1 12 566
Fig. 12.15 Example of uniform crossover. For every gene it is determined independently whether it
is exchanged (+) or not (—)
shuffle crossover de-shuffle
ecurrent Neural Networks (RNNs) and Transformers are two types of neural network architectures
used primarily for processing sequential data, such as language, time series, or any other data that
is naturally ordered. Here's a detailed distinction between them along with an explanation of the
Transformer architecture.
Characteristics:
1. Sequential Processing: RNNs process input sequences one element at a time. They
maintain a hidden state that captures information about previous elements in the sequence.
2. Hidden State: The hidden state is updated at each time step based on the current input and
the previous hidden state.
3. Temporal Dependencies: RNNs are designed to capture temporal dependencies in
sequences, making them suitable for tasks like language modeling, time series prediction,
and more.
4. Vanishing/Exploding Gradient Problems: RNNs can suffer from vanishing or exploding
gradient problems during training, making it difficult to learn long-range dependencies.
Architecture:
Transformer Architecture
Transformers were introduced in the paper "Attention is All You Need" by Vaswani et al. in 2017.
They revolutionized the field of natural language processing by addressing some of the limitations
of RNNs.
Characteristics:
1. Parallel Processing: Unlike RNNs, Transformers process the entire input sequence
simultaneously, allowing for more efficient computation and training.
2. Attention Mechanism: Transformers rely on self-attention mechanisms to weigh the
importance of different elements in the input sequence, enabling them to capture long-
range dependencies more effectively.
3. No Recurrent Connections: Transformers do not use recurrent connections, thus avoiding
issues related to vanishing and exploding gradients.
4. Scalability: They are highly scalable and have been shown to perform exceptionally well
on a variety of tasks, including language translation, text generation, and more.
1|Page
Architecture:
Encoder-Decoder Structure:
Key Components:
• Multi-Head Attention: Allows the model to jointly attend to information from different
representation subspaces.
o Scaled Dot-Product Attention: Computes the attention scores using the queries,
keys, and values.
o Concatenation and Linear Transformation: Combines the outputs from multiple
attention heads and projects them back into the original dimension.
• Position-wise Feed-Forward Networks: Apply two linear transformations with a ReLU
activation in between.
• Positional Encoding: Adds information about the relative or absolute position of tokens
in the sequence.
Attention Mechanism:
• Self-Attention: For each token in the input sequence, computes a weighted sum of all other
tokens, allowing the model to focus on different parts of the sequence.
• Scaled Dot-Product Attention Formula:
2|Page
2. Explain about any two selection approaches in evolutionary algorithm. Discuss about
the significance of PSO in social network structure.
Selection in EAs mimics natural selection, where individuals with better fitness are more likely to
reproduce and pass their traits (solutions) to the next generation. Here are two common
approaches:
Selection in EAs mimics natural selection, where individuals with better fitness are more likely to
reproduce and pass their traits (solutions) to the next generation. Here are two common
approaches:
Particle Swarm Optimization (PSO) is a swarm intelligence technique inspired by the collective
behavior of flocks of birds or schools of fish. It can be a valuable tool for analyzing and optimizing
social network structures due to the following reasons:
• Community Detection: PSO can be used to identify communities within a social network.
Particles can represent potential communities, and their fitness can be evaluated based on
metrics like modularity (density of connections within communities compared to between
3|Page
them). By iteratively updating positions based on successful communities, PSO can
efficiently locate clusters of densely connected nodes.
• Influence Maximization: In social networks, identifying influential nodes is crucial for
marketing or spreading information. PSO can be adapted to find these influential nodes.
Particles represent seed sets (initial nodes for information diffusion), and their fitness can
be based on the number of nodes eventually reached through information propagation. PSO
helps identify the most influential nodes to maximize the spread of information.
• Network Optimization: PSO can be used to optimize network properties like path lengths
between nodes or network diameter (longest distance between any two nodes). By
adjusting connection strengths or network topology based on particle fitness, PSO can help
create efficient information flow or reduce communication overhead in social networks.
Principle:
• A subset of individuals is randomly chosen from the population, and the fittest individual
from this subset is selected.
Steps:
1. Randomly select a predefined number of individuals (the tournament size) from the
population.
2. Determine the individual with the highest fitness in this subset.
3. Repeat the process until the desired number of individuals is selected.
Advantages:
• Can be tuned by adjusting the tournament size, balancing between selection pressure and
diversity.
• More robust against individuals with extremely high fitness values dominating the
population.
Disadvantages:
• Selection bias can be introduced if the tournament size is not properly chosen.
• Can be computationally expensive if the tournament size is large.
4|Page
Significance of PSO in Social Network Structure
Particle Swarm Optimization (PSO) is a swarm intelligence technique inspired by the collective
behavior of flocks of birds or schools of fish. It can be a valuable tool for analyzing and optimizing
social network structures due to the following reasons:
• Community Detection: PSO can be used to identify communities within a social network.
Particles can represent potential communities, and their fitness can be evaluated based on
metrics like modularity (density of connections within communities compared to between
them). By iteratively updating positions based on successful communities, PSO can
efficiently locate clusters of densely connected nodes.
• Influence Maximization: In social networks, identifying influential nodes is crucial for
marketing or spreading information. PSO can be adapted to find these influential nodes.
Particles represent seed sets (initial nodes for information diffusion), and their fitness can
be based on the number of nodes eventually reached through information propagation. PSO
helps identify the most influential nodes to maximize the spread of information.
• Network Optimization: PSO can be used to optimize network properties like path lengths
between nodes or network diameter (longest distance between any two nodes). By
adjusting connection strengths or network topology based on particle fitness, PSO can help
create efficient information flow or reduce communication overhead in social networks.
State decomposition theory is a concept not typically used in machine learning or artificial
intelligence. It's more commonly found in control theory, particularly optimal control. Here, the
theory deals with decomposing a complex system into simpler subsystems or states. This allows
for easier analysis and design of control strategies.
For instance, imagine a robot arm with multiple joints. State decomposition theory would break
down the arm's movement into individual joint states (angles, velocities). This simplifies control
by focusing on manipulating each joint independently to achieve the desired overall motion.
Fuzzy set theory deals with sets where elements have a degree of membership, ranging from 0
(completely not belonging) to 1 (completely belonging). Unlike crisp sets where membership is
binary (in or out), fuzzy sets allow for vagueness and partial membership. Here are some common
operations on fuzzy sets with examples:
• Union (OR): This represents elements belonging to either set A or set B, or both. Example:
If "Tall" is a fuzzy set for heights, the union of "Tall" and "Average" might include people
of height 1.70m to 1.90m with varying degrees of membership depending on their specific
height.
5|Page
• Intersection (AND): This represents elements belonging to both set A and set B. Example:
The intersection of "Young" (age 18-30) and "Experienced" (work experience > 5 years)
might include people aged 25-30 with high membership and younger/older people with
lower membership depending on their experience.
• Complement (NOT): This represents elements not belonging to set A. Example: The
complement of "Cold" (temperatures below 15°C) would be "Warm or Hot" with varying
degrees of membership depending on the specific temperature.
These terms refer to different training paradigms for machine learning models:
• Batch Learning: In batch learning, the entire training dataset is used to update the model's
parameters in one go. This is common for tasks where data is readily available upfront.
Batch learning can be computationally expensive for large datasets but can lead to good
model performance.
• Online Learning: Here, the model is updated incrementally as it receives new data points
one at a time. This is useful for real-time applications where data is constantly streaming
in. While online learning can adapt quickly to changing data, it may not achieve the same
level of accuracy as batch learning on the entire dataset.
Fuzzy c-means (FCM), also known as fuzzy C-means clustering, is a soft clustering technique used
to group data points belonging to multiple clusters with varying degrees of membership. This
6|Page
differs from traditional k-means clustering, which assigns each data point to a single, exclusive
cluster.
• Customer segmentation: Fuzzy c-means can be used to segment customers based on their
purchase history or demographics, identifying groups with varying degrees of overlap (e.g.,
customers who sometimes buy both budget and premium products).
• Image segmentation: By clustering image pixels based on color or intensity, fuzzy c-
means can help identify objects with fuzzy boundaries in images.
• Medical diagnosis: Fuzzy c-means can be used to analyze patient data and identify groups
with varying risk factors for a disease.
7|Page
Hamming cliffs are a challenge encountered in using binary encoding for solution candidates in
optimization algorithms, particularly Genetic Algorithms (GAs). Here's how they arise:
• Binary Encoding: In GAs, solution candidates are often represented as binary strings. For
example, a solution with 3 variables (each taking values 0 or 1) would be encoded as a
string of 3 bits (e.g., "010").
• Hamming Distance: The Hamming distance between two binary strings is the number of
bit positions where they differ. For instance, the Hamming distance between "010" and
"100" is 2 (differ at the first and second bits).
• The Cliff Analogy: Imagine solutions as points on a landscape, with similar solutions
being closer together. In binary encoding, adjacent integer values can have large Hamming
distances. For example, the binary representations of 7 and 8 ("0111" and "1000") differ at
all 4 bits, even though their numerical difference is just 1. This creates a "cliff" where a
small mutation (flipping a single bit) in the binary string can cause a large jump in the
solution space.
• Gray Coding: An alternative encoding scheme called Gray coding can be used. Here,
adjacent integer values differ by only one bit. This eliminates Hamming cliffs and allows
mutations to explore neighboring solutions more effectively.
• Real-Valued Encoding: For problems with continuous solution spaces, using real-valued
encoding instead of binary can eliminate Hamming cliffs altogether. However, this
introduces other challenges like defining appropriate mutation and crossover operators for
real-valued representations.
Particle Swarm Optimization (PSO) is a powerful optimization technique, but it can get stuck in
local optima, especially for complex problems. Multi-start PSO addresses this by running the
algorithm multiple times with different initial positions for the particles. Here's how it works:
8|Page
Standard PSO:
1. Initialization: Define the swarm size (number of particles), search space, and fitness
function. Initialize each particle with a random position and velocity in the search space.
2. Iteration Loop:
o Evaluate the fitness of each particle using the fitness function.
o Update each particle's personal best position (pbest) based on its current position
and the best position it has seen so far.
o Identify the global best position (gbest) from all particles' pbest positions.
o Update each particle's velocity based on its current velocity, its pbest, and gbest.
o Update each particle's position based on its new velocity.
3. Termination: The loop continues until a stopping criterion is met (e.g., maximum
iterations reached, convergence achieved).
Multi-Start PSO:
1. Run Standard PSO Multiple Times: Repeat the entire standard PSO process
(initialization, iteration loop, termination) multiple times. Each run starts with a completely
new set of randomly initialized particles in the search space.
2. Final Result: After running PSO multiple times, select the best solution found across all
runs based on the highest fitness value. This provides a higher chance of escaping local
optima and finding a better solution compared to a single run.
• Increased Computation Cost: Running PSO multiple times requires more computational
resources compared to a single run.
• Tuning the Number of Starts: There's no one-size-fits-all answer for the optimal number
of restarts. Too few restarts might not provide enough exploration, while too many can be
computationally expensive.
Implementation Tips:
9|Page
7. Discuss about attention mechanism in encoder – decoder.
The attention mechanism is a powerful technique used in encoder-decoder models for tasks like
machine translation and text summarization. It allows the decoder to selectively focus on relevant
parts of the input sequence encoded by the encoder, leading to more accurate and informative
outputs.
1. Encoder-Decoder Structure:
• Encoder: The encoder processes the input sequence (e.g., a sentence in machine
translation). It typically uses a recurrent neural network (RNN) or a Transformer to
generate a context vector that captures the meaning of the entire input sequence.
• Decoder: The decoder generates the output sequence one step at a time (e.g., the translated
sentence). It uses the context vector from the encoder along with the previously generated
outputs to predict the next element in the output sequence.
2. Attention Mechanism:
• At each step of the decoder, the attention mechanism computes an attention score for each
element (hidden state) in the encoder's output. This score indicates how relevant each
encoder element is to predicting the current element in the output sequence.
• The attention scores are calculated based on the decoder's current hidden state and the
encoder's hidden states. Different scoring functions can be used, but they typically involve
a dot product or a compatibility function between these states.
• The attention scores are then normalized (often using softmax) to create an attention
weight for each encoder element. These weights represent the relative importance of each
encoder element in the current context.
• Finally, the decoder uses these attention weights to create a context vector specifically
tailored for the current output element. This context vector is a weighted sum of the
encoder's hidden states, where the weights are the attention weights.
• The decoder then combines this context vector with its current hidden state and potentially
the previously generated output to predict the next element in the output sequence.
• Focus on Relevant Information: The attention mechanism allows the decoder to focus on
the most relevant parts of the input sequence for each output element. This is particularly
beneficial for long sequences where not all parts are equally important for generating the
output.
10 | P a g e
• Improved Accuracy: By attending to the most relevant information, the attention
mechanism helps the model generate more accurate and informative outputs.
• Long Sequence Handling: The attention mechanism allows the model to effectively
handle long sequences by focusing on relevant parts instead of relying solely on the
potentially limited capacity of the encoder's final hidden state.
• Prevent Out-of-Bounds: Without clamping, particles could have very large velocities,
causing them to fly past optimal regions or even outside the defined search space
altogether. This can lead to wasted computations and potential instability in the algorithm.
• Control Search Granularity: Clamping allows you to control the exploration vs.
exploitation trade-off. Lower clamping values restrict particle movement, promoting
exploitation of promising areas. Higher clamping values allow for larger jumps,
encouraging exploration of the search space.
1. Define Maximum Velocity: A threshold value for the maximum allowed velocity is set
for each dimension of the search space.
2. Clipping the Velocity: After calculating the velocity update based on the standard PSO
formula, each component of the velocity vector is compared to the maximum velocity
threshold.
3. Clamping: If any component exceeds the threshold, it's clipped to the threshold value. This
ensures the particle's movement stays within the desired bounds.
• Improved Stability: Clamping prevents particles from escaping the search space, leading
to more stable and predictable behavior of the algorithm.
• Targeted Search: By controlling the exploration-exploitation balance, clamping can help
the algorithm focus on promising areas more effectively.
The biological immune system is a complex network of cells and organs that defends the body
against pathogens like bacteria and viruses. Artificial immune systems (AIS) draw inspiration from
11 | P a g e
this biological counterpart to create computational algorithms for solving various optimization and
pattern recognition problems.
Here are some key aspects of the biological immune system that inspire AIS:
• Diversity: The immune system maintains a diverse population of immune cells, each with
specific recognition capabilities. Similarly, AIS often use diverse populations of candidate
solutions to explore the search space effectively.
• Learning and Memory: The immune system learns from past encounters with pathogens,
developing memory to respond more effectively to future threats. AIS can incorporate
learning mechanisms to improve their performance over time based on past successes and
failures.
• Self/Non-Self Recognition: The immune system can differentiate between the body's own
cells (self) and foreign invaders (non-self). AIS can be designed to identify "healthy" or
optimal solutions within a search space and eliminate or adapt "unhealthy" solutions.
• Antibody Selection: The immune system selects and amplifies effective antibodies
(proteins that bind to pathogens) during an immune response. AIS can use selection
mechanisms to favor promising candidate solutions based on their fitness in the problem
domain.
Applications of AIS:
• Anomaly Detection: AIS can be used to identify abnormal patterns in data, mimicking the
immune system's ability to detect foreign invaders.
• Fault Diagnosis: AIS can be applied to diagnose faults in systems by learning patterns
associated with normal and faulty behavior.
• Optimization Problems: AIS can be used for various optimization tasks, such as
scheduling, resource allocation, and data clustering, by drawing inspiration from the
immune system's ability to find optimal solutions.
1. Forward Pass:
12 | P a g e
2. Loss Calculation:
• The network's output is compared to the desired target output (ground truth) using a loss
function (e.g., mean squared error, cross-entropy).
• The loss function quantifies the difference between the predicted and actual outputs.
3. Backward Pass:
• This is the core of backpropagation. We calculate the error gradients for each neuron,
starting from the output layer and propagating them backward layer by layer.
• For the output layer, the error gradient is simply the derivative of the loss function with
respect to the output neurons' activations.
• For hidden layers, the error gradient is calculated by considering how the layer's activation
contributed to the overall error in the output layer, taking into account the weights
connecting it to the previous layer.
• Using the calculated error gradients, the weights and biases of each neuron are updated
using an optimization algorithm like gradient descent.
• The update typically involves subtracting a learning rate multiplied by the error gradient
from the current weight or bias value. The learning rate controls the step size of these
updates.
5. Repeat:
• Steps 1-4 are repeated for multiple iterations (epochs) with different training data
examples.
• With each iteration, the network adjusts its weights and biases, gradually minimizing the
loss function and improving its performance on the training data.
Benefits of Backpropagation:
Challenges of Backpropagation:
13 | P a g e
Unit 3
Fuzzy Logic
Fuzzy Set Theory is an extension of classical set theory, introduced by Lotfi Zadeh in 1965, to handle the
concept of partial truth, where the truth value may range between completely true and completely false. This
is particularly useful in dealing with real-world scenarios that involve uncertainty, vagueness, and
imprecision.
Fuzzy Sets:
● A fuzzy set is characterized by a membership function, which assigns to each element a grade of
membership ranging between 0 and 1.
● For a universe of discourse X, a fuzzy set A is defined as
A={(x,μA(x))∣x∈X}
where μA(x) is the membership function of x in A
Formal models are artificial languages with strict rules and syntax used to represent information in a clear and
unambiguous way.
● Bridging the Gap: One of the key challenges in computer science is bridging the gap between natural
language and formal models. This field is known as Natural Language Processing (NLP).
● NLP Applications: NLP techniques allow computers to understand and process natural language, enabling
applications like machine translation, chatbots, and sentiment analysis.
● Complementary Approaches: Natural language and formal models serve different purposes. Ideally, we can
leverage the strengths of both to create more sophisticated systems that can understand and communicate
with humans in a natural way.
Fuzzy Set
• Classical set theory allows the membership of the elements in the set in binary terms
• Fuzzy set theory permits membership function valued in the interval [0, 1]
• Example
• Words like tall, young, rich are fuzzy
• There is no quantitative value that define the term rich
• For some people millionaire is rich, and some people billionaire is rich
• In real world there exist much fuzzy knowledge
• Human thinking and reasoning frequently involves fuzzy information
• Like answering the question in examination, which are probably true
1
Fuzzy Set (Membership function)…
• The membership function fully defines the fuzzy set
• A membership function provides a measure of the degree of the similarity of an element to a
fuzzy set
• Each element in the universal set U has a degree of membership, which is a real number
between 0 and 1 (including 0 and 1), in a fuzzy set S
• The fuzzy set S is denoted by listing the elements with their degrees of membership
• elements with 0 degree of membership are not included
• elements with 1 degree of membership are fully included
• elements with 0 < degree of membership <1 are partially included
• Suppose that R is the set of rich people with R = {0.4 Alice, 0.8 Brian, 0.2 Fred, 0.9 Oscar, 0.7
Rita}.
• i.e Oscar is the richest person and Fred is the poorest person among these four people
• Formal Definition
• If X is universe of discourse and a is a particular element of X, then a fuzzy set
B defined on X and can be written as a collection of ordered pairs B =
{a,(a), aX}
• Example
• Universe of discourse → CSIT students of PMC
• G → set of good students
• B → set of bad students
• G = {(Ram, 0.9), (Hari, 0.7), (Sam, 0.4)}
• D = {(Ram, 0.1), (Hari, 0.3), (Sam, 0.6)}
2
Interpretation of Fuzzy Sets
• Fuzzy Sets for Modeling Similarity
• Compare the object under consideration with one that definitely belongs to the concept under
consideration (and possibly also with one that definitely does not belong to this concept)
• The similarity between two objects is higher, the smaller their distance
• Fuzzy Sets for Modeling Preference
• Membership degrees convey which values (or objects) should be preferred to others
• Fuzzy Sets for Modeling Possibility
• Possibility degrees represent a flexible restriction on what is the actual state with the following
convention: μ(u) = 0 means that u is rejected as impossible, μ(u) = 1 means that u is totally possible, and
the larger μ(u) is, the more plausible u is
3
Fuzzy Logic
• Include all applications and theories where fuzzy sets or concepts are involved
• Focuses on the field of approximate reasoning where fuzzy sets are used and propagated within an
inference mechanism as it is for instance common in expert systems
• The assumption that a statement is either true or false is suitable for mathematical issues
• But for many expressions formulated in natural language such a strict separation between true and false
statements would be unrealistic
• If somebody promises to come to an appointment at 5 o’clock, his statement would have been false, if he
came one minute later
• Nobody would call him a liar, although, strictly speaking, his statement was not true
• Even more complicated is the statement of being at a party at about 5
• The greater the difference between the arrival and 5 o’clock the “less true” the statement is
• A sharp definition of an interval of time corresponding to “about 5” is impossible
• Humans are able to formulate such “fuzzy” statements, understand them, draw conclusions from them
and work with them
• If someone starts an approximately four-hour-drive at around 11 o’clock and is going to have lunch for
about half an hour, we can use these imprecise pieces of information and conclude at what time more or
less the person will arrive
• A formalization of this simple issue in a logical calculus, where statements can be either true or false
only, is not adequate
4
t-Norm operator
• Triangular Norm
• Is a binary operation on the unit interval [0, 1], a function T: [0, 1] [0, 1] [0, 1], such that
for all a, b, c [0, 1], the following four axioms are satisfied
• T1 : T(a, b) = T(b, a) Commutative Property
• T2 : T(a, T(b, c)) = T(T(a, b), c) Associativity Property
• T3 : T(a, 1) = a Boundary Condition
• T4 : T(a, a) = a Idempotency
• T5 : T(a, b) T(a, c) whenever b c Monotonicity Property, where a, b and c are
membership functions
1. Minimum
▪ Tmin(A(x), B(x)) = min ( A(x), B(x)) = A(x) B(x)
2. Algebraic Product
▪ Tap(A(x), B(x)) = A(x) B(x)
3. Bounded Product
▪ Tbp(A(x), B(x)) = MAX(0, ( A(x) + B(x) – 1))
4. Drastic Product
• Example
• A = {(a, 0.7), (b, 0.5), (c, 0.1), (d, 0.6)}
• B = {(b, 0.8), (c, 0.3)}
t-conorm operator
• Triangular conorm
• Is a binary operation on the unit interval [0, 1], a function T: [0, 1] [0, 1] [0, 1], such that
for all a, b, c [0, 1], the following four axioms are satisfied
• T1 : T(a, b) = T(b, a) Commutative Property
• T2 : T(a, T(b, c)) = T(T(a, b), c) Associativity Property
• T3 : T(a, 0) = a Boundary Condition
• T4 : T(a, b) T(a, c) whenever b c Monotonicity Property, where a, b and c are
membership functions
1. Standard Union (Maximum)
▪ Tmax(A(x), B(x)) = max ( A(x), B(x)) = A(x) B(x)
2. Algebraic Sum
▪ Tas(A(x), B(x)) = A(x) + B(x) - A(x) B(x)
3. Bounded Sum
▪ Tbs(A(x), B(x)) = MIN(1, ( A(x) + B(x) ))
4. Drastic Union
5
• Example (Intersection)
6
Exercise
• Let,
• Set of Rich People (R) = {0.4 Alice, 0.8 Brian, 0.2 Fred, 0.9 Oscar, 0.7 Rita}
• Set of Famous People (F) = {0.6 Alice, 0.9 Brian, 0.4 Fred, 0.1 Oscar, 0.5 Rita}
• Find the fuzzy set F R of rich or famous people
• Find the fuzzy set F ∩ R of rich and famous people
• Find Fc (the fuzzy set of people who are not famous) and Rc (the fuzzy set of people who are not
rich)
Linguistic modifiers, also known as hedges, are a powerful tool in fuzzy set theory that allow you to add
shades of meaning and nuance to membership functions. They essentially modify the shape and behavior of
the membership function, enabling you to represent concepts with even greater precision and flexibility.
Alpha Cuts
Alpha cuts, also known as α\alphaα-levels or α\alphaα-level sets, are a fundamental concept in fuzzy set
theory. They provide a way to convert a fuzzy set into a family of crisp sets, facilitating analysis and
operations on fuzzy sets.
Definition
An α\alphaα-cut of a fuzzy set A is a crisp set that contains all the elements of the universe of discourse X
whose membership degrees in A are greater than or equal to a specified threshold α\alphaα. Formally, for a
fuzzy set A with membership function μA(x), Aαis defined as:
Aα={x∈X∣μA(x)≥α}
where α∈[0,1]
Types of Alpha Cuts
1. Strong α-cut:
o Includes only those elements whose membership degree is strictly greater than α\alphaα.
o Formally, the strong α-cut, Aα+is defined as: Aα+={x∈X∣μA(x)>α}
2. Standard α\alphaα-cut:
o Includes elements whose membership degree is greater than or equal to α
o As defined earlier: Aα={x∈X∣μA(x)≥α}
7
Decomposition of a Fuzzy Set
• Decomposition theory delves into ways to break down complex fuzzy sets into simpler ones. This can be
helpful for analyzing and understanding intricate concepts represented by fuzzy sets
• The representation of an arbitrary fuzzy set A in terms of the special fuzzy set αA, which are defined in
terms of the α-cuts of A by 𝛼𝐴(𝑥) =
𝛼. 𝛼𝐴(𝑥)
• Referred as a decomposition of the fuzzy set A
• Example
• X = {a, b, c, d, e}
• Fuzzy Set (A) = {(a, 0.2), (b, 0.4), (c, 0.6), (d, 0.8), (e, 1)}
The extension principle is a fundamental concept in fuzzy logic that establishes a connection between fuzzy sets and
classical set-theoretic operations. It essentially allows us to "map" functions between fuzzy sets and level sets.
● Level Sets: Recall that alpha cuts create crisp sets (level sets) from a fuzzy set by selecting elements with a
membership degree greater than or equal to a specific alpha level.
● Mapping Functions: The extension principle tells us how to apply a function (e.g., addition, multiplication) to
fuzzy sets. It does this by working with their corresponding level sets.
Fuzzy Relations
Fuzzy relations extend the concept of fuzzy sets to represent relationships between elements in different sets. They
provide a powerful tool for modeling situations where the connections between elements are imprecise or have
varying degrees of strength.
Fuzzy relations can be used to express propositions about relationships between elements. Here's how:
● Fuzzy Statements: Instead of a binary "related" or "not related," we can use fuzzy statements like "Alice is
very good at Math" or "Bob is somewhat interested in History."
● Membership Functions: These statements can be translated into fuzzy relations using membership functions.
The function would assign a degree of truth (between 0 and 1) to each proposition based on the underlying
relationship.
• Crisp Relation
Crisp relations are the traditional concept of relations used in classical set theory, where the relationship
between elements is either present or absent. In contrast to fuzzy relations, crisp relations do not allow for
partial membership; an element either belongs to the relation or it does not.
8
• A fuzzy relation R is a mapping from the Cartesian space XY to the interval [0, 1], where the
1. Fuzzification
9
2. Inferencing
3. Deffuzification
1. Fuzzification:
o The process of converting real-valued inputs into fuzzy values (membership values).
o Real-valued inputs are mapped to fuzzy sets using membership functions.
o Example: If the input is temperature, it can be mapped to fuzzy sets like "cold," "warm," and "hot."
2. Fuzzy Inference:
o The process of formulating the mapping from a given input to an output using fuzzy logic operators,
fuzzy rules, and compositional rule of inference.
o Fuzzy rules are typically in the form of "IF-THEN" statements, where the conditions and conclusions
are expressed using fuzzy sets.
o Example: "IF temperature is hot THEN fan speed is high."
3. Defuzzification:
o The process of converting the fuzzy output back to a real-valued output.
o Various methods are used for defuzzification, such as the centroid method, bisector method, mean
of maxima, etc.
o Example: Converting the fuzzy set representing "fan speed" back to a specific numeric value.
Fuzzy Clustering
Is a type of clustering algorithm in machine learning that allows a data point to belong to more than one
cluster with different degrees of membership
• Unlike traditional clustering algorithms, such as k-means or hierarchical clustering, which assign each
data point to a single cluster, fuzzy clustering assigns a membership degree between 0 and 1 for each
data point for each cluster
• FCM (Fuzzy c-Means) Algorithm
• Fuzzy c-Means
1. Initialize the data points into the desired number of clusters randomly
10
𝑛
𝑚
∑ µ𝑖𝑘 ×𝑥𝑘
2. Find out the centroid 𝑉𝑖𝑗 = 𝑘=1
𝑛 where, m is fuzziness parameter
𝑚
∑ µ𝑖𝑘
𝑘=1
(2)
3. Find out the distance of each point from the centroid
−1
𝑛
⎰ 𝑑𝑘𝑖
2
⎱
( 1
𝑚−1 )
4. Updating membership values µ𝑘𝑖 = ⎛ ∑ ⎞
𝑗=1
⎱ 𝑑𝑘𝑗2 ⎰
⎝ ⎠
5. Repeat the steps(2-4) until the constant values are obtained for the membership values or
the difference is less than the tolerance value
6. Defuzzify the obtained membership values
Fuzzy k-Nearest Neighbors (FKNN) is a classification technique that uses fuzzy logic to handle messy data.
It builds on the k-Nearest Neighbors (k-NN) idea but allows for data points to belong to multiple classes
with varying degrees of membership. This makes FKNN useful for situations where data is imprecise or has
fuzzy boundaries between classes.
Fuzzy Measure
• Consider a finite set X = {x1, x2, . . . , xn}
• Each xi can be a diagnostic test, a feature (e.g., color, texture, or shape) in a segmentation problem, a
particular patternrecognition algorithm, and so on
• Let 2X denote the power set of X, that is, the set of all (crisp) subsets of X
• A fuzzy measure, g, is a real-valued function g : 2X → [0, 1], satisfying the following properties
1. g(φ) = 0 and g(X) = 1
2. g(A) ≤ g(B), if A ⊆ B
11
Chapter 5
Defuzzification Methods
Fuzzy rule based systems evaluate linguistic if-then rules using fuzzification, inference and composition
procedures. They produce fuzzy results which usually have to be converted into crisp output. To
transform the fuzzy results in to crisp, defuzzification is performed.
Defuzzification is the process of converting a fuzzified output into a single crisp value with respect to a
fuzzy set. The defuzzified value in FLC (Fuzzy Logic Controller) represents the action to be taken in
controlling the process.
∑ . ∑
∗
= ∑ ∑
,
Here, n is the number of fuzzy sets, N is the number of fuzzy variables, μ is the
membership function for the k-th fuzzy set.
Example
1
©Debasis Samanta, Indian Institute of Technology Kharagpur
∗
The defuzzified value is defined as :
∗ ∑
= ∑
,
Here, represents the firing area of rules and k is the total number of rules fired and
represents the center of area.
The aggregated fuzzy set of two fuzzy sets and is shown in Figure 1. Let the area of this two
fuzzy sets are and .
= ½ * [(8-1) + (7-3)] * 0.5 = ½ * 11 * 0.5 = 55/20=2.75
= ½ * [(9-3) + (8-4)] * 0.3 = ½ * 10 * 0.3 = 3/2 =1.5
Now the center of area of the fuzzy set is let say = (7+3)/2= 5 and
the center of area of the fuzzy set is = (8+4)/2=6.
∗ . . . ∗ . ∗
Now the defuzzified value = = = 22.75/4.25 = 5.35
. .
0.5
µ
0.4
A1
0.3
0.2
A2
0.1
0 1 2 3 4 5 6 7 8 9 x
∗
2
©Debasis Samanta, Indian Institute of Technology Kharagpur
∗
For discrete membership function, the defuzzified value denoted as using COG is defined as:
∗ ∑ .
= ∑
, Here indicates the sample element, μ is
the membership function, and n represents the number of elements in the sample.
∗
For continuous membership function, is defined as :
∗ µ
=
µ
µ 0.5
0.4 2
3
0.3
0.2
0.1 1 4 5
0 1 2 3 4 5 6 7 8 9 x
Example:
∗
The defuzzified value using COG is defined as:
∗ ∑
= ∑
, Here N indicates the number of sub-areas, and
3
©Debasis Samanta, Indian Institute of Technology Kharagpur
Centroid of sub-area1 will be (1+3+3)/3 = 7/3 =2.333
Centroid of sub-area2 will be (7+3)/2 = 10/2 = 5
Centroid of sub-area3 will be (7+7+7.5)/3 = 21.5/3 =7.166
Centroid of sub-area4 will be (7+7.5)/2 =14.5/2=7.25
Centroid of sub-are5 will be (7.5+8)/2 =15.5/2 = 7.75
Centroid of sub-area6 will be (8+8+9)/3 = 25/3 = 8.333
Now we can calculate . and is shown in table 1.
Table 1
Sub‐area number Area( ) Centroid of area( ) .
1 0.5 2.333 1.1665
2 02 5 10
3 .05 7.166 0.3583
4 .15 7.25 1.0875
5 .15 7.75 1.1625
6 .15 8.333 1.2499
∗
∑
The defuzzified value will be
∑
. . . . .
=
. . . . .
= (15.0247)/3 =5.008
∗
5.008
4
©Debasis Samanta, Indian Institute of Technology Kharagpur
∑µ .
∗
= ∑µ
Here ∑ denotes the algebraic summation and x is the element with maximum membership
function.
µ(x)
0.8
0.6
0.4
50 60 70 80 90 100 x
Example:
Let A be a fuzzy set that tells about a student as shown in figure 3 and the elements with
corresponding maximum membership values are also given.
A = {(P, 0.6), (F, 0.4),(G, 0.2),(VG, 0.2), (E, 0)}
Here, the linguistic variable P represents a Pass student, F stands for a Fair student, G
represents a Good student, VG represents a Very Good student and E for an Excellent student.
∗ ∗ . ∗ . ∗ . ∗ . ∗
=
. . . .
= 98/1.4=70
The defuzzified value for the fuzzy set A with weighted average method represents a Fair
student.
Maxima Methods
5
©Debasis Samanta, Indian Institute of Technology Kharagpur
This method considers values with maximum membership. There are different maxima methods
with different conflict resolution strategies for multiple maxima.
o First of Maxima Method (FOM)
o Last of Maxima Method (LOM)
o Mean of Maxima Method (MOM)
µ(x)
1.0
0.8
0.6
0.4
0.2
0 2 4 6 8 10 12 x
In the example given for FOM, the defuzzified value for LOM method will be ∗ = 8
6
©Debasis Samanta, Indian Institute of Technology Kharagpur
∑
∗
= ,
| |
Here, M = { | μ ( ) is equal to the height of the fuzzy set A} and |M| is the cardinality
of the set M.
Example
In the example as shown in Fig. , x = 4, 6, 8 have maximum membership values and hence
|M| = 3
∑
∗
According to MOM method, =
| |
References:
2. Jean J. Saade and Hassan B. Diab. “Defuzzification Methods and New Techniques for Fuzzy
Controllers”, Iranian Journal of Electrical and Computer Engineering, 2004.
3. Aarthi Chandramohan, M. V. C. Rao and M. Senthil Arumugam: “Two new and useful
defuzzification methods based on root mean square value”, Soft Computing, 2006.
7
©Debasis Samanta, Indian Institute of Technology Kharagpur