Artificial Neural Networks (ANNs)

CS 212, AI Programming 1

Table of Contents

[TOC]

Description

Neural Networks in the Brain

BrainNeuralNetworkAndNeuron

A biological neural network consists of interconnected neurons that communicate through axons, dendrites and synapses to process and transmit information. The dendrites are inputs to the neuron and the axon is the output of the neuron. The connection points are synapses. This intricate web of connections forms the basis for learning, memory, and thought in living organisms.

Perceptrons

A perceptron is modeled on a single neuron.

general-diagram-of-perceptron-for-supervised-learning_4

( ∑ is a the mathematical symbol for summation—aka addition.)

Mathematical Model

linear combination = intercept + weight1 × input1 + … + weight6 × input6 (where … is shorthand notation meaning that the sum includes all the terms from 1 to 6).

Activation Function

Once the linear combination has been calculated, the neuron takes the linear combination and sends it to an activation function. Typical examples of activation functions include:

Limitations of Perceptrons

Perceptrons seemed to some, like Rosenblatt, the developer of the perceptron (1957), to be the best way to advance the field of AI. But there were obstacles, which were publicized in detail by Minsky (who ironically developed the first neural network in 19511) and Pappert in their book Perceptrons (1969). These were two of the main obstacles:

Artificial Neural Networks

ART_Artificial_intelligence_Neural_network_explain

An artificial neural network (ANN) is a model with multiple interconnected “neurons”—in contrast to the perceptron that has just one artificial neuron. Each “neuron”, or node, has multiple inputs, but one output. The nodes are arranged in layers and each one is connected to all the others in the next layer. The input layer gets data to be processed, the middle, or hidden, layers do the processing and send data to an output layer (which could have more than one node).

Deep Learning

Techniques were developed to overcome some of the main the limitations identified by Minsky and Pappert.

Characteristics of ANNs

Discussion

Backpropagation

One of the main breakthroughs that led to progress on ANNs was the development of backpropagation in 1986 by Geoffrey Hinton, who is often referred to as the “godfather of AI”.

Backpropagation, short for “backward propagation of errors,” is an algorithm used to train ANNs by setting the weights on the connections.

Backpropagation in a Perceptron

Backpropagation is a method used set the weights and improve accuracy. This is a summary of the steps:

  1. Forward Pass: The perceptron processes training data to produce an output.
  2. Error Calculation: The output is compared to the actual target to find the error.
  3. Backward Pass: The error is used to adjust the weights, reducing the error.

This process repeats until the perceptron’s predictions become accurate.

Perceptron_work

Backpropagation in an ANN

Here is a simplified summary of the steps in the algorithm:

  1. Forward Propagation: Training data is passed through the network, from the input layer through the hidden layers to the output layer, to generate a prediction. This process is known as forward propagation.

  2. Compute Loss (error): The prediction is compared with the actual target value to compute the loss (error). The loss function quantifies how far off the predictions are from the actual target values.

  3. Backward Propagation: The loss is then propagated back through the network. This involves computing the gradient (slope) of the loss function with respect to the weights and biases in each layer of the network.

  4. Update Weights and Biases: The weights and biases of the network are updated in the opposite direction to the gradient (in the opposite direction of the error). This is done to minimize the loss. The size of the update is determined by the learning rate, a hyperparameter that controls how fast the network learns.

  5. Iterative Process: This process is repeated for many epochs (an epoch is one pass through the entire training dataset) until the network is adequately trained and the loss is minimized.

Reference

Articles and Tutorials

What is a Perceptron: A Beginners Guide for Perceptron—Mayank Banoula, SimpliLearn, 2023.

Deep Learning—Ian Goodfellow, Yoshua Bengio, Aaron Courville, MIT Press, 2016

Neural Networks and Deep Learning—Michael A. Nielsen, Determination Press, 2015

Interactive Web Pages

Tensorflow Playground—Tinker with a neural network in your browser.

Machine Learning Playground—Experiment with multiple ML models

Perceptron Visualizer

Perceptron Happy/Sad Face Classifier—Brian Bird

GPT-4 and GPT-4o were used to draft parts of these notes, July 2024.


Creative Commons License AI Programming 1 lecture notes by Brian Bird, written in 2024, revised in are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

  1. Marvin Minsky, in collaboration with Dean Edmonds, developed the first artificial neural network in 1951, known as the Stochastic Neural Analog Reinforcement Calculator (SNARC). It was not implemented in software and did not use a computer. Its 40 artificial neurons were built with mechanical and electronic components. It was about the size of a grand piano and included a plugboard for interconnecting the neurons. It was designed for a single task: to learn a path through a maze using Hebbian Learning. ↩