Soft Computing
Soft Computing
(1) Design a McCulloch-Pitts (MP) neuron for realization of a two input AND
logic.
(3) Explain McCulloch-Pitts (MP) model with an example. Explain the
limitations of MP model
The McCulloch-Pitts model is a simplified representation of a biological neuron. It is used in the field of
artificial neural networks to understand how neurons might compute logical operations. Here’s a
detailed explanation of the MP model along with an example and its limitations.
1. Inputs (x₁, x₂, ..., xₙ): These are the binary inputs to the neuron.
2. Weights (w₁, w₂, ..., wₙ): Each input has an associated weight. These weights are usually
real numbers.
3. Summation: The neuron calculates a weighted sum of the inputs
1. Input Collection
Inputs (x1,x2,...,xnx): Collect the binary inputs for the neuron. Each input can be either 0 or 1.
2. Assign Weights
Weights (w1,w2,…..wn): Assign weights to each input. Weights are typically real numbers
and represent the importance of each input in the decision-making process.
Calculate the weighted sum of the inputs. This is done using the formula:
Here S represents the summation of the weighted inputs.
4. Apply Threshold
Threshold (θ\thetaθ): Determine the threshold value for the neuron. The threshold is a real
number that serves as a cutoff for deciding the output.
5. Activation Function
6. Output
Produce the binary output based on the result of the activation function. The output will be either 0 or 1.
Example :
Limitations of the MP Model
1. Binary Inputs and Outputs: The MP model only works with binary inputs and outputs (0s and
1s), limiting its application to simple logical operations.
2. Linear Separability: The MP neuron can only solve problems that are linearly separable. It
cannot solve problems like the XOR problem, where the classes cannot be separated by a single
straight line.
3. Fixed Threshold: The threshold is fixed and must be manually set, making it less flexible in
adapting to different problems without reconfiguration.
4. Lack of Learning Mechanism: The MP model does not have a learning mechanism. Weights and
thresholds need to be predefined and cannot be adjusted automatically based on input-output pairs.
5. No Concept of Hidden Layers: The MP model represents a single neuron and does not account
for the concept of hidden layers, which are essential for solving complex problems in modern
neural networks.

4. **Bias**: A bias term is added to the weighted sum. The bias allows the
neuron to adjust its output independently of the inputs.
6. **Output**: The output of the neuron is the result of the activation function.
Now, let’s discuss the types of artificial neurons and activation functions:
These are some of the commonly used activation functions, each with its
own characteristics and suitability for different types of problems.
(4)
Write short note on
Adaline Neurons.
[Link]
Workflow:
Adaline
First, calculate the net input to your Adaline network then apply the activation function to its
output then compare it with the original output if both the equal, then give the output else send
an error back to the network and update the weight according to the error which is calculated
by the delta learning rule. i.e ,
where and are the weight, predicted output, and true value respectively.
Architecture:
Adaline
In Adaline, all the input neuron is directly connected to the output neuron with the weighted
connected path. There is a bias b of activation function 1 is present.
Algorithm:
Step 1: Initialize weight not zero but small random values are used. Set learning rate α.
Step 2: While the stopping condition is False do steps 3 to 7.
Step 3: for each training set perform steps 4 to 6.
Step 4: Set activation of input unit xi = si for (i=1 to n).
Step 5: compute net input to output unit
and calculate
when the predicted output and the true value are the same then the weight will not
change.
Step 7: Test the stopping condition. The stopping condition may be when the weight
changes at a low rate or no change.
Unit 5
Genetic Algorithms (GAs) are a class of optimization algorithms inspired by the principles
of natural selection and genetics. They are particularly useful for solving complex problems
where traditional methods might be inefficient. Below, I provide a detailed description of
the main features and components of Genetic Algorithms:
3. Fitness Function
The fitness function evaluates how good each solution is in solving the problem. It assigns a
fitness score to each individual in the population. This score determines the individual’s
ability to survive and reproduce. The fitness function is problem-specific and is designed to
reflect the quality of the solution.
4. Selection
Selection is the process of choosing individuals from the population to create offspring for
the next generation. Several selection methods can be used:
Roulette Wheel Selection: Individuals are selected based on their fitness
proportion. Higher fitness individuals have a higher probability of being selected.
Tournament Selection: A subset of individuals is chosen randomly, and the best
individual from this subset is selected.
Rank Selection: Individuals are ranked based on their fitness, and selection is
based on this ranking.
5. Crossover (Recombination)
Crossover is a genetic operator used to combine the genetic information of two parents to
generate new offspring. It promotes the exploration of new solutions by combining different
parts of good solutions. Common crossover techniques include:
6. Mutation
Mutation introduces genetic diversity into the population by randomly altering the genes of
an individual. It helps prevent premature convergence to local optima. Common mutation
techniques include:
7. Replacement
Replacement determines how the new generation is formed. It decides which individuals
from the current generation and the offspring will survive to the next generation. Common
strategies include:
8. Termination
The GA process continues for multiple generations until a termination condition is met.
Termination conditions can be:
Fixed Number of Generations: The algorithm runs for a predetermined number of
generations.
Fitness Threshold: The algorithm stops when a solution with a fitness above a
certain threshold is found.
Convergence: The algorithm terminates when the population converges to a
solution, meaning there is little variation among individuals.
9. Elitism
Elitism ensures that the best individuals from the current generation are carried over to the
next generation without any changes. This guarantees that the solution quality does not
degrade.
Maintaining diversity in the population helps avoid premature convergence and ensures a
thorough exploration of the search space. Techniques to preserve diversity include:
Some GAs use adaptive methods to dynamically adjust parameters such as mutation and
crossover rates based on the performance of the algorithm. This adaptation helps improve the
efficiency and effectiveness of the GA.
GAs can be combined with other optimization techniques, such as local search methods, to
enhance performance. These hybrid approaches leverage the global search capabilities of
GAs and the local search strengths of other methods.
Genetic Algorithms (GAs) are search heuristics that mimic the process of natural selection.
One of the key components of GAs is the crossover (or recombination) method, which
combines the genetic information of two parent solutions to produce new offspring. Different
crossover methods have distinct mechanisms and effects on the search process. Here’s a
detailed explanation of several common crossover methods used in Genetic Algorithms:
1. Single-Point Crossover
In single-point crossover, a random crossover point is selected on the parent chromosomes.
The offspring are created by exchanging the segments of the parent chromosomes at this
crossover point.
Steps:
2. Two-Point Crossover
Steps:
Uniform crossover uses a fixed mixing ratio to combine parent genes. Each gene in the offspring
is chosen randomly from one of the corresponding genes of the parents.
Process:
For each gene, randomly choose whether it will be taken from Parent 1 or Parent 2.
4. Arithmetic Crossover
Arithmetic crossover is commonly used with real-valued genes. It creates offspring by taking a
weighted average of the parent genes.
Steps:
1. For each gene, compute the offspring gene as a linear combination of the parents'
genes.
2. The combination is usually parameterized by a factor α.
Example:
less
Copy code
Parent 1: [2.5, 3.5]
Parent 2: [5.0, 1.5]
Offspring 1: α * [2.5, 3.5] + (1-α) * [5.0, 1.5]
Offspring 2: (1-α) * [2.5, 3.5] + α * [5.0, 1.5]
For α = 0.5:
Offspring 1: [3.75, 2.5]
Offspring 2: [3.75, 2.5]
5. Blend Crossover (BLX-α)
Blend crossover (BLX-α) is another crossover method used for real-valued genes. It
generates offspring by considering a range around the parents' genes determined by a
parameter α.
Steps:
1. For each gene, compute a range [min_i - d, max_i + d] where d = α * (max_i - min_i).
2. Generate offspring genes randomly within this range.
Example:
Parent 1: [2.5, 3.5]
Parent 2: [5.0, 1.5]
α = 0.5:
Range for gene 1: [2.5 - 1.25, 5.0 + 1.25] = [1.25, 6.25]
Range for gene 2: [1.5 - 1.0, 3.5 + 1.0] = [0.5, 4.5]
Offspring 1: [random(1.25, 6.25), random(0.5, 4.5)]
Offspring 2: [random(1.25, 6.25), random(0.5, 4.5)]
6. Partially Mapped Crossover (PMX)
PMX is specifically designed for permutation-based problems, such as the Traveling
Salesman Problem (TSP). It ensures that offspring are valid permutations.
Steps:
1. Select two crossover points.
2. Map the segment between the crossover points from one parent to the corresponding
segment in the other parent.
3. Resolve conflicts by mapping remaining elements accordingly.
Example:
Parent 1: [1, 2, 3, | 4, 5, 6, | 7, 8, 9]
Parent 2: [4, 5, 6, | 1, 2, 3, | 7, 8, 9]
Crossover points: ^ ^
Offspring 1: [4, 5, 6, | 4, 5, 6, | 7, 8, 9] -> Resolve to [4, 5, 6, 1, 2, 3, 7, 8, 9]
Offspring 2: [1, 2, 3, | 1, 2, 3, | 7, 8, 9] -> Resolve to [1, 2, 3, 4, 5, 6, 7, 8, 9]
7. Order Crossover (OX)
Order crossover is also used for permutation-based problems. It preserves the relative order of
the genes in the parent chromosomes.
Steps:
1. Select two crossover points.
2. Copy the segment between the crossover points from one parent.
3. Fill the remaining positions with genes from the other parent in the order they appear,
skipping duplicates.
Example:
Describe the terms chromosome, fitness function, crossover and mutation as used in
Genetic Algorithm with examples.
Genetic Algorithms (GAs) are adaptive heuristic search algorithms premised on the
evolutionary ideas of natural selection and genetics. They are used to find optimal or near-
optimal solutions to complex problems that are difficult to solve using conventional
methods. Here are detailed descriptions of key terms used in GAs: chromosome, fitness
function, crossover, and mutation, along with examples for better understanding.
Chromosome
Example:
Consider a simple problem of finding the maximum value of a mathematical function, say
f(x)=x2f(x) = x^2f(x)=x2, within a given range. If xxx ranges from 0 to 31, one way to
represent a chromosome is by using a 5-bit binary string:
Fitness Function
The fitness function evaluates how close a given solution (chromosome) is to the
optimum solution of the problem. It assigns a fitness score to each chromosome, which is
used to guide the selection process during the evolution of the algorithm. The fitness
function is problem-specific and designed to reflect the quality or suitability of a solution.
Example:
For chromosome 10101 (which is x=21x = 21x=21), the fitness function could
be f(21)=212=441f(21) = 21^2 = 441f(21)=212=441.
This means the fitness of the chromosome 10101 is 441.
Crossover
Crossover is a genetic operator used to combine the genetic information of two parent
chromosomes to generate new offspring. It mimics the process of sexual reproduction and
promotes the exploration of new areas in the search space.
There are different types of crossover methods, such as one-point crossover, two-point
crossover, and uniform crossover.
Example:
Parent 1: 10101
Parent 2: 11011
Suppose we choose the crossover point after the second bit:
o Offspring 1: 10111
o Offspring 2: 11001
Mutation
Example:
If mutation occurs at the second bit, the new chromosome might be 11101
(changing the second bit from 0 to 1).
Example Application
Consider optimizing the function f(x)=x2f(x) = x^2f(x)=x2 for xxx in the range of 0 to 31:
1. Initialization: Generate a random population of 5-bit chromosomes, e.g., [10101,
11100, 00011, 10010, 01101].
2. Evaluation: Calculate fitness:
o 10101 (21): 212=44121^2 = 441212=441
o 11100 (28): 282=78428^2 = 784282=784
o 00011 (3): 32=93^2 = 932=9
o 10010 (18): 182=32418^2 = 324182=324
o 01101 (13): 132=16913^2 = 169132=169
3. Selection: Select chromosomes based on fitness, e.g., [11100, 10101, 10010, 11100,
01101] (assuming 11100 is selected twice due to high fitness).
4. Crossover: Apply one-point crossover:
o Parents: 11100, 10101 → Offspring: 11101, 10100
o Parents: 10010, 11100 → Offspring: 10000, 11110
5. Mutation: Mutate one chromosome randomly:
o 10000 → 10001 (if the mutation occurs at the last bit)
6. Replacement: Form the new population with offspring and mutants, e.g., [11101,
10100, 10000, 11110, 10001].
7. Termination: Repeat until a stopping criterion is met.
This process will ideally lead to a population of chromosomes that represents optimal
or near-optimal solutions to the given problem.
In Genetic Algorithms (GA), the stopping condition determines when the algorithm should
terminate. The choice of stopping condition is crucial as it affects the efficiency and
effectiveness of the search process. Here are several common stopping conditions used in
Genetic Algorithms:
1. Maximum Number of Generations (Iterations):
o This is perhaps the simplest stopping condition. The algorithm terminates after
a predefined number of generations (iterations) have been completed. This
ensures that the algorithm does not run indefinitely and has a finite
computational cost.
o Example: Stop after 1000 generations.
2. Fitness Threshold:
o The algorithm stops when the fitness of the best individual in the
population exceeds or reaches a certain predefined threshold. This implies
that the population has converged sufficiently to a satisfactory solution.
o Example: Stop when the best fitness value is greater than or equal to 0.95.
3. No Improvement Condition:
o This condition stops the algorithm when there has been no improvement in the
best fitness value over a specified number of generations. It indicates
stagnation in the population.
o Example: Stop if the best fitness value has not improved in the last
50 generations.
4. Convergence Criteria:
o This condition involves checking if the population has converged, meaning
that the individuals in the population are very similar or identical to each other.
Convergence can be measured using metrics like average fitness, diversity of
solutions, or genetic diversity.
o Example: Stop if the average fitness of the population remains constant
for several generations.
5. Resource (Time or Budget) Constraints:
o Sometimes the stopping condition is based on available computational
resources, such as a maximum allowed time or a computational budget
(e.g., number of evaluations of the fitness function).
o Example: Stop after 1 hour of computation time.
6. User Intervention:
o In some cases, the stopping condition can be manually determined by the
user based on intermediate results or specific criteria known about the
problem domain.
Implementation Considerations
Monitoring: During the execution of the GA, it's important to monitor the
population's progress and evaluate whether the chosen stopping condition
is appropriate.
Early Stopping: Implementing early stopping mechanisms can save
computational resources if the GA converges quickly.
Dynamic Conditions: Sometimes, adaptive stopping conditions that change during
runtime based on algorithm performance or problem characteristics can be
beneficial.
In summary, the stopping condition in Genetic Algorithms plays a critical role in determining
when to terminate the search process. It should be chosen carefully based on the specific
problem, computational resources, and desired outcomes of the optimization process.
Genetic Algorithms (GAs) are powerful search and optimization techniques inspired by the
principles of natural selection and genetics. They find applications in various fields where
complex optimization or search problems need to be solved. Here are ten detailed
applications of Genetic Algorithms:
1. Optimization Problems: GAs are widely used to solve optimization problems where
the goal is to find the best solution among a large set of possible solutions. This
could include optimizing parameters in engineering design, financial portfolios,
logistics planning, etc. GAs efficiently explore large solution spaces and can handle
complex, multi-modal landscapes where traditional methods struggle.
2. Machine Learning: Genetic Algorithms can be applied to optimize parameters and
structures of machine learning models. For example, optimizing the architecture of
neural networks, selecting features, or tuning hyperparameters like learning rates
and regularization terms. GAs complement traditional gradient-based methods by
exploring alternative configurations that may lead to better performance.
3. Robotics: In robotics, GAs are used for tasks such as path planning, motion control,
and robot design optimization. They can evolve control strategies or robot
morphologies to adapt to different environments or tasks. This flexibility makes
GAs suitable for both simulation-based and real-world robotics applications.
4. Game Playing: Genetic Algorithms have been applied to evolve strategies for
playing games. This includes classic board games like chess or Go, where GAs can
evolve strategies that compete with or even surpass human players. They are also
used in developing AI opponents in video games, adjusting difficulty levels
dynamically based on player performance.
5. Bioinformatics: GAs are used in bioinformatics for tasks such as sequence alignment,
protein folding, and modeling biological networks. They can optimize complex
objective functions derived from biological data, helping researchers understand
genetic sequences, protein structures, and interactions within biological systems.
6. Financial Modeling: GAs are employed in financial applications for portfolio
optimization, risk management, and algorithmic trading. They can evolve trading
strategies based on historical data and market conditions, optimizing decision-making
processes to maximize returns while minimizing risks.
7. Image Processing: In image processing, GAs can optimize image enhancement
techniques, feature extraction algorithms, and image recognition systems. They
are used to automate the process of tuning parameters in complex image
processing pipelines, improving the accuracy and efficiency of pattern recognition
tasks.
8. Scheduling and Timetabling: GAs are effective in solving scheduling problems, such
as employee scheduling, project scheduling, and timetabling for schools or
universities. They can generate optimal or near-optimal schedules considering
multiple constraints and objectives, such as minimizing conflicts or maximizing
resource utilization.
9. Evolutionary Robotics: This field applies GAs to evolve robot behaviors and
morphologies in simulated environments. By evolving robots over multiple
generations, researchers can discover novel solutions to complex tasks, such
as locomotion strategies in varying terrains or cooperative behaviors in
swarms.
[Link] Design and Creativity: GAs can be used in creative fields such as
architecture, industrial design, and art. They aid in generating novel designs or
artistic expressions by evolving prototypes or configurations based on aesthetic or
functional criteria. This application leverages GAs' ability to explore diverse
solutions and discover unconventional designs.
UNIT 4
Discuss in detail the operations and properties of fuzzy sets
Represent the fuzzy sets operations using Venn diagram.
FUZZY SETS
Fuzzy sets may be viewed as an extension and generalization of the basic concepts of crisp
sets.
Fuzzy set it allows partial membership. A fuzzy set is a set having degrees of membership
between 1 and 0. The membership in a fuzzy set need not be complete, i.e., member of one
fuzzy set a1so be member of other fuzzy sets in the same universe.
Vagueness is introduced in fuzzy set by eliminating the sharp boundaries that divide
members from nonmembers in the group. There is a gradual transition between full
membership and non membership, not abrupt transition.
A fuzzy set in the universe of discourse U can be defined as a set of ordered pairs and it is
given by,
The degree of membership assumes values in the range from 0 to 1, i.e., the
membership is set to unit interval [0, 1] or ε [0, 1].
The universe of discourse U is discrete and finite fuzzy set A is given as follows:
A fuzzy set is universal fuzzy set if and only if the value of the membership function is 1 for
all the members under consideration. Any fuzzy set A defined on a universe U is a subset of
that universe.
Two fuzzy sets A and B are said to be equal fuzzy sets if μA(x) = μB(x) for all x ϵ U.
A fuzzy set A is said to be empty fuzzy set if and only if the value of the membership
function is 0 for all possible members considered. The universal fuzzy set can also be called
whole fuzzy set.
The collection of all fuzzy sets and fuzzy subsets on universe U is called, fuzzy power set
P(U). Since all the fuzzy sets can overlap, the cardinaliry of the fuzzy power set, nP(U) is
infinite. i.e.) nP(U) = ∞.
1. Commutativity: A property that states that the order of operands does not affect the
result of an operation. For example, in addition, a+b=b+aa + b = b + a a+b=b+a.
2. Associativity: This property states that the grouping of operands does not affect the
result of an operation. For example, in addition, (a+b)+c=a+(b+c)(a + b) + c = a + (b
+ c)(a+b)+c=a+(b+c).
4. Idempotency: This property states that applying an operation multiple times does not
change the result after the first application. For example, in set theory, A∪A=AA \
cup A = AA∪A=A (union of a set with itself).
5. Identity: This refers to an element in a set with respect to a binary operation, such
that applying the operation with this element leaves other elements unchanged. For
example, the number 0 is the identity element for addition because a+0=aa + 0 =
aa+0=a for any number aaa.
6. Involution (double negation): This refers to an operation that when applied twice
returns the original value. In logic, ¬(¬A)=A\neg(\neg A) = A¬(¬A)=A.
7. Transitivity: This property applies to relations, stating that if one element relates in a
certain way to a second element, and the second element relates in the same way to a
third element, then the first element relates in the same way to the third element.
8. De Morgan's law: This is a pair of logical equivalences that state how to negate
conjunctions and disjunctions. Specifically:
o
These concepts are fundamental in various branches of mathematics, logic, and computer science,
and they help in understanding how operations behave under different conditions
Let A and B be fuzzy sets in the universe of discourse U. For a given element x on the
universe, the following function theoretic operations of union, intersection and complement
are defined for fuzzy sets and on U.
1) Union
The Venn diagram for union operation of fuzzy sets and is shown in Figure below:
2) lntersection
The intersection of fuzzy sets and , denoted by ∩ , is defined by
3) Complement
When μA(x) ϵ [0,1] , the , denoted as complement of is
defined by
The Venn diagram for complement operation of fuzzy set is shown in Figure below.
4) Algebraic sum
defined as
5) Algebraic product
6) Bounded sum
7. Bounded difference
Mamdani Fuzzy Inference System (FIS): A Mamdani FIS is a method of fuzzy logic
control that uses a collection of fuzzy rules and fuzzy sets to make decisions or predictions
based on input data. The system processes inputs through fuzzification, applies inference
rules to the fuzzified inputs, aggregates the results, and then defuzzifies the aggregated fuzzy
outputs to produce a crisp output.
The formation of inference rules in a Mamdani Fuzzy Inference System (FIS) is a critical
step in creating a system that can effectively model complex decision-making processes. The
Mamdani approach, introduced by Ebrahim Mamdani in 1975, is known for its intuitive and
human-readable rule structure. Here’s a detailed description of the steps involved in forming
inference rules in a Mamdani FIS:
1. Define the Inputs and Outputs
Rule Table
Create a rule matrix or table to systematically organize and visualize the rules.
Rows and Columns: Each row represents a possible combination of input
fuzzy sets, and the corresponding column entries specify the output fuzzy sets.
Example:
Fuzzification
Convert the crisp input values into fuzzy values using the defined
membership functions.
Example: If the input "Degree of Dirtiness" is 0.7 (on a scale of 0 to 1), it
might belong 70% to the "Medium" set and 30% to the "High" set.
Rule Evaluation (Inference)
Evaluate each rule based on the fuzzified inputs to determine the degree of truth
for the antecedents.
Aggregation: Use logical operators (AND, OR) to combine the degrees of
membership of the antecedents.
Example: For a rule with two antecedents connected by AND, the degree of
truth is the minimum degree of membership among the antecedents.
Aggregation of Consequents
Combine the fuzzy sets resulting from each rule into a single fuzzy set for each output
variable.
Example: Use the maximum or sum of degrees of membership from different
rules contributing to the same fuzzy set of an output.
6. Defuzzification
Testing
Test the FIS with various input scenarios to ensure it behaves as expected.
Example: Simulate different load sizes and degrees of dirtiness to check if the
washing machine adjusts its settings correctly.
Refinement
Adjust the fuzzy sets, membership functions, and rules based on test results and
feedback.
Iterative Process: Continuously improve the system to enhance its
performance and accuracy.
The Takagi-Sugeno (T-S) fuzzy inference system is a type of fuzzy logic system used for
modeling and control applications. It's named after its developers, M. Takagi and M. Sugeno.
This system extends traditional Mamdani-type fuzzy inference systems by incorporating a
different method of rule formulation and output computation.
csharp
Copy code
Rule i: If x1 is A1i and x2 is A2i and ... and xn is Ani then yi = fi(x1, x2, ..., xn)
Here, yi represents the output of the system for the i-th rule, and fi is a function
of the input variables.
3. Rule Evaluation:
o Each rule in the T-S system computes an output yi based on the antecedents (the
IF part of the rule), which are evaluated using fuzzy logic principles.
4. Aggregation:
o The outputs from all rules are aggregated to determine the overall system
output. This aggregation typically involves weighted averaging, where each
rule's output is multiplied by a weight representing the degree of confidence
or applicability of the rule.
5. Defuzzification:
o Finally, the aggregated fuzzy output is converted back into a crisp output
using a defuzzification method. Common methods include centroid
defuzzification, weighted average, or max membership.
Example Application
Consider a temperature control system where the inputs are temperature (T) and rate of
change of temperature (dT/dt), and the output is the heating rate (R). A T-S fuzzy system for
this application might have rules like:
In this example:
Each rule computes the heating rate R based on the current temperature and its rate
of change.
The weights (0.5, 0.2, 0.7, -0.3) determine the contribution of each input to the
output, reflecting the confidence in the rule's applicability.
Conclusion
The Takagi-Sugeno fuzzy inference system provides a flexible and powerful framework for
modeling complex systems where traditional methods may struggle due to non-linearities or
uncertainties. By combining fuzzy logic principles with explicit functional relationships
(through propositional rules), T-S systems offer a robust approach to modeling and control in
various engineering and decision-making domains.
Unit 3
The Hebbian Learning principle is a foundational theory in the field of neural networks and
soft computing. It is often summarized by the phrase "cells that fire together wire together."
This principle, introduced by Donald Hebb in 1949, suggests that the synaptic connection
between two neurons is strengthened if they are activated simultaneously. In other words, the
learning process is based on the correlation of neural activity.
Key Concepts:
1. Synaptic Plasticity: The ability of synapses (connections between neurons) to strengthen or
weaken over time, in response to increases or decreases in their activity.
2. Activity Correlation: The idea that the co-activation of neurons leads to an increase in
synaptic strength between them.
3. Learning Rule: Mathematically, the weight change in a synapse can be expressed as:
𝑦𝑗
Δ𝑤𝑖𝑗=𝜂⋅𝑥𝑖⋅ Δwij=η⋅xi⋅yj
where:
𝑗 𝑖 𝑗
i Δ𝑤𝑖 Δwij is the change in synaptic weight between neuron and neuron j,
The flowchart below illustrates the Hebbian Learning process in a neural network context:
S
In soft computing, associative memory refers to a type of memory system that retrieves
information based on content rather than exact memory addresses. It's inspired by the way
human memory works, where recalling one piece of information can trigger the retrieval of
related information.
Working Principle:
𝑦𝑖𝑛𝑖=𝑥𝑖+∑[𝑦𝑗𝑤𝑗𝑖] yini=xi+∑j[yjwji]
Calculate the total input of the network yin using the equation given below.
Apply activation over the total input to calculate the output as per the equation given
Let's say you want to create a Hopfield network to remember the pattern of a letter "A" in a
grid of 5x5 pixels. In this grid, each pixel can be either black (representing 'on' or active) or
white (representing 'off' or inactive). Your goal is to train the network to recognize and recall
this pattern.
1. Initialization: Start by initializing the network with random weights. Each neuron is
connected to every other neuron, including itself. These connections are represented by
the weight matrix.
2. Training: Present the letter "A" to the network as an input pattern. For each pixel in the grid,
if it's black, set the corresponding neuron in the network to firing, and if it's white, set the
neuron to not firing. Update the weights of the network based on Hebbian learning, which
strengthens connections between neurons that tend to be active at the same time and
weakens connections between neurons that tend to be active at different times. Repeat this
process for multiple presentations of the letter "A" until the network converges and
stabilizes.
3. Rec™all: Now, if you present a corrupted or incomplete version of the letter "A" to the
network, it should be able to recall and reconstruct the complete pattern based on the stored
memory. This is achieved through iterative updating of neuron states until the network
settles into a stable state, which hopefully corresponds to the desired pattern.
Unit 2
Explain the multilayer perceptron algorithm in detail.
An MLP is a type of feedforward artificial neural network with multiple layers, including
an input layer, one or more hidden layers, and an output layer. Each layer is fully connected
to the next. In this article, we will understand Multilayer Perceptron Neural Network, an
important concept of deep learning and neural networks.
Input Layer
It is the initial or starting layer of the Multilayer perceptron. It takes input from the training
data set and forwards it to the hidden layer. There are n input nodes in the input layer. The
number of input nodes depends on the number of dataset features. Each input vector variable
is distributed to each of the nodes of the hidden layer.
Hidden Layer
It is the heart of all artificial neural networks. This layer comprises all computations of the
neural network. The edges of the hidden layer have weights multiplied by the node values.
This layer uses the activation function.
There can be one or two hidden layers in the model.
Several hidden layer nodes should be accurate as few nodes in the hidden layer make the
model unable to work efficiently with complex data. More nodes will result in an
overfitting problem.
Output Layer
This layer gives the estimated output of the Neural Network. The number of nodes in the
output layer depends on the type of problem. For a single targeted variable, use one node. N
classification problem, ANN uses N nodes in the output layer.
Working of Multilayer Perceptron Neural Network
The input node represents the feature of the dataset.
Each input node passes the vector input value to the hidden layer.
In the hidden layer, each edge has some weight multiplied by the input variable. All
the production values from the hidden nodes are summed together. To generate the
output
The activation function is used in the hidden layer to identify the active nodes.
The output is passed to the output layer.
Calculate the difference between predicted and actual output at the output layer.
The model uses backpropagation after calculating the predicted output.
Backpropagation Algorithm
The backpropagation algorithm is used in a Multilayer perceptron neural network to increase
the accuracy of the output by reducing the error in predicted output and actual
output. According to this algorithm,
Calculate the error after calculating the output from the Multilayer perceptron
neural network.
This error is the difference between the output generated by the neural network and the
actual output. The calculated error is fed back to the network, from the output layer to
the hidden layer.
Now, the output becomes the input to the network.
The model reduces error by adjusting the weights in the hidden layer.
Calculate the predicted output with adjusted weight and check the error. The process
is recursively used till there is minimum or no error.
This algorithm helps in increasing the accuracy of the neural network.
Advantages of Multilayer Perceptron Neural Network
1. Multilayer Perceptron Neural Networks can easily work with non-linear problems.
2. It can handle complex problems while dealing with large datasets.
3. Developers use this model to deal with the fitness problem of Neural Networks.
4. It has a higher accuracy rate and reduces prediction error by using backpropagation.
5. After training the model, the Multilayer Perceptron Neural Network quickly predicts
the output.
Disadvantages of Multilayer Perceptron Neural Network
1. This Neural Network consists of large computation, which sometimes increases
the overall cost of the model.
2. The model will perform well only when it is trained perfectly.
3. Due to this model’s tight connections, the number of parameters and node
redundancy increases.
Explain Radial Basis Function (RBF) network & training of RBF network in detail
Radial Basis Function (RBF) Networks are a particular type of Artificial Neural
Network used for function approximation problems. RBF Networks differ from other neural
networks in their three-layer architecture, universal approximation, and faster learning speed.
Input Layer
The input layer consists of one neuron for every predictor variable. The input neurons pass the
value to each neuron in the hidden layer. N-1 neurons are used for categorical values, where
N denotes the number of categories. The range of values is standardized by subtracting the
median and dividing by the interquartile range.
Hidden Layer
The hidden layer contains a variable number of neurons (the ideal number determined by the
training process). Each neuron comprises a radial basis function centered on a point. The
number of dimensions coincides with the number of predictor variables. The radius or spread
of the RBF function may vary for each dimension.
When an x vector of input values is fed from the input layer, a hidden neuron calculates the
Euclidean distance between the test case and the neuron's center point. It then applies the
kernel function using the spread values. The resulting value gets fed into the summation
layer.
This is a single layer neural network in which the input training vector and the output target
vectors are the same. The weights are determined so that the network stores a set of patterns.
Architecture of Auto−Associative Neural Networks
The architecture of this network consists of several layers: the input layer, the mapping layer,
the bottleneck layer, and the decoding or de-mapping layer.
Input layer
It is the first layer of the network and is responsible for receiving incoming data. Each
neuron in this layer represents a variable or characteristic in the input data set. The
activation function used in this layer depends on the data type being used. For example, the
linear activation function is usually used for numerical data.
Mapping layer
It is the second layer of the network. Specifically, this layer maps the input data to a latent
representation in a new dimension. Moreover, each neuron in this layer receives inputs from
all neurons in the input layer and, consequently, emits a unique output that represents a linear
combination of the inputs received. Furthermore, the activation function used in this layer is
usually nonlinear, such as the sigmoid function or the ReLU function.
Bottleneck layer
It is the third layer of the network and is responsible for reducing the dimensionality of the
representation. This layer has fewer neurons than the input and mapping layers. Therefore, it
acts as a bottleneck that forces the network to learn a more compact representation of the
data. The activation function used in this layer is usually the linear function, regardless of the
data used.
Decoding layer
After passing through the bottleneck layer, the representation propagates to the decoding
layer, a reverse copy of the mapping layer. The decoding layer is responsible for
reconstructing the original input from the representation. Therefore, the activation function
used in this layer must be the same as in the mapping layer.
In summary, the input layer receives the input data, the mapping layer learns a latent
representation of the data, the bottleneck layer reduces the dimensionality of the latent
representation, and the decoding layer reconstructs the original input from the latent
representation.
Hebb Rule:
When A and B are positively correlated, then increase the strength of the connection
between them.
When A and B are negatively correlated, then decrease the strength of the connection
between them.
In practice, we use following formula to set the weights:
AANN recognizes the input vector to be known if the output unit after activation generated
same pattern as one stored in it.
Applications
Auto-associative Neural Networks can be used in many fields:
Pattern Recognition
Bio-informatics
Voice Recognition
Signal Validation etc.
Similar to Auto Associative Memory network, this is also a single layer neural network.
However, in this network the input training vector and the output target vectors are not the
same. The weights are determined so that the network stores a set of patterns. Hetero
associative network is static in nature, hence, there would be no non-linear and delay
operations.
Architecture
As shown in the following figure, the architecture of Hetero Associative Memory network
has ‘n’ number of input training vectors and ‘m’ number of output target vectors.
Training Algorithm
For training, this network is using the Hebb or Delta learning rule.
Step 1 − Initialize all the weights to zero as wij = 0 i=1ton,j=1tom
Testing Algorithm
Step 1 − Set the weights obtained during training for Hebb’s rule.
Step 3 − Set the activation of the input units equal to that of the input vector.
XOr, or Exclusive Or, is a binary logical operator that takes in Boolean inputs and gives out
True if and only if the two inputs are different. This logical operator is especially useful
when we want to check two conditions that can't be simultaneously true. The following is
the Truth table for XOr function
The XOr problem is that we need to build a Neural Network (a perceptron in our case) to
produce the truth table related to the XOr logical operator. This is a binary classification
problem. Hence, supervised learning is a better way to solve it. In this case, we will be
using perceptrons. Uni layered perceptrons can only work with linearly separable data. But
in the following diagram drawn in accordance with the truth table of the XOr loical
operator, we can see that the data is NOT linearly separable.
The Solution
To solve this problem, we add an extra layer to our vanilla perceptron, i.e., we create a Multi
Layered Perceptron (or MLP). We call this extra layer as the Hidden layer. To build a
perceptron, we first need to understand that the XOr gate can be written as a combination of
AND gates, NOT gates and OR gates in the following way:
a XOr b = (a AND NOT b)OR(bAND NOTa)
The following is a plan for the perceptron.
Here, we need to observe that our inputs are 0s and 1s. To make it a XOr gate, we will make
the h1 node to perform the (x2 AND NOT x1) operation, the h2 node to perform (x1 AND
NOT x2) operation and the y node to perform (h1 OR h2) operation. The NOT gate can be
produced for an input a by writing (1-a), the AND gate can be produced for inputs a and b by
writing (a.b) and the OR gate can be produced for inputs a and b by writing (a+b). Also, we'll
use the sigmoid function as our activation function σ, i.e., σ(x) = 1/(1+e^(-x)) and the
threshold for classification would be 0.5, i.e., any x with σ(x)>0.5 will be classified as 1 and
others will be classified as 0.
Now, since we have all the information, we can go on to define h1, h2 and y. Using the
formulae for AND, NOT and OR gates, we get:
Hence, we have built a multi layered perceptron with the following weights and it predicts
the output of a XOr logical operator.
UNIT II LEARNING TECHNIQUES
1. Input Layer – This is where the network receives data from the
outside world.
2. Hidden Layers – These layers process the input data and extract
useful patterns or features.
3. Output Layer – This layer gives the final result based on the
processed data.
In most neural networks, the units in one layer are connected to the
units in the next layer. Each connection has a weight, which controls how
much one unit affects another. As data moves through these connections,
the network learns more about the information. This learning process
helps the network improve and eventually produce a final result from the
output layer.
Artificial Neural Networks are inspired by how human brain neurons work.
They are also called neural networks or neural nets.
Input Layer – This is the first layer that takes in information from
the outside world and passes it to the next layer.
Hidden Layer – This is the second layer, where each unit (neuron)
receives input from the previous layer, does some calculations, and
passes the result to the next layer.
Artificial Neural Networks (ANNs) are based on how neurons work in animal
brains, so they have similar structures and functions.
1. Structure:
Just like in the brain, the network processes and transfers information
step by step.
Dendrite Inputs
Synapses Weights
Axon Output
Synapses:
Learning:
Activation:
For example, if you want an ANN to recognize a cat, you show it thousands of
cat images. The network studies these images to understand what a cat
looks like.
Training Process:
1. Social Media
4. Personal Assistants
Artificial Neural Networks: Supervised Learning: Introduction and how brain works,
Neuron as a simple computing element, The perceptron, Backpropagation networks:
architecture, multilayer perceptron, backpropagation learning-input layer,
accelerated learning in multilayer perceptron, The Hopfield network, Bidirectional
associative memories (BAM), RBF Neural Network.
13) Explain Radial Basis Function (RBF) network & training of RBF network in
detail
Radial Basis Function (RBF) Networks are a particular type of Artificial Neural
Network used for function approximation problems. RBF Networks differ from other
neural networks in their three-layer architecture, universal approximation, and faster
learning speed.
Input Layer
The input layer consists of one neuron for every predictor variable. The input neurons
pass the value to each neuron in the hidden layer. N-1 neurons are used for categorical
values, where N denotes the number of categories. The range of values is standardized
by subtracting the median and dividing by the interquartile range.
Hidden Layer
The hidden layer contains a variable number of neurons (the ideal number determined
by the training process). Each neuron comprises a radial basis function centered on a
point. The number of dimensions coincides with the number of predictor variables. The
radius or spread of the RBF function may vary for each dimension.
When an x vector of input values is fed from the input layer, a hidden neuron calculates
the Euclidean distance between the test case and the neuron's center point. It then
applies the kernel function using the spread values. The resulting value gets fed into the
summation layer.
An MLP is a type of feedforward artificial neural network with multiple layers, including
an input layer, one or more hidden layers, and an output layer. Each layer is fully
connected to the next. In this article, we will understand Multilayer Perceptron Neural
Network, an important concept of deep learning and neural networks.
Input Layer
It is the initial or starting layer of the Multilayer perceptron. It takes input from the
training data set and forwards it to the hidden layer. There are n input nodes in the
input layer. The number of input nodes depends on the number of dataset features.
Each input vector variable is distributed to each of the nodes of the hidden layer.
Hidden Layer
It is the heart of all artificial neural networks. This layer comprises all computations of
the neural network. The edges of the hidden layer have weights multiplied by the node
values. This layer uses the activation function.
Several hidden layer nodes should be accurate as few nodes in the hidden layer make
the model unable to work efficiently with complex data. More nodes will result in an
overfitting problem.
Output Layer
This layer gives the estimated output of the Neural Network. The number of nodes in
the output layer depends on the type of problem. For a single targeted variable, use one
node. N classification problem, ANN uses N nodes in the output layer.
Each input node passes the vector input value to the hidden layer.
In the hidden layer, each edge has some weight multiplied by the input variable. All
the production values from the hidden nodes are summed together. To generate the
output
The activation function is used in the hidden layer to identify the active nodes.
Calculate the difference between predicted and actual output at the output layer.
Backpropagation Algorithm
Calculate the error after calculating the output from the Multilayer perceptron neural
network.
This error is the difference between the output generated by the neural network and
the actual output. The calculated error is fed back to the network, from the output
layer to the hidden layer.
The model reduces error by adjusting the weights in the hidden layer.
Calculate the predicted output with adjusted weight and check the error. The process
is recursively used till there is minimum or no error.
3. Developers use this model to deal with the fitness problem of Neural Networks.
4. It has a higher accuracy rate and reduces prediction error by using backpropagation.
5. After training the model, the Multilayer Perceptron Neural Network quickly
predicts the output.
3. Due to this model’s tight connections, the number of parameters and node
redundancy increases.
Part c
1) Using back-propagation network, find the new weights for the net shown in
figure below. It is presented with the input pattern [0, 1] and the target output is
1. Use a learning rate, α =0.25 and binary sigmoidal activation function.
[Link]
2) Train the hetero-associative memory network using outer products rule to
store input row vectors S = (s1, s2, s3, s4) to the output row vectors t = (t1, t2). Use
the vector pairs as given in table below.
[Link]
(1)Design a McCulloch-Pitts (MP) neuron for realization of a two input AND logic.
(3) Explain McCulloch-Pitts (MP) model with an example. Explain the limitations
of MP model
1. Inputs (x₁, x₂, ..., xₙ): These are the binary inputs to the neuron.
2. Weights (w₁, w₂, ..., wₙ): Each input has an associated weight. These weights
are usually real numbers.
3. Summation: The neuron calculates a weighted sum of the inputs
4. Threshold (θ): The neuron has a threshold value.
5. Activation Function: A step function that outputs 1 if the weighted sum is
greater than or equal to the threshold, otherwise it outputs 0.
1. Input Collection
Inputs (x1,x2,...,xnx): Collect the binary inputs for the neuron. Each input can be
either 0 or 1.
2. Assign Weights
Weights (w1,w2,…..wn): Assign weights to each input. Weights are typically real
numbers and represent the importance of each input in the decision-making
process.
Calculate the weighted sum of the inputs. This is done using the formula:
4. Apply Threshold
Threshold (θ\thetaθ): Determine the threshold value for the neuron. The
threshold is a real number that serves as a cutoff for deciding the output.
5. Activation Function
6. Output
Produce the binary output based on the result of the activation function. The output
will be either 0 or 1.
Example :
Limitations of the MP Model
1. Binary Inputs and Outputs: The MP model only works with binary inputs and
outputs (0s and 1s), limiting its application to simple logical operations.
2. Linear Separability: The MP neuron can only solve problems that are linearly
separable. It cannot solve problems like the XOR problem, where the classes
cannot be separated by a single straight line.
3. Fixed Threshold: The threshold is fixed and must be manually set, making it
less flexible in adapting to different problems without reconfiguration.
4. Lack of Learning Mechanism: The MP model does not have a learning
mechanism. Weights and thresholds need to be predefined and cannot be
adjusted automatically based on input-output pairs.
5. No Concept of Hidden Layers: The MP model represents a single neuron and
does not account for the concept of hidden layers, which are essential for solving
complex problems in modern neural networks.
(2)Explain with diagram the structure of artificial neurons, its types and its
various Types of activation functions.
4. **Bias**: A bias term is added to the weighted sum. The bias allows the
neuron to adjust its output independently of the inputs.
5. **Activation Function**: The result of the summation function plus the bias
is passed through an activation function.
6. **Output**: The output of the neuron is the result of the activation function.
(4)
Write short note on Adaline
Neurons.
[Link]
Workflow:
Adaline
First, calculate the net input to your Adaline network then apply the activation function
to its output then compare it with the original output if both the equal, then give the
output else send an error back to the network and update the weight according to the
error which is calculated by the delta learning rule.
Architecture:
Adaline
In Adaline, all the input neuron is directly connected to the output neuron with the
weighted connected path. There is a bias b of activation function 1 is present.
Algorithm:
Step 1: Initialize weight not zero but small random values are used. Set learning rate
α.
Step 2: While the stopping condition is False do steps 3 to 7.
Step 3: for each training set perform steps 4 to 6.
Step 4: Set activation of input unit xi = si for (i=1 to n).
Step 5: compute net input to output unit
when the predicted output and the true value are the same then the weight will
not change.
Step 7: Test the stopping condition. The stopping condition may be when the weight
changes at a low rate or no change.
An MLP is a type of feedforward artificial neural network with multiple layers, including
an input layer, one or more hidden layers, and an output layer. Each layer is fully
connected to the next. In this article, we will understand Multilayer Perceptron Neural
Network, an important concept of deep learning and neural networks.
Input Layer
It is the initial or starting layer of the Multilayer perceptron. It takes input from the
training data set and forwards it to the hidden layer. There are n input nodes in the
input layer. The number of input nodes depends on the number of dataset features.
Each input vector variable is distributed to each of the nodes of the hidden layer.
Hidden Layer
It is the heart of all artificial neural networks. This layer comprises all computations of
the neural network. The edges of the hidden layer have weights multiplied by the node
values. This layer uses the activation function.
Output Layer
This layer gives the estimated output of the Neural Network. The number of nodes in
the output layer depends on the type of problem. For a single targeted variable, use one
node. N classification problem, ANN uses N nodes in the output layer.
Each input node passes the vector input value to the hidden layer.
In the hidden layer, each edge has some weight multiplied by the input variable. All
the production values from the hidden nodes are summed together. To generate the
output
The activation function is used in the hidden layer to identify the active nodes.
Calculate the difference between predicted and actual output at the output layer.
Backpropagation Algorithm
Calculate the error after calculating the output from the Multilayer perceptron neural
network.
This error is the difference between the output generated by the neural network and
the actual output. The calculated error is fed back to the network, from the output
layer to the hidden layer.
The model reduces error by adjusting the weights in the hidden layer.
Calculate the predicted output with adjusted weight and check the error. The process
is recursively used till there is minimum or no error.
8. Developers use this model to deal with the fitness problem of Neural Networks.
9. It has a higher accuracy rate and reduces prediction error by using backpropagation.
10. After training the model, the Multilayer Perceptron Neural Network quickly
predicts the output.
6. Due to this model’s tight connections, the number of parameters and node
redundancy increases.
What is Backpropagation?
Backpropagation is a powerful algorithm in deep learning, primarily used to train
artificial neural networks, particularly feed-forward networks. It works iteratively,
minimizing the cost function by adjusting weights and biases.
In each epoch, the model adapts these parameters, reducing loss by following the error
gradient. Backpropagation often utilizes optimization algorithms like gradient
descent or stochastic gradient descent. The algorithm computes the gradient using
the chain rule from calculus, allowing it to effectively navigate complex layers in the
neural network to minimize the cost function.
The Backpropagation algorithm involves two main steps: the Forward Pass and the
Backward Pass.
For example, in a network with two hidden layers (h1 and h2 as shown in Fig. (a)), the
output from h1 serves as the input to h2. Before applying an activation function, a bias
is added to the weighted inputs.
Each hidden layer applies an activation function like ReLU (Rectified Linear Unit), which
returns the input if it’s positive and zero otherwise. This adds non-linearity, allowing
the model to learn complex relationships in the data. Finally, the outputs from the last
hidden layer are passed to the output layer, where an activation function, such as
softmax, converts the weighted outputs into probabilities for classification.
Once the error is calculated, the network adjusts weights using gradients, which are
computed with the chain rule. These gradients indicate how much each weight and bias
should be adjusted to minimize the error in the next iteration. The backward pass
continues layer by layer, ensuring that the network learns and improves its
performance. The activation function, through its derivative, plays a crucial role in
computing these gradients during backpropagation.
Example of Backpropagation in Machine Learning
Let’s walk through an example of backpropagation in machine learning. Assume the
neurons use the sigmoid activation function for the forward and backward pass. The
target output is 0.5, and the learning rate is 1.
To
find the outputs of y3, y4 and y5
4. Computing Outputs
Error Calculation
Note that, our actual output is 0.5 but we obtained 0.67.
To calculate the error, we can use the below formula:
4. Weight Updates
wij=wji
Types:
Now for next unit, we will take updated value via feedback. (i.e. y =
[1 0 1 0])
Now for next unit, we will take updated value via feedback. (i.e. y = [1 0 1
0])
Genetic Algorithms (GAs) are a class of optimization algorithms inspired by the principles
of natural selection and genetics. They are particularly useful for solving complex problems
where traditional methods might be inefficient. Below, I provide a detailed description of
the main features and components of Genetic Algorithms:
3. Fitness Function
The fitness function evaluates how good each solution is in solving the problem. It assigns a
fitness score to each individual in the population. This score determines the individual’s
ability to survive and reproduce. The fitness function is problem-specific and is designed to
reflect the quality of the solution.
4. Selection
Selection is the process of choosing individuals from the population to create offspring for
the next generation. Several selection methods can be used:
Roulette Wheel Selection: Individuals are selected based on their fitness proportion.
Higher fitness individuals have a higher probability of being selected.
Tournament Selection: A subset of individuals is chosen randomly, and the
best individual from this subset is selected.
Rank Selection: Individuals are ranked based on their fitness, and selection is
based on this ranking.
5. Crossover (Recombination)
Crossover is a genetic operator used to combine the genetic information of two parents to
generate new offspring. It promotes the exploration of new solutions by combining different
parts of good solutions. Common crossover techniques include:
6. Mutation
Mutation introduces genetic diversity into the population by randomly altering the genes of
an individual. It helps prevent premature convergence to local optima. Common mutation
techniques include:
7. Replacement
Replacement determines how the new generation is formed. It decides which individuals
from the current generation and the offspring will survive to the next generation. Common
strategies include:
8. Termination
The GA process continues for multiple generations until a termination condition is met.
Termination conditions can be:
9. Elitism
Elitism ensures that the best individuals from the current generation are carried over to the
next generation without any changes. This guarantees that the solution quality does not
degrade.
Maintaining diversity in the population helps avoid premature convergence and ensures a
thorough exploration of the search space. Techniques to preserve diversity include:
Some GAs use adaptive methods to dynamically adjust parameters such as mutation and
crossover rates based on the performance of the algorithm. This adaptation helps improve the
efficiency and effectiveness of the GA.
GAs can be combined with other optimization techniques, such as local search methods, to
enhance performance. These hybrid approaches leverage the global search capabilities of
GAs and the local search strengths of other methods.
Genetic Algorithms (GAs) are search heuristics that mimic the process of natural selection.
One of the key components of GAs is the crossover (or recombination) method, which
combines the genetic information of two parent solutions to produce new offspring. Different
crossover methods have distinct mechanisms and effects on the search process. Here’s a
detailed explanation of several common crossover methods used in Genetic Algorithms:
1. Single-Point Crossover
Steps:
Two-point crossover is an extension of single-point crossover where two crossover points are
selected. The segments between these points are swapped between the two parents.
Steps:
3. Uniform Crossover
Uniform crossover uses a fixed mixing ratio to combine parent genes. Each gene in the offspring
is chosen randomly from one of the corresponding genes of the parents.
Process:
For each gene, randomly choose whether it will be taken from Parent 1 or Parent 2.
4. Arithmetic Crossover
Arithmetic crossover is commonly used with real-valued genes. It creates offspring by taking
a weighted average of the parent genes.
Steps:
1. For each gene, compute the offspring gene as a linear combination of the parents'
genes.
2. The combination is usually parameterized by a factor α.
Example:
less
Copy code
Parent 1: [2.5, 3.5]
Parent 2: [5.0, 1.5]
Offspring 1: α * [2.5, 3.5] + (1-α) * [5.0, 1.5]
Offspring 2: (1-α) * [2.5, 3.5] + α * [5.0, 1.5]
For α = 0.5:
Offspring 1: [3.75, 2.5]
Offspring 2: [3.75, 2.5]
5. Blend Crossover (BLX-α)
Blend crossover (BLX-α) is another crossover method used for real-valued genes. It
generates offspring by considering a range around the parents' genes determined by a
parameter α.
Steps:
1. For each gene, compute a range [min_i - d, max_i + d] where d = α * (max_i - min_i).
2. Generate offspring genes randomly within this range.
Example:
Parent 1: [2.5, 3.5]
Parent 2: [5.0, 1.5]
α = 0.5:
Range for gene 1: [2.5 - 1.25, 5.0 + 1.25] = [1.25, 6.25]
Range for gene 2: [1.5 - 1.0, 3.5 + 1.0] = [0.5, 4.5]
Offspring 1: [random(1.25, 6.25), random(0.5, 4.5)]
Offspring 2: [random(1.25, 6.25), random(0.5, 4.5)]
6. Partially Mapped Crossover (PMX)
PMX is specifically designed for permutation-based problems, such as the Traveling
Salesman Problem (TSP). It ensures that offspring are valid permutations.
Steps:
1. Select two crossover points.
2. Map the segment between the crossover points from one parent to the
corresponding segment in the other parent.
3. Resolve conflicts by mapping remaining elements accordingly.
Example:
Parent 1: [1, 2, 3, | 4, 5, 6, | 7, 8, 9]
Parent 2: [4, 5, 6, | 1, 2, 3, | 7, 8, 9]
Crossover points: ^ ^
Offspring 1: [4, 5, 6, | 4, 5, 6, | 7, 8, 9] -> Resolve to [4, 5, 6, 1, 2, 3, 7, 8, 9]
Offspring 2: [1, 2, 3, | 1, 2, 3, | 7, 8, 9] -> Resolve to [1, 2, 3, 4, 5, 6, 7, 8, 9]
7. Order Crossover (OX)
Order crossover is also used for permutation-based problems. It preserves the relative order
of the genes in the parent chromosomes.
Steps:
1. Select two crossover points.
2. Copy the segment between the crossover points from one parent.
3. Fill the remaining positions with genes from the other parent in the order they
appear, skipping duplicates.
Example:
Describe the terms chromosome, fitness function, crossover and mutation as used in
Genetic Algorithm with examples.
Genetic Algorithms (GAs) are adaptive heuristic search algorithms premised on the
evolutionary ideas of natural selection and genetics. They are used to find optimal or near-
optimal solutions to complex problems that are difficult to solve using conventional
methods. Here are detailed descriptions of key terms used in GAs: chromosome, fitness
function, crossover, and mutation, along with examples for better understanding.
Chromosome
Example:
Consider a simple problem of finding the maximum value of a mathematical function, say
f(x)=x2f(x) = x^2f(x)=x2, within a given range. If xxx ranges from 0 to 31, one way to
represent a chromosome is by using a 5-bit binary string:
Chromosome: 10101 (which represents the number 21 in decimal)
This chromosome represents the candidate solution x=21x = 21x=21.
Fitness Function
The fitness function evaluates how close a given solution (chromosome) is to the
optimum solution of the problem. It assigns a fitness score to each chromosome, which is
used to guide the selection process during the evolution of the algorithm. The fitness
function is problem-specific and designed to reflect the quality or suitability of a solution.
Example:
For chromosome 10101 (which is x=21x = 21x=21), the fitness function could
be f(21)=212=441f(21) = 21^2 = 441f(21)=212=441.
This means the fitness of the chromosome 10101 is 441.
Crossover
Crossover is a genetic operator used to combine the genetic information of two parent
chromosomes to generate new offspring. It mimics the process of sexual reproduction and
promotes the exploration of new areas in the search space.
There are different types of crossover methods, such as one-point crossover, two-point
crossover, and uniform crossover.
Example:
Parent 1: 10101
Parent 2: 11011
Suppose we choose the crossover point after the second bit:
o Offspring 1: 10111
o Offspring 2: 11001
Mutation
Example:
Assume a mutation rate of 0.1 (10%). For a given chromosome 10101:
If mutation occurs at the second bit, the new chromosome might be 11101
(changing the second bit from 0 to 1).
Example Application
Consider optimizing the function f(x)=x2f(x) = x^2f(x)=x2 for xxx in the range of 0 to 31:
This process will ideally lead to a population of chromosomes that represents optimal
or near-optimal solutions to the given problem.
Discuss in detail the stopping condition for Genetic Algorithm flow.
In Genetic Algorithms (GA), the stopping condition determines when the algorithm should
terminate. The choice of stopping condition is crucial as it affects the efficiency and
effectiveness of the search process. Here are several common stopping conditions used in
Genetic Algorithms:
Implementation Considerations
Monitoring: During the execution of the GA, it's important to monitor the
population's progress and evaluate whether the chosen stopping condition is
appropriate.
Early Stopping: Implementing early stopping mechanisms can save
computational resources if the GA converges quickly.
Dynamic Conditions: Sometimes, adaptive stopping conditions that change during
runtime based on algorithm performance or problem characteristics can be
beneficial.
In summary, the stopping condition in Genetic Algorithms plays a critical role in determining
when to terminate the search process. It should be chosen carefully based on the specific
problem, computational resources, and desired outcomes of the optimization process.
Elucidate in detail different applications of Genetic Algorithm
Genetic Algorithms (GAs) are powerful search and optimization techniques inspired by the
principles of natural selection and genetics. They find applications in various fields where
complex optimization or search problems need to be solved. Here are ten detailed
applications of Genetic Algorithms:
1. Optimization Problems: GAs are widely used to solve optimization problems where
the goal is to find the best solution among a large set of possible solutions. This
could include optimizing parameters in engineering design, financial portfolios,
logistics planning, etc. GAs efficiently explore large solution spaces and can handle
complex, multi-modal landscapes where traditional methods struggle.
2. Machine Learning: Genetic Algorithms can be applied to optimize parameters and
structures of machine learning models. For example, optimizing the architecture of
neural networks, selecting features, or tuning hyperparameters like learning rates
and regularization terms. GAs complement traditional gradient-based methods by
exploring alternative configurations that may lead to better performance.
3. Robotics: In robotics, GAs are used for tasks such as path planning, motion control,
and robot design optimization. They can evolve control strategies or robot
morphologies to adapt to different environments or tasks. This flexibility makes
GAs suitable for both simulation-based and real-world robotics applications.
4. Game Playing: Genetic Algorithms have been applied to evolve strategies for
playing games. This includes classic board games like chess or Go, where GAs can
evolve strategies that compete with or even surpass human players. They are also
used in developing AI opponents in video games, adjusting difficulty levels
dynamically based on player performance.
5. Bioinformatics: GAs are used in bioinformatics for tasks such as sequence alignment,
protein folding, and modeling biological networks. They can optimize complex
objective functions derived from biological data, helping researchers understand
genetic sequences, protein structures, and interactions within biological systems.
6. Financial Modeling: GAs are employed in financial applications for portfolio
optimization, risk management, and algorithmic trading. They can evolve trading
strategies based on historical data and market conditions, optimizing decision-making
processes to maximize returns while minimizing risks.
7. Image Processing: In image processing, GAs can optimize image enhancement
techniques, feature extraction algorithms, and image recognition systems. They
are used to automate the process of tuning parameters in complex image
processing pipelines, improving the accuracy and efficiency of pattern recognition
tasks.
8. Scheduling and Timetabling: GAs are effective in solving scheduling problems, such
as employee scheduling, project scheduling, and timetabling for schools or
universities. They can generate optimal or near-optimal schedules considering
multiple constraints and objectives, such as minimizing conflicts or maximizing
resource utilization.
9. Evolutionary Robotics: This field applies GAs to evolve robot behaviors and
morphologies in simulated environments. By evolving robots over multiple
generations, researchers can discover novel solutions to complex tasks, such
as locomotion strategies in varying terrains or cooperative behaviors in
swarms.
[Link] Design and Creativity: GAs can be used in creative fields such as
architecture, industrial design, and art. They aid in generating novel designs or
artistic expressions by evolving prototypes or configurations based on aesthetic or
functional criteria. This application leverages GAs' ability to explore diverse
solutions and discover unconventional designs.
UNIT 4
Discuss in detail the operations and properties of fuzzy sets
Represent the fuzzy sets operations using Venn diagram.
FUZZY SETS
Fuzzy sets may be viewed as an extension and generalization of the basic concepts of crisp
sets.
Fuzzy set it allows partial membership. A fuzzy set is a set having degrees of membership
between 1 and 0. The membership in a fuzzy set need not be complete, i.e., member of one
fuzzy set a1so be member of other fuzzy sets in the same universe.
Vagueness is introduced in fuzzy set by eliminating the sharp boundaries that divide members
from nonmembers in the group. There is a gradual transition between full membership and
non membership, not abrupt transition.
A fuzzy set in the universe of discourse U can be defined as a set of ordered pairs and it is given
by,
The degree of membership assumes values in the range from 0 to 1, i.e., the
membership is set to unit interval [0, 1] or ε [0, 1].
The universe of discourse U is discrete and finite fuzzy set A is given as follows:
A fuzzy set is universal fuzzy set if and only if the value of the membership function is 1 for
all the members under consideration. Any fuzzy set A defined on a universe U is a subset of
that universe.
Two fuzzy sets A and B are said to be equal fuzzy sets if μA(x) = μB(x) for all x ϵ U.
A fuzzy set A is said to be empty fuzzy set if and only if the value of the membership
function is 0 for all possible members considered. The universal fuzzy set can also be called
whole fuzzy set.
The collection of all fuzzy sets and fuzzy subsets on universe U is called, fuzzy power set
P(U). Since all the fuzzy sets can overlap, the cardinaliry of the fuzzy power set, nP(U) is
infinite. i.e.) nP(U) = ∞.
1. Commutativity: A property that states that the order of operands does not affect the
result of an operation. For example, in addition, a+b=b+aa + b = b + a a+b=b+a.
2. Associativity: This property states that the grouping of operands does not affect the
result of an operation. For example, in addition, (a+b)+c=a+(b+c)(a + b) + c = a + (b +
c)(a+b)+c=a+(b+c).
4. Idempotency: This property states that applying an operation multiple times does not
change the result after the first application. For example, in set theory, A∪A=AA \
cup A = AA∪A=A (union of a set with itself).
5. Identity: This refers to an element in a set with respect to a binary operation, such
that applying the operation with this element leaves other elements unchanged. For
example, the number 0 is the identity element for addition because a+0=aa + 0 =
aa+0=a for any number aaa.
6. Involution (double negation): This refers to an operation that when applied twice
returns the original value. In logic, ¬(¬A)=A\neg(\neg A) = A¬(¬A)=A.
7. Transitivity: This property applies to relations, stating that if one element relates in
a certain way to a second element, and the second element relates in the same way to
a third element, then the first element relates in the same way to the third element.
8. De Morgan's law: This is a pair of logical equivalences that state how to negate
conjunctions and disjunctions. Specifically:
These concepts are fundamental in various branches of mathematics, logic, and computer
science, and they help in understanding how operations behave under different conditions
Let A and B be fuzzy sets in the universe of discourse U. For a given element x on the
universe, the following function theoretic operations of union, intersection and complement
are defined for fuzzy sets and on U.
1) Union
2) lntersection
3) Complement
When μA(x) ϵ [0,1] , the , denoted as complement of is
defined by
The Venn diagram for complement operation of fuzzy set is shown in Figure below.
4) Algebraic sum
5) Algebraic product
6) Bounded sum
7. Bounded difference
Mamdani Fuzzy Inference System (FIS): A Mamdani FIS is a method of fuzzy logic
control that uses a collection of fuzzy rules and fuzzy sets to make decisions or predictions
based on input data. The system processes inputs through fuzzification, applies inference
rules to the fuzzified inputs, aggregates the results, and then defuzzifies the aggregated fuzzy
outputs to produce a crisp output.
The formation of inference rules in a Mamdani Fuzzy Inference System (FIS) is a critical
step in creating a system that can effectively model complex decision-making processes. The
Mamdani approach, introduced by Ebrahim Mamdani in 1975, is known for its intuitive and
human-readable rule structure. Here’s a detailed description of the steps involved in forming
inference rules in a Mamdani FIS:
Rule Table
Create a rule matrix or table to systematically organize and visualize the rules.
Rows and Columns: Each row represents a possible combination of input
fuzzy sets, and the corresponding column entries specify the output fuzzy sets.
Example:
Degree of DirtinessLoad SizeWash TimeWater TemperatureLowSmallShortCol
dMediumMediumMediumWarmHighLargeLongHotDegree of DirtinessLowMe
diumHighLoad SizeSmallMediumLargeWash TimeShortMediumLong
Water TemperatureColdWarmHot
Fuzzification
Convert the crisp input values into fuzzy values using the defined
membership functions.
Example: If the input "Degree of Dirtiness" is 0.7 (on a scale of 0 to 1), it
might belong 70% to the "Medium" set and 30% to the "High" set.
Rule Evaluation (Inference)
Evaluate each rule based on the fuzzified inputs to determine the degree of truth for
the antecedents.
Aggregation: Use logical operators (AND, OR) to combine the degrees of
membership of the antecedents.
Example: For a rule with two antecedents connected by AND, the degree of
truth is the minimum degree of membership among the antecedents.
Aggregation of Consequents
Combine the fuzzy sets resulting from each rule into a single fuzzy set for each output
variable.
Example: Use the maximum or sum of degrees of membership from different
rules contributing to the same fuzzy set of an output.
6. Defuzzification
Testing
Test the FIS with various input scenarios to ensure it behaves as expected.
Example: Simulate different load sizes and degrees of dirtiness to check if the
washing machine adjusts its settings correctly.
Refinement
Adjust the fuzzy sets, membership functions, and rules based on test results and
feedback.
Iterative Process: Continuously improve the system to enhance its
performance and accuracy.
The Takagi-Sugeno (T-S) fuzzy inference system is a type of fuzzy logic system used for
modeling and control applications. It's named after its developers, M. Takagi and M. Sugeno.
This system extends traditional Mamdani-type fuzzy inference systems by incorporating a
different method of rule formulation and output computation.
1. Fuzzification:
o Input Membership Functions: Similar to other fuzzy systems, T-S systems
begin with fuzzification, where crisp inputs are converted into fuzzy values
using membership functions. These functions define how each input value
contributes to each fuzzy set (e.g., "low," "medium," "high").
2. Rule Base:
o Unlike Mamdani-type systems that use linguistic rules (IF-THEN rules), T-S
systems use propositional rules of the form:
csharp
Copy code
Rule i: If x1 is A1i and x2 is A2i and ... and xn is Ani then yi = fi(x1, x2, ..., xn)
Here, yi represents the output of the system for the i-th rule, and fi is a function
of the input variables.
3. Rule Evaluation:
o Each rule in the T-S system computes an output yi based on the antecedents (the
IF part of the rule), which are evaluated using fuzzy logic principles.
4. Aggregation:
o The outputs from all rules are aggregated to determine the overall system
output. This aggregation typically involves weighted averaging, where
each
rule's output is multiplied by a weight representing the degree of confidence or
applicability of the rule.
5. Defuzzification:
o Finally, the aggregated fuzzy output is converted back into a crisp output
using a defuzzification method. Common methods include centroid
defuzzification, weighted average, or max membership.
Example Application
Consider a temperature control system where the inputs are temperature (T) and rate of
change of temperature (dT/dt), and the output is the heating rate (R). A T-S fuzzy system for
this application might have rules like:
In this example:
Each rule computes the heating rate R based on the current temperature and its rate
of change.
The weights (0.5, 0.2, 0.7, -0.3) determine the contribution of each input to the
output, reflecting the confidence in the rule's applicability.
Conclusion
The Takagi-Sugeno fuzzy inference system provides a flexible and powerful framework for
modeling complex systems where traditional methods may struggle due to non-linearities or
uncertainties. By combining fuzzy logic principles with explicit functional relationships
(through propositional rules), T-S systems offer a robust approach to modeling and control in
various engineering and decision-making domains.
Unit 3
The Hebbian Learning principle is a foundational theory in the field of neural networks and
soft computing. It is often summarized by the phrase "cells that fire together wire together."
This principle, introduced by Donald Hebb in 1949, suggests that the synaptic connection
between two neurons is strengthened if they are activated simultaneously. In other words, the
learning process is based on the correlation of neural activity.
Key Concepts:
1. Synaptic Plasticity: The ability of synapses (connections between neurons) to strengthen or
weaken over time, in response to increases or decreases in their activity.
2. Activity Correlation: The idea that the co-activation of neurons leads to an increase in
synaptic strength between them.
3. Learning Rule: Mathematically, the weight change in a synapse can be expressed as:
𝑦𝑗
Δ𝑤𝑖𝑗=𝜂⋅𝑥𝑖⋅ Δwij=η⋅xi⋅yj
where:
𝑗 𝑖 𝑗
i Δ𝑤𝑖 Δwij is the change in synaptic weight between neuron and neuron j,
The flowchart below illustrates the Hebbian Learning process in a neural network context:
S
In soft computing, associative memory refers to a type of memory system that retrieves
information based on content rather than exact memory addresses. It's inspired by the way
human memory works, where recalling one piece of information can trigger the retrieval of
related information.
Working Principle:
Unit 3
Explain the concept of Hopfield network with suitable example.
A Hopfield Network comprises a collection of interconnected neurons or nodes. These
neurons may be binary, with the states +1 and -1 (or 1 and 0), respectively.
Each neuron stands for a component of memory or pattern. Each neuron in the
network is connected to every other neuron in the system, including itself,
with the exception of diagonal connections, which are often set to zero.
The strength of the connections between neurons is typically represented by
these connections, which are frequently binary weights (they can be +1 or -1).
Another essential characteristic of a Hopfield Network is an energy function, which
is used by Hopfield networks to ascertain the network’s state. When the network
reaches a stable state, which corresponds to a stored pattern or a collection of
patterns, its energy is decreased.
The network updates its states in discrete time steps based on the states of the neurons
to which it is linked. Neurons typically choose their future state using a
straightforward updating rule, such as the McCulloch-Pitts model. Asynchronously
or sequentially, each neuron’s state is updated until the network reaches a stable state
The Architecture of a Hopfield Network
The following components make up the Hopfield network’s architecture:
𝑦𝑖𝑛𝑖=𝑥𝑖+∑[𝑦𝑗𝑤𝑗𝑖] yini=xi+∑j[yjwji]
Calculate the total input of the network yin using the equation given below.
Apply activation over the total input to calculate the output as per the equation given
Let's say you want to create a Hopfield network to remember the pattern of a letter "A" in a
grid of 5x5 pixels. In this grid, each pixel can be either black (representing 'on' or active) or
white (representing 'off' or inactive). Your goal is to train the network to recognize and recall
this pattern.
1. Initialization: Start by initializing the network with random weights. Each neuron is
connected to every other neuron, including itself. These connections are represented by
the weight matrix.
2. Training: Present the letter "A" to the network as an input pattern. For each pixel in the grid,
if it's black, set the corresponding neuron in the network to firing, and if it's white, set the
neuron to not firing. Update the weights of the network based on Hebbian learning, which
strengthens connections between neurons that tend to be active at the same time and
weakens connections between neurons that tend to be active at different times. Repeat this
process for multiple presentations of the letter "A" until the network converges and
stabilizes.
3. Rec™all: Now, if you present a corrupted or incomplete version of the letter "A" to the
network, it should be able to recall and reconstruct the complete pattern based on the
stored memory. This is achieved through iterative updating of neuron states until the
network settles into a stable state, which hopefully corresponds to the desired pattern.
Unit 2
Explain the multilayer perceptron algorithm in detail.
An MLP is a type of feedforward artificial neural network with multiple layers, including an
input layer, one or more hidden layers, and an output layer. Each layer is fully connected to
the next. In this article, we will understand Multilayer Perceptron Neural Network, an
important concept of deep learning and neural networks.
Input Layer
It is the initial or starting layer of the Multilayer perceptron. It takes input from the training
data set and forwards it to the hidden layer. There are n input nodes in the input layer. The
number of input nodes depends on the number of dataset features. Each input vector variable
is distributed to each of the nodes of the hidden layer.
Hidden Layer
It is the heart of all artificial neural networks. This layer comprises all computations of the
neural network. The edges of the hidden layer have weights multiplied by the node
values. This layer uses the activation function.
There can be one or two hidden layers in the model.
Several hidden layer nodes should be accurate as few nodes in the hidden layer make the
model unable to work efficiently with complex data. More nodes will result in an
overfitting problem.
Output Layer
This layer gives the estimated output of the Neural Network. The number of nodes in the
output layer depends on the type of problem. For a single targeted variable, use one node. N
classification problem, ANN uses N nodes in the output layer.
Working of Multilayer Perceptron Neural Network
The input node represents the feature of the dataset.
Each input node passes the vector input value to the hidden layer.
In the hidden layer, each edge has some weight multiplied by the input variable. All
the production values from the hidden nodes are summed together. To generate the
output
The activation function is used in the hidden layer to identify the active nodes.
The output is passed to the output layer.
Calculate the difference between predicted and actual output at the output layer.
The model uses backpropagation after calculating the predicted output.
Backpropagation Algorithm
The backpropagation algorithm is used in a Multilayer perceptron neural network to increase
the accuracy of the output by reducing the error in predicted output and actual
output. According to this algorithm,
Calculate the error after calculating the output from the Multilayer perceptron
neural network.
This error is the difference between the output generated by the neural network and the
actual output. The calculated error is fed back to the network, from the output layer to the
hidden layer.
Now, the output becomes the input to the network.
The model reduces error by adjusting the weights in the hidden layer.
Calculate the predicted output with adjusted weight and check the error. The process
is recursively used till there is minimum or no error.
This algorithm helps in increasing the accuracy of the neural network.
Advantages of Multilayer Perceptron Neural Network
1. Multilayer Perceptron Neural Networks can easily work with non-linear problems.
2. It can handle complex problems while dealing with large datasets.
3. Developers use this model to deal with the fitness problem of Neural Networks.
4. It has a higher accuracy rate and reduces prediction error by using backpropagation.
5. After training the model, the Multilayer Perceptron Neural Network quickly predicts
the output.
Disadvantages of Multilayer Perceptron Neural Network
1. This Neural Network consists of large computation, which sometimes increases
the overall cost of the model.
2. The model will perform well only when it is trained perfectly.
3. Due to this model’s tight connections, the number of parameters and node
redundancy increases.
Explain Radial Basis Function (RBF) network & training of RBF network in detail
Radial Basis Function (RBF) Networks are a particular type of Artificial Neural
Network used for function approximation problems. RBF Networks differ from other neural
networks in their three-layer architecture, universal approximation, and faster learning speed.
Input Layer
The input layer consists of one neuron for every predictor variable. The input neurons pass the
value to each neuron in the hidden layer. N-1 neurons are used for categorical values, where
N denotes the number of categories. The range of values is standardized by subtracting the
median and dividing by the interquartile range.
Hidden Layer
The hidden layer contains a variable number of neurons (the ideal number determined by the
training process). Each neuron comprises a radial basis function centered on a point. The
number of dimensions coincides with the number of predictor variables. The radius or spread
of the RBF function may vary for each dimension.
When an x vector of input values is fed from the input layer, a hidden neuron calculates the
Euclidean distance between the test case and the neuron's center point. It then applies the
kernel function using the spread values. The resulting value gets fed into the summation
layer.
This is a single layer neural network in which the input training vector and the output target
vectors are the same. The weights are determined so that the network stores a set of patterns.
The architecture of this network consists of several layers: the input layer, the mapping layer,
the bottleneck layer, and the decoding or de-mapping layer.
Input layer
It is the first layer of the network and is responsible for receiving incoming data. Each
neuron in this layer represents a variable or characteristic in the input data set. The
activation function used in this layer depends on the data type being used. For example, the
linear activation function is usually used for numerical data.
Mapping layer
It is the second layer of the network. Specifically, this layer maps the input data to a latent
representation in a new dimension. Moreover, each neuron in this layer receives inputs from
all neurons in the input layer and, consequently, emits a unique output that represents a linear
combination of the inputs received. Furthermore, the activation function used in this layer is
usually nonlinear, such as the sigmoid function or the ReLU function.
Bottleneck layer
It is the third layer of the network and is responsible for reducing the dimensionality of the
representation. This layer has fewer neurons than the input and mapping layers. Therefore, it
acts as a bottleneck that forces the network to learn a more compact representation of the
data. The activation function used in this layer is usually the linear function, regardless of the
data used.
Decoding layer
After passing through the bottleneck layer, the representation propagates to the decoding
layer, a reverse copy of the mapping layer. The decoding layer is responsible for
reconstructing the original input from the representation. Therefore, the activation function
used in this layer must be the same as in the mapping layer.
In summary, the input layer receives the input data, the mapping layer learns a latent
representation of the data, the bottleneck layer reduces the dimensionality of the latent
representation, and the decoding layer reconstructs the original input from the latent
representation.
Hebb Rule:
When A and B are positively correlated, then increase the strength of the connection
between them.
When A and B are negatively correlated, then decrease the strength of the connection
between them.
In practice, we use following formula to set the weights:
AANN recognizes the input vector to be known if the output unit after activation generated same
pattern as one stored in it.
Applications
Auto-associative Neural Networks can be used in many fields:
Pattern Recognition
Bio-informatics
Voice Recognition
Signal Validation etc.
Similar to Auto Associative Memory network, this is also a single layer neural network.
However, in this network the input training vector and the output target vectors are not the
same. The weights are determined so that the network stores a set of patterns. Hetero
associative network is static in nature, hence, there would be no non-linear and delay
operations.
Architecture
As shown in the following figure, the architecture of Hetero Associative Memory network has
‘n’ number of input training vectors and ‘m’ number of output target vectors.
Training Algorithm
For training, this network is using the Hebb or Delta learning rule.
Testing Algorithm
Step 1 − Set the weights obtained during training for Hebb’s rule.
Step 3 − Set the activation of the input units equal to that of the input vector.
XOr, or Exclusive Or, is a binary logical operator that takes in Boolean inputs and gives out
True if and only if the two inputs are different. This logical operator is especially useful
when we want to check two conditions that can't be simultaneously true. The following is
the Truth table for XOr function
The XOr problem
The XOr problem is that we need to build a Neural Network (a perceptron in our case) to
produce the truth table related to the XOr logical operator. This is a binary classification
problem. Hence, supervised learning is a better way to solve it. In this case, we will be
using perceptrons. Uni layered perceptrons can only work with linearly separable data. But
in the following diagram drawn in accordance with the truth table of the XOr loical
operator, we can see that the data is NOT linearly separable.
The Solution
To solve this problem, we add an extra layer to our vanilla perceptron, i.e., we create a Multi
Layered Perceptron (or MLP). We call this extra layer as the Hidden layer. To build a
perceptron, we first need to understand that the XOr gate can be written as a combination of
AND gates, NOT gates and OR gates in the following way:
a XOr b = (a AND NOT b)OR(bAND NOTa)
The following is a plan for the perceptron.
Here, we need to observe that our inputs are 0s and 1s. To make it a XOr gate, we will make
the h1 node to perform the (x2 AND NOT x1) operation, the h2 node to perform (x1 AND
NOT x2) operation and the y node to perform (h1 OR h2) operation. The NOT gate can be
produced for an input a by writing (1-a), the AND gate can be produced for inputs a and b by
writing (a.b) and the OR gate can be produced for inputs a and b by writing (a+b). Also, we'll
use the sigmoid function as our activation function σ, i.e., σ(x) = 1/(1+e^(-x)) and the
threshold for classification would be 0.5, i.e., any x with σ(x)>0.5 will be classified as 1 and
others will be classified as 0.
Now, since we have all the information, we can go on to define h1, h2 and y. Using the
formulae for AND, NOT and OR gates, we get:
Hence, we have built a multi layered perceptron with the following weights and it predicts
the output of a XOr logical operator.