0% found this document useful (0 votes)
3 views24 pages

Soft Computing Notes

Soft computing material
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views24 pages

Soft Computing Notes

Soft computing material
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SOFT COMPUTING

Complete Study Notes for [Link] Students


Fuzzy Logic • Neural Networks • Genetic Algorithms • Hybrid Systems

What's Inside
Unit I — Introduction to Soft Computing and Fuzzy Logic
Unit II — Artificial Neural Networks – I
Unit III — Artificial Neural Networks – II
Unit IV — Genetic Algorithms and Optimization
Unit V — Hybrid Soft Computing Systems

Every topic explained in simple language, with worked examples, comparison tables, and quick-revision boxes for fast exam
prep.
Soft Computing — Study Notes [Link]

Table of Contents
TOC \h \o "1-3"

Page 2 of 24
Soft Computing — Study Notes [Link]

UNIT I: Introduction to Soft Computing and Fuzzy Logic

1.1 What is Soft Computing?


Soft Computing is a collection of computing techniques that try to mimic the way the human brain
solves problems — by tolerating imprecision, uncertainty, and partial truth, instead of demanding exact,
rigid answers. It is the opposite philosophy of traditional (hard) computing, which needs precise inputs
and gives exact outputs.
Simple way to remember: Hard computing is like a strict teacher who only accepts "correct or wrong."
Soft computing is like an experienced doctor who can still diagnose you even with incomplete
symptoms, using judgment and approximation.

Components of Soft Computing


• Fuzzy Logic (FL) — handles uncertainty and vagueness (e.g., "hot", "tall", "fast").
• Artificial Neural Networks (ANN) — mimics the human brain's learning ability using
interconnected neurons.
• Genetic Algorithms (GA) — mimics natural evolution (survival of the fittest) to find optimal
solutions.
• Hybrid Systems — combine two or more of the above (e.g., Neuro-Fuzzy, Fuzzy-GA) for better
performance.

Differences Between Soft Computing and Hard (Conventional) Computing


Aspect Hard Computing Soft Computing
Approximate reasoning, tolerance
Basis Precise, exact analysis
for imprecision
Logic Type Two-valued logic (True/False) Multi-valued / fuzzy logic
Works with incomplete, noisy,
Data Required Needs accurate, complete data
ambiguous data
Parallel, can be
Approach Sequential, deterministic
stochastic/adaptive
Conventional algorithms, digital Fuzzy systems, Neural Networks,
Examples
circuits Genetic Algorithms

Applications of Soft Computing


• Handwriting and speech recognition (pattern recognition)
• Automatic washing machines that adjust wash cycles based on dirt level (fuzzy logic)
• Stock market prediction and financial forecasting
• Medical diagnosis support systems
• Autonomous vehicles and robotics control
• Image processing and computer vision
• Optimization problems like scheduling, routing, and resource allocation

Page 3 of 24
Soft Computing — Study Notes [Link]

Quick Example
Think of an air conditioner with a simple ON/OFF thermostat (hard computing): it only knows
"too hot" or "too cold," so it constantly switches on and off. A fuzzy-logic-based AC (soft
computing) understands "slightly warm", "very warm", "comfortable" and smoothly adjusts
the cooling speed — giving more comfort and saving energy.

1.2 Introduction to Fuzzy Logic


Fuzzy Logic is a method of reasoning that deals with approximate, rather than exact, reasoning. It was
introduced by Lotfi A. Zadeh in 1965. Unlike classical (Boolean) logic where a statement is either
completely True (1) or completely False (0), fuzzy logic allows a degree of truth between 0 and 1.

Why Fuzzy Logic is needed


Real-world language is vague: "the water is hot," "he is tall," "the traffic is heavy." These
statements cannot be represented using strict True/False values, but fuzzy logic can assign
a degree (e.g., 0.8 hot) to represent how true the statement is.

1.2.1 Crisp Sets vs Fuzzy Sets


Crisp Set: A traditional set where an element either belongs (membership = 1) or does not belong
(membership = 0) to the set. There is a sharp, well-defined boundary.
Fuzzy Set: A set where each element has a degree of membership ranging between 0 and 1
(inclusive), representing partial belonging. The boundary is not sharp — it is gradual.

Aspect Crisp Set Fuzzy Set


Membership value Only 0 or 1 Any value between 0 and 1
Boundary Sharp / well defined Gradual / overlapping
"Tall = height ≥ 6 ft" (5'11" is "Tall" — 5'11" person may have
Example
NOT tall) membership 0.8
Real-life fit Poor for vague human concepts Good for vague human concepts

Example: Crisp vs Fuzzy – “Hot Water”


Crisp definition: Water is “hot” if temperature ≥ 70°C. So 69°C water = “not hot” (membership
0), and 70°C water = “hot” (membership 1). This sudden jump does not match how humans
actually perceive temperature.
Fuzzy definition: Membership in “hot” set might be: 40°C → 0.1, 55°C → 0.5, 70°C → 0.8,
90°C → 1.0. This smooth, gradual change matches real human perception much better.

1.2.2 Membership Functions (MF)


A Membership Function defines how each point in the input space (universe of discourse) is mapped to
a membership value (degree of belonging) between 0 and 1. It is the mathematical backbone of any
fuzzy set.
• Notation: μA(x) — the membership of element x in fuzzy set A.

Page 4 of 24
Soft Computing — Study Notes [Link]

• Range: 0 ≤ μA(x) ≤ 1

Common Types of Membership Functions


Type Shape Typical Use
Triangle shape — rises then Simple, most commonly used for
Triangular (trimf)
falls linearly general vague terms
Used when a range of values has
Trapezoidal (trapmf) Flat top, sloped sides
full/equal membership
Used for smooth/continuous
Gaussian (gaussmf) Smooth bell-curve
transitions, e.g. sensor data
Used for one-sided concepts like
Sigmoidal (sigmf) S-shaped curve
"very hot" or "very cold"

Example: Membership Function for “Warm” Temperature (Triangular)


Suppose “Warm” is defined with a triangular MF having points (20, 0), (30, 1), (40, 0) on the
temperature axis (°C).
This means: at 20°C membership = 0 (not warm at all), at 30°C membership = 1 (fully
warm), at 40°C membership = 0 again (too hot to be called “warm”).
At 25°C (halfway between 20 and 30), membership = 0.5 — i.e., “25°C is 50% warm.”

1.2.3 Fuzzy Set Operations


Just like crisp sets have union, intersection, and complement, fuzzy sets have similar operations, but
they work on membership degrees instead of binary values.

Operation Formula Meaning


Take the larger
Union (OR) μA∪B(x) = max(μA(x), μB(x))
membership value
Take the smaller
Intersection (AND) μA∩B(x) = min(μA(x), μB(x))
membership value
Subtract membership from
Complement (NOT) μA'(x) = 1 − μA(x)
1

Example: Fuzzy Set Operations


Let μA(x) = 0.6 (degree to which x is “warm”) and μB(x) = 0.8 (degree to which x is “humid”).
Union (Warm OR Humid) = max(0.6, 0.8) = 0.8
Intersection (Warm AND Humid) = min(0.6, 0.8) = 0.6
Complement (NOT Warm) = 1 − 0.6 = 0.4

1.2.4 Fuzzy Rules and Fuzzy Reasoning


A fuzzy rule is an IF-THEN statement that connects fuzzy input variables to fuzzy output variables,
similar to human reasoning.

Page 5 of 24
Soft Computing — Study Notes [Link]

General form: IF (antecedent / condition) THEN (consequent / conclusion)

Example: Fuzzy Rules for an Air Conditioner


Rule 1: IF temperature is HOT AND humidity is HIGH THEN fan_speed is FAST
Rule 2: IF temperature is COOL THEN fan_speed is SLOW
Rule 3: IF temperature is WARM AND humidity is LOW THEN fan_speed is MEDIUM
Fuzzy reasoning then combines the truth values of these rules (using min/max operations) to
compute a final, smooth output instead of an abrupt ON/OFF decision.

1.2.5 Fuzzy Inference Systems (FIS)


A Fuzzy Inference System is the overall engine that takes crisp inputs, fuzzifies them, applies fuzzy
rules, and produces an output (after defuzzification). There are two widely used models:

(a) Mamdani Fuzzy Model


• Proposed by Ebrahim Mamdani in 1975; the most commonly used fuzzy model.
• Both the input AND the output are expressed as fuzzy sets (linguistic terms like "high", "low").
• Steps: Fuzzification → Rule Evaluation (using fuzzy operators) → Aggregation of rule outputs →
Defuzzification.
• Easy to understand and widely used in decision-making systems (e.g., washing machines,
medical diagnosis).

(b) Sugeno Fuzzy Model (Takagi-Sugeno)


• Proposed by Takagi and Sugeno in 1985.
• The input is fuzzy, but the output is a mathematical function (often linear) of the inputs, not a fuzzy
set.
• Rule form: IF x is A AND y is B THEN z = f(x, y)
• Computationally efficient and well-suited for mathematical analysis, optimization, and adaptive
systems (used heavily in ANFIS — see Unit V).
Feature Mamdani Model Sugeno Model
Crisp mathematical function
Output type Fuzzy set (needs defuzzification)
(linear/constant)
Very intuitive, human-readable
Interpretability Less intuitive but more precise
rules
Computation Higher computational cost Faster, computationally efficient
Optimization, adaptive/learning
Best suited for Decision support, control systems
systems (ANFIS)

1.2.6 Defuzzification Techniques


Defuzzification is the process of converting a fuzzy output (a fuzzy set) back into a single crisp (real)
number, so the result can be used practically (e.g., to set an actual fan speed in RPM).

Method Description
Centroid (Center of Calculates the center of the area under the output fuzzy curve.

Page 6 of 24
Soft Computing — Study Notes [Link]

Method Description
Gravity) Most popular and accurate method.
Takes the average of the points where the membership function
Mean of Maximum (MOM)
reaches its maximum value.
Used mainly in Sugeno models; output = weighted sum of rule
Weighted Average
outputs divided by sum of weights.
Finds the vertical line that divides the area under the curve into
Bisector Method
two equal halves.

Example: Centroid Defuzzification (Simplified)


Suppose the fuzzy output for “fan speed” after rule aggregation gives a small triangular
shape with corner points at 40, 60, and 80 (in % speed).
For a simple triangle, the centroid (center of gravity) is approximately the average of the
three corner points: (40 + 60 + 80) / 3 = 60.
So, the crisp output sent to the fan motor is approximately 60% speed — a smooth, exact
value derived from a fuzzy decision.

Unit I – Quick Revision


Soft computing tolerates imprecision; hard computing needs exact data.
Fuzzy sets allow partial membership (0 to 1); crisp sets allow only 0 or 1.
Membership functions (triangular, trapezoidal, Gaussian, sigmoidal) define the “shape” of a
fuzzy set.
Fuzzy operations: Union = max, Intersection = min, Complement = 1 − μ.
Mamdani gives fuzzy output (needs defuzzification); Sugeno gives a mathematical function
as output.
Defuzzification (commonly Centroid method) converts fuzzy output back into a crisp, usable
number.

UNIT II: Artificial Neural Networks – I

2.1 Introduction to Neural Networks


An Artificial Neural Network (ANN) is a computing system inspired by the structure and working of the
biological brain. It consists of interconnected processing units called neurons that work together to learn
patterns from data and make predictions or decisions.

2.1.1 Biological Neurons vs Artificial Neurons


Biological neurons are the basic units of the human nervous system. They receive signals through
dendrites, process them in the cell body (soma), and pass the signal through the axon to other neurons
via synapses.

Biological Neuron Artificial Neuron (Equivalent)


Dendrites (receive signals) Inputs (x1, x2, x3...)
Synapse (connection strength) Weights (w1, w2, w3...)

Page 7 of 24
Soft Computing — Study Notes [Link]

Biological Neuron Artificial Neuron (Equivalent)


Cell body / Soma (processes signal) Summation function + Activation function
Axon (sends output signal) Output (y)
Firing threshold Bias / Threshold value

Simple Analogy
Think of an artificial neuron like a voting committee. Each input is a vote, but votes don’t
have equal importance — each vote has a weight (importance level). The committee adds
up the weighted votes; if the total crosses a certain threshold (bias), the decision is “YES”
(neuron fires/activates), otherwise “NO”.

2.1.2 Architecture of Neural Networks


The structure (architecture) of an ANN defines how neurons are arranged and connected in layers.

Architecture Type Description


Has only an input layer connected directly to an output layer; no
Single Layer Network
hidden layers. Example: Single Layer Perceptron.
Has one or more hidden layers between input and output layers,
Multi-Layer Network allowing it to learn complex, non-linear patterns. Example: Multi-
Layer Perceptron (MLP).
Signals move only in one direction — from input to output, with
Feedforward Network
no loops or cycles.
Feedback (Recurrent) Signals can move backward as well, creating loops; output of a
Network neuron can feed back as input (used in RNNs, see Unit III).

2.1.3 Feedforward vs Feedback Networks


Aspect Feedforward Network Feedback Network
One direction only (input →
Signal direction Can move backward (loops exist)
output)
Has memory — depends on
Memory No memory of previous inputs
previous states
Recurrent Neural Networks
Examples Perceptron, MLP
(RNN), Hopfield Network
Classification, simple pattern Sequential data: time series, text,
Best suited for
recognition speech

2.2 Learning Rules


A learning rule is the algorithm/method by which the weights of a neural network are adjusted, so the
network gradually "learns" the relationship between inputs and outputs from training data.

Page 8 of 24
Soft Computing — Study Notes [Link]

2.2.1 Hebbian Learning Rule


Proposed by Donald Hebb (1949), often summarized as: "Neurons that fire together, wire together." If
two connected neurons are activated simultaneously, the connection (weight) between them is
strengthened.
Weight update formula: Δw = η × x × y
• η (eta) = learning rate (a small positive constant)
• x = input value
• y = output value

Example: Hebbian Learning


Suppose input x = 1, output y = 1, and learning rate η = 0.5.
Δw = η × x × y = 0.5 × 1 × 1 = 0.5
If the old weight was 0.2, the new weight = 0.2 + 0.5 = 0.7. Since both input and output were
“on” (active) together, the connection strength increased — exactly matching Hebb’s
principle.

2.2.2 Delta Learning Rule (Widrow-Hoff Rule)


This rule adjusts weights based on the error (difference) between the desired (target) output and the
actual output produced by the network. It uses gradient descent to minimize this error.
Weight update formula: Δw = η × (t − y) × x
• t = target (desired) output
• y = actual output produced by the network
• (t − y) = error

Example: Delta Learning Rule


Let target t = 1, actual output y = 0.6, input x = 0.8, and learning rate η = 0.4.
Error = t − y = 1 − 0.6 = 0.4
Δw = η × error × x = 0.4 × 0.4 × 0.8 = 0.128
The weight increases slightly to reduce the error and bring the actual output closer to the
target next time.

2.2.3 Perceptron Learning Rule


Used specifically for the Perceptron model. It updates weights only when the perceptron makes a
wrong (misclassified) prediction.
Weight update formula: Δw = η × (t − y) × x (same form as Delta rule, but here y is computed using a
step/threshold activation function, and updates occur only on misclassification)

Difference: Delta vs Perceptron Learning Rule


Perceptron Rule: works with step (threshold) activation — output is strictly 0 or 1; weights
update only on errors.
Delta Rule: works with continuous (linear/sigmoid) activation; weights update proportionally
to the continuous error, even when the prediction is close but not exact — making it suitable
for gradient-descent-based training.

Page 9 of 24
Soft Computing — Study Notes [Link]

2.3 Single Layer Perceptron and its Limitations


The Perceptron, invented by Frank Rosenblatt (1958), is the simplest type of artificial neural network —
a single neuron that takes multiple inputs, applies weights, sums them, and passes the result through a
step activation function to produce a binary output (0 or 1).

Working of a Single Layer Perceptron


1. Multiply each input by its corresponding weight: (x1×w1), (x2×w2), ...
2. Sum all weighted inputs and add the bias: net = Σ(xi × wi) + b
3. Apply an activation (step) function: output = 1 if net ≥ 0, else output = 0

Example: Perceptron for AND Gate


Inputs: x1, x2 (0 or 1). Suppose weights w1 = 1, w2 = 1, and bias b = −1.5.
For x1=1, x2=1: net = (1×1) + (1×1) + (−1.5) = 0.5 → output = 1 (since net ≥ 0) — correct,
since 1 AND 1 = 1
For x1=1, x2=0: net = (1×1) + (1×0) + (−1.5) = −0.5 → output = 0 — correct, since 1 AND 0 =
0
This shows how a simple perceptron, with correctly chosen weights and bias, can implement
a logical AND gate.

Limitations of Single Layer Perceptron


• Cannot solve non-linearly separable problems: the most famous example is the XOR problem
— there is no single straight line that can separate the XOR outputs (0,1,1,0) correctly.
• Linear decision boundary only: a single perceptron can only draw a straight line (or hyperplane)
to separate classes; it fails on data requiring curved or complex boundaries.
• No hidden layers: without hidden layers, it cannot learn complex feature combinations or
hierarchical patterns.

Why XOR Fails


XOR truth table: (0,0)→0, (0,1)→1, (1,0)→1, (1,1)→0.
If you plot these four points on a graph, the “1” outputs and “0” outputs are positioned
diagonally opposite — no single straight line can separate them into two groups. This was a
famous limitation pointed out by Minsky and Papert (1969), and it led to the development of
Multi-Layer Perceptrons.

2.4 Multi-Layer Perceptron (MLP): Backpropagation Algorithm


A Multi-Layer Perceptron overcomes the limitations of a single-layer perceptron by introducing one or
more hidden layers between the input and output layers. With non-linear activation functions, an MLP
can solve non-linearly separable problems like XOR.

Structure of MLP
• Input layer: receives the raw feature values.
• Hidden layer(s): perform intermediate computations and extract complex features; more hidden
layers/neurons = ability to learn more complex patterns.

Page 10 of 24
Soft Computing — Study Notes [Link]

• Output layer: produces the final prediction/classification.

Backpropagation Algorithm — Step-by-Step


Backpropagation ("backward propagation of errors") is the standard algorithm used to train MLPs. It
works by calculating the error at the output, then propagating that error backward through the network
to update weights layer by layer, using gradient descent.
4. Forward Pass: Input data is passed through the network layer by layer to produce an output
prediction.
5. Calculate Error: Compare the predicted output with the actual target using a loss/error function
(commonly Mean Squared Error).
6. Backward Pass: The error is propagated backward from the output layer to the hidden layer(s),
calculating how much each weight contributed to the error (using the chain rule of calculus /
partial derivatives).
7. Update Weights: Each weight is adjusted slightly in the direction that reduces the error: wnew =
wold − η × (∂Error/∂w)
8. Repeat: Steps 1-4 are repeated for many iterations (epochs) over the training data until the error
becomes acceptably small.

Simple Analogy for Backpropagation


Imagine you are baking a cake (forward pass) and it tastes too salty (error/output). You taste
it and figure out which ingredient most likely caused the saltiness — was it too much salt, or
the baking soda? (backward pass — assigning “blame” to each ingredient). Next time, you
reduce that ingredient slightly (weight update) and bake again. After many tries, the cake
tastes just right (network is trained / error minimized).

Important Notes on Backpropagation


Requires a differentiable activation function (like Sigmoid, Tanh, or ReLU) so gradients can
be calculated.
Learning rate (η) controls how big each weight-update step is — too high causes instability,
too low causes very slow learning.
Can suffer from problems like the “vanishing gradient,” especially in deep networks with
many layers.

2.5 Applications of Neural Networks


• Image and facial recognition (e.g., unlocking phones with Face ID)
• Speech recognition (e.g., Google Assistant, Siri, Alexa)
• Handwritten digit/character recognition (e.g., postal code reading)
• Medical diagnosis (e.g., detecting tumors from scan images)
• Stock market and sales forecasting
• Self-driving cars (object detection and decision-making)
• Recommendation systems (Netflix, Amazon, YouTube suggestions)
• Fraud detection in banking and credit card transactions

Unit II – Quick Revision


ANN mimics biological neurons: inputs ≈ dendrites, weights ≈ synapses, activation function ≈

Page 11 of 24
Soft Computing — Study Notes [Link]

neuron firing.
Feedforward = one-directional signal flow; Feedback/Recurrent = loops with memory.
Hebbian Rule: Δw = ηxy (strengthens connections when input & output are active together).
Delta/Perceptron Rule: Δw = η(t−y)x (updates weights based on the error between target
and actual output).
Single-layer Perceptron can only solve linearly separable problems — fails on XOR.
Multi-Layer Perceptron + Backpropagation solves non-linear problems by adjusting weights
backward from output to input, minimizing error using gradient descent.

UNIT III: Artificial Neural Networks – II

3.1 Hopfield Networks and Associative Memories


A Hopfield Network is a type of recurrent (feedback) neural network proposed by John Hopfield (1982),
used mainly as an associative memory — meaning it can store patterns and later recall (retrieve) the
complete pattern even when given a partial or noisy version of it.

Key Characteristics
• Fully connected network — every neuron is connected to every other neuron (but not to itself).
• Symmetric weights: weight from neuron i to j equals weight from j to i (wij = wji).
• Uses binary neurons (output is either +1/-1 or 0/1).
• Operates like an energy-minimization system: it always moves toward a stable, low-energy state,
which corresponds to a stored memory/pattern.

Associative Memory — What it Means


Associative memory works like human memory: if you see a partially smudged photo of a friend's face,
your brain can still recognize and recall the complete face. Similarly, a Hopfield network can be trained
on a set of patterns, and later, when given a corrupted/incomplete version of one pattern, it converges
(settles) to the closest matching stored pattern.

Example: Hopfield Network as Associative Memory


Suppose a Hopfield network is trained to store the pattern [1, -1, 1, -1] representing a simple
shape or code.
If you later input a noisy/corrupted version like [1, -1, -1, -1] (one bit flipped), the network's
neurons update iteratively based on weighted sums from other neurons.
After a few iterations, the network “settles” back to the closest stored stable pattern: [1, -1, 1,
-1] — successfully recalling the original pattern from a corrupted input.

• Two main types: Discrete Hopfield Network (binary states) and Continuous Hopfield Network
(continuous values, useful for optimization problems).
• Applications: Pattern/image restoration, optimization problems (like the Travelling Salesman
Problem), error correction.

Page 12 of 24
Soft Computing — Study Notes [Link]

3.2 Radial Basis Function (RBF) Networks


An RBF Network is a type of feedforward neural network that uses radial basis functions (typically
Gaussian functions) as the activation function in its hidden layer. It is widely used for function
approximation, classification, and time-series prediction.

Structure of an RBF Network (3 Layers)


Layer Function
Simply passes the input features forward — no computation
Input Layer
performed.
Hidden Layer (RBF Each neuron applies a radial basis function (usually Gaussian),
Layer) measuring how close the input is to that neuron's “center.”
Combines the weighted outputs from hidden neurons (usually a
Output Layer
simple linear combination) to produce the final result.

Gaussian RBF formula (conceptual): φ(x) = exp(−‖x − c‖² / 2σ²) — where c is the center of the
neuron and σ controls the width/spread of the curve.

Simple Analogy for RBF Networks


Imagine several “watchtowers” (hidden neurons), each responsible for monitoring a specific
region (center) of a city (input space). The closer an event (input) happens to a watchtower’s
assigned region, the stronger that tower’s “alert signal” (activation). The final decision
(output) is based on combining the alert signals from all the towers, weighted by their
importance.

Feature RBF Network Multi-Layer Perceptron (MLP)


Hidden layer Radial basis (Gaussian) — Sigmoid/ReLU/Tanh — weighted-
activation distance-based sum-based
Can be slower (especially deep
Training speed Generally faster to train
networks)
Function approximation, General classification, complex
Best suited for
interpolation pattern learning

3.3 Self-Organizing Maps (SOM)


A Self-Organizing Map, developed by Teuvo Kohonen, is a type of unsupervised neural network used
for clustering and dimensionality reduction. It converts complex, high-dimensional input data into a
simple, low-dimensional (usually 2D) map while preserving the topological relationships between data
points.

How SOM Works


9. Initialize a grid of neurons, each with a random weight vector of the same dimension as the input.
10. For each training input, find the “winning” neuron (called Best Matching Unit, BMU) — the
neuron whose weight vector is closest to the input.
11. Update the BMU's weights (and its neighboring neurons' weights) to move closer to the input
pattern.
Page 13 of 24
Soft Computing — Study Notes [Link]

12. Repeat for many training samples; over time, neurons “self-organize” so that similar inputs
activate neurons that are close to each other on the map.

Example: SOM for Customer Segmentation


A retail company has customer data with many features (age, income, spending habits,
purchase frequency, etc.) — high-dimensional data that's hard to visualize directly.
A SOM can map this high-dimensional customer data onto a simple 2D grid, where
customers with similar buying behavior end up positioned close together on the map.
The company can then visually identify clusters — for example, one area of the map might
represent “high-spending frequent buyers” while another represents “occasional bargain
shoppers.”

• Key property: Topology preservation — similar inputs map to nearby neurons; dissimilar inputs
map to distant neurons.
• Applications: Data visualization, clustering, customer segmentation, image/feature organization.

3.4 Recurrent Neural Networks (RNNs) — Basic Concepts


A Recurrent Neural Network is a type of neural network specifically designed to handle sequential data
(data where order matters), such as text, speech, time-series, or video frames. Unlike feedforward
networks, RNNs have loops that allow information to persist — they have a form of "memory."

Why RNNs Are Needed


Standard feedforward networks treat each input independently and have no memory of previous inputs.
But for tasks like predicting the next word in a sentence, the order and context of previous words matter
a great deal. RNNs solve this by feeding the output (hidden state) from the previous time step back into
the network as additional input for the current time step.
Conceptual formula: ht = f(W·xt + U·ht−1 + b) — the current hidden state ht depends on both the
current input xt and the previous hidden state ht−1.

Example: RNN for Sentence Completion


Consider the sentence: “The sky is ___.”
A feedforward network looking only at the word “is” in isolation has no context. An RNN,
however, processes the sentence word-by-word (“The” → “sky” → “is”), carrying forward a
“memory” (hidden state) of everything seen so far.
By the time it reaches the blank, it remembers the context “The sky” and can correctly
predict a likely word like “blue” — something a memory-less network could not do as
effectively.

Limitation of Basic RNNs


Basic RNNs struggle with long sequences due to the “vanishing gradient” problem — they
tend to “forget” information from many steps earlier. This led to advanced variants like LSTM
(Long Short-Term Memory) and GRU (Gated Recurrent Unit), which are designed to retain
long-term memory better.

• Applications: Language translation, speech recognition, text generation, stock price prediction,
music composition.

Page 14 of 24
Soft Computing — Study Notes [Link]

3.5 Convolutional Neural Networks (CNNs) — Overview and Applications


A Convolutional Neural Network is a specialized deep neural network designed primarily for processing
grid-like data such as images. CNNs automatically learn to detect important visual features (edges,
textures, shapes, objects) directly from raw pixel data, without manual feature engineering.

Key Layers in a CNN


Layer Function
Applies small filters (kernels) that slide over the image to detect
Convolutional Layer
local features like edges, corners, and textures.
Introduces non-linearity, typically using the ReLU function,
Activation (ReLU) Layer
allowing the network to learn complex patterns.
Pooling Layer (e.g., Max Reduces the spatial size of the data (downsampling), keeping
Pooling) the most important information and reducing computation.
Located near the end of the network; combines all extracted
Fully Connected Layer
features to make the final classification/decision.

How Convolution Works (Conceptually)


A small filter/kernel (e.g., a 3x3 grid of numbers) slides over the input image. At each position, it
performs an element-wise multiplication with the corresponding image pixels and sums the result,
producing one value in the output "feature map." Different filters detect different features — one might
detect vertical edges, another might detect curves.

Example: CNN for Handwritten Digit Recognition


Consider the classic task of recognizing handwritten digits (0-9), as in the MNIST dataset.
The convolutional layers first detect simple features like edges and curves (e.g., the curve of
a “0” vs. the straight lines of a “1”).
Deeper layers combine these simple features into more complex shapes (loops,
intersections), and the final fully connected layer combines everything to decide: “This image
is most likely the digit 7.”

Practical Use Cases of CNNs in Image and Pattern Recognition


• Image classification: identifying what object is present in an image (cat, dog, car, etc.)
• Face recognition: used in phone unlocking, security/surveillance systems
• Medical imaging: detecting tumors, fractures, or abnormalities in X-rays/MRI/CT scans
• Object detection: identifying and locating multiple objects within an image (used in self-driving
cars)
• Optical Character Recognition (OCR): reading text from scanned documents or number plates
• Agriculture: detecting crop diseases from leaf images using drone/camera footage

Unit III – Quick Revision


Hopfield Network = recurrent, associative memory; recalls complete patterns from
partial/noisy inputs by settling into a stable low-energy state.
RBF Network = 3 layers (input, Gaussian/RBF hidden layer, output); activation is distance-

Page 15 of 24
Soft Computing — Study Notes [Link]

based, great for function approximation.


SOM = unsupervised, maps high-dimensional data onto a low-dimensional grid while
preserving similarity/topology — used for clustering/visualization.
RNN = has memory via feedback loops; suited for sequential data (text, speech, time-
series); basic RNNs suffer from vanishing gradients over long sequences.
CNN = uses convolution + pooling layers to automatically extract visual features; the
backbone of modern image recognition systems.

UNIT IV: Genetic Algorithms and Optimization

4.1 Introduction to Genetic Algorithms (GA)


A Genetic Algorithm is a search and optimization technique inspired by Charles Darwin's theory of
natural evolution — "survival of the fittest." It was developed by John Holland in the 1970s. GAs are
especially useful for solving complex optimization problems where traditional mathematical methods
struggle (e.g., very large search spaces, non-linear or discontinuous functions).

Core Idea
A population of candidate solutions evolves over generations. Better solutions (“fitter”
individuals) are more likely to survive and reproduce, passing on their good traits, while
weaker solutions are gradually eliminated — eventually converging toward an optimal or
near-optimal solution.

Basic Terminology
Term Meaning (in GA) Biological Analogy
A candidate solution, encoded as a DNA / Genetic code of an
Chromosome
string (often binary) organism
A single value/bit within the
Gene A single hereditary unit
chromosome
The set of all candidate solutions in
Population A group/colony of organisms
a generation
A function that evaluates how
Fitness Function Natural survival advantage
“good” a solution is
One iteration/cycle of the GA
Generation One generation of offspring
process

Simple Analogy
Imagine you're breeding the fastest racehorses. You start with a random group of horses
(initial population). You measure each horse's speed (fitness function). The fastest horses
are allowed to breed (selection), their offspring inherit a mix of traits (crossover), and
occasionally a random trait change happens (mutation) — perhaps producing an even faster
horse by chance. Over many generations, the average speed of the horse population keeps
improving.

Page 16 of 24
Soft Computing — Study Notes [Link]

4.2 Encoding Techniques


Encoding is the process of representing a possible solution to a problem as a chromosome (a string of
genes) that the GA can manipulate.

Encoding Type Description Example Use


Encoding numbers,
Binary Encoding Each gene is a 0 or 1 bit subsets, simple
combinatorial problems
Optimizing continuous-
Value (Real-valued) Genes are actual real numbers (e.g.,
valued parameters (e.g.,
Encoding decimals)
weights)
Travelling Salesman
Permutation Chromosome is an ordered sequence
Problem (TSP), scheduling
Encoding of values, each appearing once
problems
Evolving
Chromosome represented as a tree
Tree Encoding expressions/programs
structure
(Genetic Programming)

Example: Binary Encoding


Suppose we want to find the best integer value of x (between 0 and 31) that maximizes a
function f(x) = x².
Since 31 in binary is 11111 (5 bits), we can encode each candidate solution as a 5-bit binary
string.
Chromosome “10110” represents the decimal value: 1×16 + 0×8 + 1×4 + 1×2 + 0×1 = 22.
This chromosome “10110” is one candidate solution representing x = 22.

4.3 Genetic Operators


Genetic operators are the mechanisms through which a GA evolves its population from one generation
to the next.

4.3.1 Selection
Selection chooses which individuals (chromosomes) from the current population will be used to create
the next generation, generally favoring fitter individuals (but still giving weaker ones some chance, to
maintain diversity).

Selection Method Description


Each individual gets a probability of being selected proportional
Roulette Wheel Selection to its fitness (like a weighted spinning wheel — fitter individuals
occupy a bigger “slice”).
A few individuals are randomly picked to “compete” and the
Tournament Selection
fittest among them is selected.
Rank Selection Individuals are ranked by fitness, and selection probability is
based on rank rather than raw fitness value (useful when

Page 17 of 24
Soft Computing — Study Notes [Link]

Selection Method Description


fitness values vary widely).

Example: Roulette Wheel Selection


Suppose 4 chromosomes have fitness values: A=10, B=20, C=30, D=40 (total = 100).
Selection probability: A = 10/100 = 10%, B = 20/100 = 20%, C = 30/100 = 30%, D = 40/100 =
40%.
Just like a roulette wheel where D occupies the biggest slice, D has the highest (but not
guaranteed) chance of being selected for reproduction — weaker chromosome A can still
occasionally get selected, preserving genetic diversity.

4.3.2 Crossover (Recombination)


Crossover combines genetic material from two parent chromosomes to produce one or more offspring,
mixing the "good traits" of both parents.

Crossover Type Description


A single random crossover point is chosen; genes are swapped
Single-Point Crossover
after that point between the two parents.
Two crossover points are chosen; the segment between them
Two-Point Crossover
is swapped between parents.
Each gene is independently chosen from either parent (e.g.,
Uniform Crossover
with 50% probability each).

Example: Single-Point Crossover


Parent 1: 1 1 0 | 1 0 Parent 2: 0 0 1 | 1 1
Suppose the crossover point is after the 3rd gene (shown by the | mark).
Offspring 1 = first 3 genes of Parent 1 + last 2 genes of Parent 2 = 1 1 0 1 1
Offspring 2 = first 3 genes of Parent 2 + last 2 genes of Parent 1 = 0 0 1 1 0
Both offspring now carry a mix of genetic material from both parents.

4.3.3 Mutation
Mutation randomly alters one or more genes in a chromosome, introducing new genetic diversity into
the population. This helps the GA avoid getting stuck in a local optimum and explore new areas of the
search space.

Example: Bit-Flip Mutation


Original chromosome: 1 1 0 1 1
Suppose mutation randomly flips the 4th bit (with a small mutation probability, e.g., 1%).
Mutated chromosome: 1 1 0 0 1
This small random change might create a chromosome with even better fitness than before
— or, occasionally, a slightly worse one. Over many generations, beneficial mutations tend
to survive and spread.

Page 18 of 24
Soft Computing — Study Notes [Link]

Why Mutation Matters


Without mutation, a GA can only recombine genes that already exist in the population. If a
useful gene value never appeared in the initial population, crossover alone could never
introduce it. Mutation provides a small random “spark” to explore beyond what currently
exists, helping avoid premature convergence to a poor (local optimum) solution.

4.4 Fitness Function


The fitness function is a mathematical function used to evaluate how good (or "fit") a candidate solution
(chromosome) is at solving the given problem. It guides the entire evolutionary process — higher
fitness means a higher chance of survival and reproduction.
• Must be designed carefully: a poorly designed fitness function can mislead the GA toward
incorrect or suboptimal solutions.
• Directly tied to the problem: for maximizing profit, fitness = profit value; for minimizing travel
distance, fitness could be defined as 1/distance (so shorter distance = higher fitness).

Example: Fitness Function for x² Maximization


If our goal is to maximize f(x) = x², then the fitness function is simply: Fitness(chromosome) =
f(decoded value of chromosome) = x².
Chromosome “10110” decodes to x = 22, so its fitness = 22² = 484.
Chromosome “00011” decodes to x = 3, so its fitness = 3² = 9.
Since 484 > 9, the chromosome “10110” is far “fitter” and much more likely to be selected for
reproduction.

4.5 GA Cycle / Working of a Genetic Algorithm


13. Initialize Population: Generate an initial population of chromosomes randomly.
14. Evaluate Fitness: Calculate the fitness value for each chromosome in the population.
15. Selection: Select parent chromosomes for reproduction, favoring fitter ones.
16. Crossover: Combine selected parents to produce offspring.
17. Mutation: Randomly mutate some genes in the offspring (with small probability).
18. Replacement: Form the new generation (replacing all or part of the old population with new
offspring).
19. Repeat: Steps 2-6 are repeated for many generations until a stopping condition is met (e.g.,
maximum generations reached, or a satisfactory fitness level achieved).

4.6 Applications of Genetic Algorithms in Optimization Problems


• Travelling Salesman Problem (TSP): finding the shortest route visiting a set of cities exactly
once.
• Scheduling problems: optimizing exam timetables, job-shop scheduling, employee shift
planning.
• Engineering design optimization: optimizing structural designs, antenna shapes, aerodynamic
profiles.
Page 19 of 24
Soft Computing — Study Notes [Link]

• Machine learning: tuning hyperparameters of neural networks, feature selection.


• Robotics: evolving robot control strategies and movement patterns.
• Financial portfolio optimization: selecting an optimal mix of investments to maximize returns
and minimize risk.
• Game playing/strategy evolution: evolving strategies for games and simulations.

Real-World Example: GA for Vehicle Routing


A delivery company needs to assign delivery routes to multiple trucks, minimizing total fuel
cost and time, while respecting truck capacity limits.
Each chromosome could represent one possible assignment of delivery stops to trucks and
their order. The fitness function calculates total cost/time for that arrangement (lower cost =
higher fitness).
Over many generations, selection, crossover, and mutation evolve increasingly efficient
routing plans — eventually converging to a near-optimal delivery schedule, much faster than
checking every possible combination.

Unit IV – Quick Revision


GA mimics natural evolution: population, fitness, selection, crossover, mutation.
Encoding represents a candidate solution as a chromosome (binary, real-valued,
permutation, or tree).
Selection (Roulette Wheel, Tournament, Rank) picks fitter chromosomes more often for
reproduction.
Crossover (single-point, two-point, uniform) combines genes of two parents into offspring.
Mutation randomly alters genes to maintain diversity and avoid getting stuck in local optima.
Fitness function is the key driver — it must accurately reflect how good a solution is for the
given problem.
GA cycle: Initialize → Evaluate → Select → Crossover → Mutate → Replace → Repeat until
stopping condition.

UNIT V: Hybrid Soft Computing Systems

5.1 Why Hybrid Systems?


Each soft computing technique (Fuzzy Logic, Neural Networks, Genetic Algorithms) has its own
strengths and weaknesses. Hybrid systems combine two or more techniques to overcome individual
limitations and produce more powerful, robust solutions.

Technique Strength Weakness


Cannot learn from data
Handles uncertainty/vagueness;
automatically;
Fuzzy Logic easy to interpret (human-readable
rules/membership functions
rules)
must be set manually
“Black box” — hard to
Can learn from data automatically;
Neural Networks interpret; needs lots of training
good at pattern recognition
data
Good global search/optimization; Can be slow; doesn't “learn”
Genetic Algorithms
doesn't get stuck easily continuously like ANN

Page 20 of 24
Soft Computing — Study Notes [Link]

Core Idea of Hybridization


Combine the learning ability of Neural Networks, the human-like interpretability of Fuzzy
Logic, and the optimization power of Genetic Algorithms — so each technique compensates
for the others’ weaknesses.

5.2 Neuro-Fuzzy Systems


A Neuro-Fuzzy system combines Artificial Neural Networks with Fuzzy Logic. The goal is to get the
best of both worlds: the learning and adaptation capability of neural networks, plus the human-
interpretable, rule-based reasoning of fuzzy logic.

How Neuro-Fuzzy Systems Work


• Fuzzy IF-THEN rules and membership functions form the structure/framework of the system.
• Neural network learning algorithms (like backpropagation/gradient descent) are used to
automatically tune the parameters of the membership functions and rules, instead of setting them
manually.
• The result: a system that is both trainable from data (like ANN) and interpretable/rule-based (like
fuzzy logic).

Simple Analogy
A pure fuzzy system is like an experienced human expert who has hand-crafted rules (“If
temperature is high and humidity is high, then turn fan speed to fast”) but never updates
them based on new data. A pure neural network is like a black-box machine that learns from
data but can't explain its reasoning. A Neuro-Fuzzy system is like that same expert, except
now their rules automatically get fine-tuned and improved over time based on real observed
data — combining experience with continuous learning.

5.3 ANFIS — Adaptive Neuro-Fuzzy Inference System


ANFIS, developed by Jyh-Shing Roger Jang (1993), is the most well-known and widely used neuro-
fuzzy architecture. It implements a Sugeno-type fuzzy inference system (see Unit I) using a neural-
network-like layered structure, allowing it to be trained using standard learning algorithms (like
backpropagation or hybrid learning).

ANFIS Architecture — 5 Layers


Layer Function
Each input is converted into a fuzzy membership value using
Layer 1: Fuzzification membership functions (e.g., Gaussian, triangular) — these
MF parameters are adjustable/trainable.
Combines the membership values for each rule using fuzzy
Layer 2: Rule (Firing Strength) AND (typically multiplication), producing a firing strength for
each rule.
Normalizes each rule's firing strength by dividing it by the
Layer 3: Normalization
sum of all rules' firing strengths.

Page 21 of 24
Soft Computing — Study Notes [Link]

Layer Function
Calculates each rule's individual output, typically a linear
Layer 4: Defuzzification
function of the inputs (Sugeno-style), weighted by the
(Consequent)
normalized firing strength.
Sums all the weighted rule outputs to produce the final crisp
Layer 5: Output (Summation)
output of the system.

Hybrid Learning Algorithm in ANFIS


ANFIS is typically trained using a hybrid learning approach combining two methods, which makes
training faster and more stable than pure backpropagation alone:
20. Forward Pass: The consequent parameters (in Layer 4) are estimated using the Least Squares
Method, while the membership function (premise) parameters are kept fixed.
21. Backward Pass: The error is propagated backward, and the premise (membership function)
parameters are updated using gradient descent (similar to backpropagation), while the
consequent parameters are kept fixed.

Example: ANFIS for Predicting House Prices


Suppose we want to predict house price based on two inputs: size (sq. ft.) and location
rating.
ANFIS Rule 1: IF size is LARGE AND location is GOOD THEN price = 0.8×size +
1.2×location + 50000
ANFIS Rule 2: IF size is SMALL AND location is AVERAGE THEN price = 0.5×size +
0.6×location + 20000
Given training data (actual house sizes, locations, and sale prices), ANFIS automatically
tunes both the membership functions (what counts as “large” or “good”) and the linear
equation coefficients, gradually minimizing the prediction error — combining fuzzy rule
structure with neural-network-style learning.

Why ANFIS is Powerful


It doesn't require an expert to manually define exact membership functions or rule
parameters — these are learned automatically from data, while still keeping the interpretable
IF-THEN rule structure of fuzzy systems. ANFIS is widely used in forecasting, control
systems, and pattern recognition tasks.

5.4 Genetic Algorithm-based Fuzzy Systems (Fuzzy-GA Hybrid)


In this hybrid approach, Genetic Algorithms are used to optimize the components of a fuzzy system —
such as the shape/position of membership functions, or even the fuzzy rule base itself — since
manually designing the "perfect" fuzzy system can be difficult and time-consuming.

What GA Optimizes in a Fuzzy System


• Membership function parameters: e.g., the exact corner points of a triangular MF, optimized so
the fuzzy system performs better.
• Rule base: GA can search for the best combination of IF-THEN rules, removing redundant or
conflicting rules and discovering new useful ones.

Page 22 of 24
Soft Computing — Study Notes [Link]

• Number of rules / fuzzy sets: GA can help decide the optimal number of fuzzy sets/rules needed
— balancing accuracy and simplicity.

How it Works (Conceptual Steps)


22. Encode the fuzzy system's parameters (e.g., membership function points, or rule structure) as a
chromosome.
23. Define a fitness function based on how well the fuzzy system performs (e.g., low prediction
error, good control performance).
24. Apply standard GA operations (selection, crossover, mutation) across generations to evolve
better-performing fuzzy systems.
25. The best chromosome (after many generations) gives the optimized fuzzy system configuration.

Example: GA-Optimized Fuzzy Controller for a Robot


Suppose a fuzzy controller decides a robot's speed based on “distance to obstacle” (close,
medium, far). Initially, the membership function boundaries for “close”, “medium”, and “far”
are just rough guesses.
Each chromosome encodes a possible set of boundary values for these membership
functions.
The fitness function evaluates how smoothly and safely the robot navigates (e.g., fewer
collisions, smoother speed changes) using each chromosome's settings.
After running the GA for several generations, the boundaries evolve to values that make the
robot navigate much more safely and efficiently than the original hand-picked guesses.

5.5 Applications of Hybrid Systems


5.5.1 In Pattern Recognition
• Neuro-Fuzzy systems: used for handwriting/character recognition, where fuzzy rules handle
ambiguous/overlapping handwriting styles, while the neural component learns from large datasets
of handwriting samples.
• Face and fingerprint recognition: hybrid systems combine the feature-extraction power of
neural networks with fuzzy similarity measures to handle variations in lighting, angle, and image
quality.
• Speech recognition: fuzzy logic handles the natural variability/ambiguity in pronunciation, while
neural networks learn acoustic patterns from training data.

5.5.2 In Control Systems


• Industrial process control: ANFIS-based controllers regulate temperature, pressure, and
chemical mixing ratios in manufacturing plants, adapting automatically as process conditions
change.
• Automotive systems: hybrid fuzzy-neural controllers manage anti-lock braking systems (ABS),
automatic transmission shifting, and cruise control, balancing comfort, safety, and fuel efficiency.
• HVAC (heating/cooling) systems: smart climate control systems use neuro-fuzzy logic to
maintain comfortable temperatures while minimizing energy consumption.
• Robotics: GA-optimized fuzzy controllers help robots navigate, avoid obstacles, and adapt their
behavior to changing/unpredictable environments.
• Power systems: hybrid systems help in load forecasting and stabilizing power grids by predicting
demand fluctuations and adjusting supply accordingly.
Page 23 of 24
Soft Computing — Study Notes [Link]

Real-World Example: Washing Machine Control (Hybrid System)


A modern “fuzzy logic” washing machine uses fuzzy rules to decide wash time, water level,
and spin speed based on fuzzy inputs like “dirtiness level” and “load size” (sensed via
sensors).
A neuro-fuzzy enhancement allows the machine to learn from repeated use — for example,
gradually fine-tuning its fuzzy rules based on sensor feedback (like water turbidity sensors)
to optimize detergent usage and wash time over time, rather than relying purely on fixed,
hand-coded fuzzy rules.

Unit V – Quick Revision


Hybrid systems combine Fuzzy Logic + Neural Networks + Genetic Algorithms to overcome
each technique's individual weaknesses.
Neuro-Fuzzy systems use neural-network-style learning to automatically tune fuzzy
rules/membership functions.
ANFIS = Adaptive Neuro-Fuzzy Inference System; implements a Sugeno-type FIS using a 5-
layer trainable architecture and hybrid learning (least squares + gradient descent).
Fuzzy-GA hybrids use Genetic Algorithms to optimize membership functions or rule bases of
fuzzy systems, instead of relying on manual tuning.
Applications span pattern recognition (handwriting, face, speech) and control systems
(industrial, automotive, robotics, HVAC, power systems).

Page 24 of 24

You might also like