Neural Networks: Backpropagation & Unsupervised Learning (Self-Organizing NNs), Exercises of Artificial Intelligence

An overview of neural networks, focusing on the backpropagation algorithm for supervised learning and self-organizing neural networks for unsupervised learning. The backpropagation algorithm involves adjusting weights based on errors to minimize the overall system error. Self-organizing neural networks, on the other hand, group input data into clusters and map these clusters to outputs, useful for finding patterns in large datasets.

Typology: Exercises

2011/2012

Uploaded on 08/07/2012

ambu
ambu 🇮🇳

4

(12)

77 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Artificial Intelligence (CS607)
© Copyright Virtual University of Pakistan
4.3 Supervised
Given a set of example input/output pairs, find a rule that does a good job of
predicting the output associated with a new input.
4.3.1 Back propagation algorithm
1. Randomize the weights {ws} to small random values (both positive and
negative)
2. Select a training instance t, i.e.,
a. the vector {xk(t)}, i = 1,...,Ninp (a pair of input and output patterns),
from the training set
3. Apply the network input vector to network input
4. Calculate the network output vector {zk(t)}, k = 1,...,Nout
5. Calculate the errors for each of the outputs k , k=1,...,Nout, the difference
between the desired output and the network output
6. Calculate the necessary updates for weights -ws in a way that minimizes
this error
7. Adjust the weights of the network by - ws
8. Repeat steps for each instance (pair of input–output vectors) in the
training set until the error for the entire system
4.4 Unsupervised
Given a set of examples with no labeling, group them into sets called
clusters
A cluster represents some specific underlying patterns in the data
Useful for finding patterns in large data sets
Form clusters of input data
Map the clusters into outputs
Given a new example, find its cluster, and generate the associated output
4.4.1 Self-organizing neural networks: clustering, quantization,
function approximation, Kohonen maps
1. Each node's weights are initialized
2. A data input from training data (vector) is chosen at random and
presented to the cluster lattice
docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Neural Networks: Backpropagation & Unsupervised Learning (Self-Organizing NNs) and more Exercises Artificial Intelligence in PDF only on Docsity!

4.3 Supervised

Given a set of example input/output pairs, find a rule that does a good job of predicting the output associated with a new input.

4.3.1 Back propagation algorithm

  1. Randomize the weights {ws} to small random values (both positive and negative)
  2. Select a training instance t, i.e., a. the vector {xk(t)}, i = 1,...,Ninp (a pair of input and output patterns), from the training set
  3. Apply the network input vector to network input
  4. Calculate the network output vector {zk(t)}, k = 1,...,Nout
  5. Calculate the errors for each of the outputs k , k=1,...,Nout, the difference between the desired output and the network output
  6. Calculate the necessary updates for weights -ws in a way that minimizes this error
  7. Adjust the weights of the network by - ws
  8. Repeat steps for each instance (pair of input–output vectors) in the training set until the error for the entire system

4.4 Unsupervised

  • Given a set of examples with no labeling, group them into sets called clusters
  • A cluster represents some specific underlying patterns in the data
  • Useful for finding patterns in large data sets
  • Form clusters of input data
  • Map the clusters into outputs
  • Given a new example, find its cluster, and generate the associated output

4.4.1 Self-organizing neural networks: clustering, quantization,

function approximation, Kohonen maps

  1. Each node's weights are initialized
  2. A data input from training data (vector) is chosen at random and presented to the cluster lattice
  1. Every cluster centre is examined to calculate which weights are most like the input vector. The winning node is commonly known as the Best Matching Unit (BMU)
  2. The radius of the neighborhood of the BMU is now calculated. Any nodes found within this radius are deemed to be inside the BMU's neighborhood
  3. Each neighboring node's (the nodes found in step 4) weights are adjusted to make them more like the input vector. The closer a node is to the BMU, the more its weights get altered
  4. Repeat steps for N iterations

makeTrainData.m

trainData = zeros(21, 100); tempImage = zeros(10,10);

for i = 1: filename = strcat('alif', int2str(i),'.bmp'); tempImage = imread(filename); trainData(i,:) = reshape(tempImage,1,100); end

for i = 1: filename = strcat('bay', int2str(i),'.bmp'); tempImage = imread(filename); trainData(i+7,:) = reshape(tempImage,1,100); end

for i = 1: filename = strcat('jeem', int2str(i),'.bmp'); tempImage = imread(filename); trainData(i+14,:) = reshape(tempImage,1,100); end

targetData = zeros(21,3);

targetData(1:7,1) = 1; targetData(8:14,2) = 1; targetData(15:21,3) = 1;

save 'trainData' trainData targetData ;

makeTestData.m

testData = zeros(9, 100); tempImage = zeros(10,10);

for i = 1: filename = strcat('alif', int2str(i),'.bmp'); tempImage = imread(filename); testData(i,:) = reshape(tempImage,1,100); end

for i = 1: filename = strcat('bay', int2str(i),'.bmp'); tempImage = imread(filename); testData(i+3,:) = reshape(tempImage,1,100); end

for i = 1: filename = strcat('jeem', int2str(i),'.bmp'); tempImage = imread(filename); testData(i+6,:) = reshape(tempImage,1,100); end

targetData = zeros(9,3);

targetData(1:3,1) = 1; targetData(4:6,2) = 1; targetData(7:9,3) = 1;

save 'testData' testData targetData;