Artificial Intelligence Lecture Notes: Fundamentals of Artificial Neural Networks

Biological Inspiration and the Human Brain

  • Foundational Concept: Artificial Neural Networks (ANN) are computational models inspired by the neurological model of the human brain.

  • Brain vs. Computer (Von Neumann Machine):

    • Classical Computer: Follows the Von Neumann machine design (the basic design of modern computers).

    • Human Brain: Operates differently; it is highly complex, nonlinear, and capable of parallel computing.

    • Speed: The brain can be many times faster than a computer for specific tasks.

    • Rules and Experience: The brain has a structure that allows it to build its own rules based on experience.

  • Developmental Plasticity:

    • Dramatic development occurs within the first two years after birth.

    • Development continues throughout life.

    • Plasticity is defined as the ability of the brain to adapt to its environment.

Why Artificial Neural Networks are Necessary

  • Human Effortlessness vs. Computer Difficulty: Certain tasks are easy for humans but difficult for conventional paradigms using an algorithmic approach on a Von Neumann machine.

  • Typical Domains for ANN:

    • Pattern Recognition: Recognizing old friends or hand-written characters.

    • Content Addressable Recall: Accessing memories based on content.

    • Approximate and Common-sense Reasoning: Examples include driving, playing the piano, or being a baseball player.

  • Task Attributes: These tasks are often ill-defined, experience-based, and hard to express through strict logic.

Biological Neural Activity and Anatomy

  • Neuron Structure:

    • Body (Soma): The central part of the neuron.

    • Axon: The long thread-like part that conducts impulses away from the cell body.

    • Dendrites: Branched extensions that receive stimuli.

  • Neuron States: A neuron can be in one of two states: firing or at rest.

  • The Firing Principle: A neuron fires if the total incoming stimulus exceeds a specific threshold.

  • Synapse:

    • The thin gap between the axon of one neuron and the dendrite of another.

    • Facilitates signal exchange.

    • Possesses "synaptic strength" or efficiency, which changes during learning.

Mapping Biological Neurons to Artificial Neurons

  • Dendrites correspond to Input (x1,x2,...,xnx_1, x_2, ..., x_n).

  • Synapse corresponds to Weights (w1,w2,...,wnw_1, w_2, ..., w_n).

  • Soma corresponds to the Processing unit (Summation ∑\textstyle\sum and Activation).

  • Axon corresponds to the Output signal stage.

  • Terminal Branches of Axon correspond to the transmission of the output to the next neuron.

  • Operational Logic: Artificial neurons process information received in the form of "spikes" (signals).

Areas for Practical Application of Neural Networks

  • General Functional Areas:

    • Pattern association and classification.

    • Regularity detection and optimization problems.

    • Image processing and speech analysis.

    • Robot steering.

    • Processing inaccurate or incomplete inputs.

    • Stock market forecasting and simulation.

  • Sector-Specific Applications:

    • Marketing: Consumer spending pattern classification and sales forecasting.

    • Defense: Radar and sonar image classification; target tracking.

    • Agriculture and Fishing: Fruit and catch grading; crop yield forecasting.

    • Medicine: Ultrasound and electrocardiogram (ECG) classification; EEGs; medical diagnosis.

    • Finance: Signature and bank note verification; foreign exchange and stock market forecasting.

    • Security: Motion detection, surveillance image analysis, and fingerprint matching.

    • Engineering: Product inspection, monitoring, and control.

    • Meteorology: Weather prediction.

  • Noteworthy Examples:

    • Pattern Classifier: Distinguishing between digits (00 to 99), even when digits are corrupted by noise.

    • Face Detection: Neural network-based face detection (referenced to PAMI vol. 20(1), 1998).

Fundamentals of NN: The Learning Process

  • Learning by Adaptation: In biological systems, learning involves physical changes at the neural level.

    • Example: An animal learns that green fruits are sour while red/yellow ones are sweet, adapting its picking behavior accordingly.

  • Neural Mechanism: Biological learning occurs by changing synaptic strengths, eliminating old synapses, and building new ones.

  • Learning as Optimization: Biological organisms adapt responses to achieve a closer-to-optimal state (e.g., maximizing energy intake and happiness).

  • Energy Minimization in ANN:

    • In artificial systems, we use mathematical optimization to change synaptic weights.

    • Energy in this context is defined as a measure of task performance error.

Key Elements of ANN: Typical Architecture

  • Layered Arrangement: Neurons are organized into layers.

    • Layer 0 (Input Layer): Nodes serve as placeholders for environment inputs. No computation occurs here; the node function is the identity function.

    • Hidden Layer(s): Intermediate layers between input and output. They are "hidden" because they are not directly visible to the external environment. They extract higher-order statistics and features.

    • Output Layer: Produces the final result.

  • Network Architectures:

    • Single Layer Net: Contains one layer of connection weights. Signals flow forward (feed-forward) from inputs to outputs.

    • Multiple Layer Net: Contains one or more hidden layers. Successive hidden layers represent higher-level features based on previous layers.

    • Feed-Forward Networks: Signals flow strictly in one direction (input to output).

    • Recurrent Networks: Distinguished from feed-forward by having at least one feedback loop. These can exist with or without hidden units and often involve a Unit delay operator.

  • Mathematical Model of a Neuron:

    • The activation aa is calculated as:

    • a=f(∑piwi+b)a = f(\textstyle\sum p_i w_i + b)

    • Where pip_i are inputs, wiw_i are weights, and bb is the bias.

Key Elements of ANN: Weights and Bias

  • Weights (ww):

    • Initial weights are typically chosen randomly between −1.0-1.0 and 1.01.0 (or −0.5-0.5 to 0.50.5).

    • Fixed Networks: Weights do not change.

    • Adaptive Networks: Weights are updated to reduce error.

  • Bias (bb):

    • An "extra" neuron added to layers that always stores the value of 11.

    • It has no incoming connections and is not connected to previous layers.

    • Purpose: It allows the classifier to shift or translate the decision boundary left or right. Without it, a perceptron cannot learn the ideal decision boundary if it doesn't pass through the origin or require translation.

    • Positive Bias: Increases net input.

    • Negative Bias: Decreases net input.

Key Elements of ANN: Activation Functions

  • Purpose: Activation functions introduce nonlinearity. Without nonlinearity, multiple layers would be no more powerful than a single layer because a linear function of linear functions is always linear.

  • Types of Functions (Φ(.) or f\Phi(.)\text{ or } f):

    1. Step Function (Threshold Function):

      • ystep={1if X≥00if X<0y_{step} = \begin{cases} 1 & \text{if } X \geq 0 \\ 0 & \text{if } X < 0 \end{cases}

      • Mirrors biological firing (either fires or not).

    2. Sign Function:

      • ysign={+1if X≥0−1if X<0y_{sign} = \begin{cases} +1 & \text{if } X \geq 0 \\ -1 & \text{if } X < 0 \end{cases}

    3. Sigmoid Function:

      • Generally ranges between 00 and 11.

      • ysigmoid=11+e−Xy_{sigmoid} = \frac{1}{1 + e^{-X}}

      • Produces an 'S'-shaped curve and is differentiable.

      • Variation: Hyperbolic tangent function (−1-1 to 11 range).

    4. Linear Function:

      • ylinear=Xy_{linear} = X

    5. Piecewise-Linear Function:

      • Can take values of 00 or 11, but also values in between based on an amplification factor in the linear region.

Example Calculations and Weight Updating

  • Single Layer Calculation Example:

    • Given four inputs and weights resulting in a pre-activation output (RR) of 1414.

    • Resulting outputs:

      • Step: 11

      • Sign: +1+1

      • Sigmoid: 1.00001.0000

      • Linear: 1414

  • Multiple Layer Calculation (Sigmoid Example):

    • Input layer (X1,X2,X3X_1, X_2, X_3) processing weights to Hidden Layers.

    • Hidden layer output calculation: H1=11+e−FH_1 = \frac{1}{1 + e^{-F}} where F=W1X1+W2X2+W3X3F = W_1X_1 + W_2X_2 + W_3X_3.

    • Final output 03=11+e−(W7H1+W8H2)0_3 = \frac{1}{1 + e^{-(W_7H_1 + W_8H_2)}}.

  • Supervised Weight Updating Formula:

    • Wnew=Wold+α(desired output−actual output)×inputW_{new} = W_{old} + \alpha(\text{desired output} - \text{actual output}) \times \text{input}

    • α\alpha represents the learning rate.

    • Numerical Example (Slide 48):

      • Inputs: 1,0,11, 0, 1 with weights 0.5,0.2,0.80.5, 0.2, 0.8.

      • Sum: 1×0.5+0×0.2+1×0.8=1.31 \times 0.5 + 0 \times 0.2 + 1 \times 0.8 = 1.3.

      • Assume Threshold = 1.21.2. Output is calculated as 11 if sum >t> t, else 00.

      • Actual Output = 11. Desired Output = 00. α=1\alpha = 1.

      • W1new=0.5+1(0−1)×1=−0.5W_{1new} = 0.5 + 1(0 - 1) \times 1 = -0.5

      • W2new=0.2+1(0−1)×0=0.2W_{2new} = 0.2 + 1(0 - 1) \times 0 = 0.2

      • W3new=0.8+1(0−1)×1=−0.2W_{3new} = 0.8 + 1(0 - 1) \times 1 = -0.2

  • Discussion Case (Threshold with Bias):

    • Weights: HS = 11, MTM = 22. Threshold = 100100. Bias = −1-1.

    • ID2 Inputs (12,7512, 75): 12(1)+75(2)+(−1)=16112(1) + 75(2) + (-1) = 161.

    • Output is 11 because 161>100161 > 100.

    • Updated weights based on example: HS = −11-11, MTM = −73-73.

    • Re-calculation with new weights: 12(−11)+75(−73)+(−1)=−132−5475−1=−560812(-11) + 75(-73) + (-1) = -132 - 5475 - 1 = -5608.

    • Output is 00 because −5608<100-5608 < 100.