0% found this document useful (0 votes)
236 views50 pages

MLP as Universal Approximators in DL

This document discusses multi-layer perceptrons (MLPs) and their ability to act as universal approximators. It notes that MLPs can be used for classification, regression, and representing complex decision boundaries. MLPs are shown to be able to represent the XOR function and other complicated boundaries through the use of multiple layers and units. The document also discusses how MLPs can represent arbitrary Boolean functions and continuous-valued functions through their layered structure.

Uploaded by

Manju Prasad N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
236 views50 pages

MLP as Universal Approximators in DL

This document discusses multi-layer perceptrons (MLPs) and their ability to act as universal approximators. It notes that MLPs can be used for classification, regression, and representing complex decision boundaries. MLPs are shown to be able to represent the XOR function and other complicated boundaries through the use of multiple layers and units. The document also discusses how MLPs can represent arbitrary Boolean functions and continuous-valued functions through their layered structure.

Uploaded by

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

D EEP N EURAL N ETWORKS

M ODULE # 1 : MLP AS U NIVERSAL


A PPROXIMATORS

DL Team, BITS Pilani


The author of this deck, Prof. Seetha Parameswaran,
is gratefully acknowledging the authors
who made their course materials freely available online.

Deep Learning 2 / 50
Table of Contents

1 Multi Layer Perceptron (MLP)

Deep Learning 3 / 50
Power of MLP

MLP can be used for


classification
I binary
I multiclass
regression
I real output
representing complex decision boundaries
representing boolean functions
MLP is called as Universal Approximator for the above reasons.

Deep Learning 4 / 50
MLP for XOR gate

1
x1 n1 1
1 1
-1 1 n3 2 x1 xor x2

-1
x2 n2 -1

Input Layer Hidden Layer Output Layer

Deep Learning 5 / 50
Perceptron with real inputs
x1 , . . . , xN are real valued.
W1 , . . . , WN are real valued.
Unit ”fires” if weighted input exceeds a threshold.
( P
1 if i wi xi ≥ T
ŷ =
0 otherwise

Deep Learning 6 / 50
Perceptron with real outputs
x1 , . . . , xN are real valued.
W1 , . . . , WN are real valued.
The output can also be real valued. – Sometimes viewed as the ”probability” of
firing.

Deep Learning 7 / 50
MLP for Complicated Decision Boundaries
Build a network of units with a single output that fires if the input is in the
coloured area.

Deep Learning 8 / 50
MLP for Complicated Decision Boundaries

The network must fire if the input is in the coloured area.

x1 x2

Deep Learning 9 / 50
MLP for Complicated Decision Boundaries

The network must fire if the input is in the coloured area.

x1 x2

Deep Learning 10 / 50
MLP for Complicated Decision Boundaries

The network must fire if the input is in the coloured area.

x1 x2

Deep Learning 11 / 50
MLP for Complicated Decision Boundaries

The network must fire if the input is in the coloured area.

x1 x2

Deep Learning 12 / 50
MLP for Complicated Decision Boundaries

The network must fire if the input is in the coloured area.

x1 x2

Deep Learning 13 / 50
MLP for Complicated Decision Boundaries

The network must fire if the input is in the coloured area.

Deep Learning 14 / 50
MLP for Complicated Decision Boundaries
P
i hi ≥ 5?

AND

h1 h2 h3 h4 h5

x1 x2

Deep Learning 15 / 50
MLP for Complicated Decision Boundaries
Network to fire if the input is in the yellow area.
I ”OR” two polygons
I A third layer is required

Deep Learning 16 / 50
MLPs for Complex Decision Boundaries
MLPs can compose arbitrarily complex decision boundaries with only one
hidden layer.

Deep Learning 17 / 50
MLPs for Arbitrary Classification Boundary
Just fit in an arbitrary number of circles
I More accurate approximation with greater number of smaller circles.
I Can achieve arbitrary precision
MLPs can capture any classification boundary.
Deeper networks can require far fewer neurons.

Deep Learning 18 / 50
MLP as Continuous-Valued Regression
A simple 3-unit MLP with a ”summing” output unit can generate a ”square
pulse” over an input.
I Output is 1 only if the input lies between T1 and T2.
I T1 and T2 can be arbitrarily specified

Deep Learning 19 / 50
MLP as Continuous-Valued Regression
A simple 3-unit MLP with a ”summing” output unit can generate a ”square
pulse” over an input.
An MLP with many units can model an arbitrary function over an input.
This generalizes to functions of any number of inputs.

Deep Learning 20 / 50
MLPs are Universal Boolean Functions
MLPs can compute more complex Boolean functions.
MLPs can compute any Boolean function; since they can emulate individual
gates.

Deep Learning 21 / 50
How many layers for a Boolean MLP?

Express any Boolean function in disjunctive normal form.

Deep Learning 22 / 50
How many layers for a Boolean MLP?

Express any Boolean function in disjunctive normal form.

Deep Learning 23 / 50
How many layers for a Boolean MLP?

Express any Boolean function in disjunctive normal form.

Deep Learning 24 / 50
How many layers for a Boolean MLP?

Express any Boolean function in disjunctive normal form.

Deep Learning 25 / 50
How many layers for a Boolean MLP?
Express any Boolean function in disjunctive normal form.

Deep Learning 26 / 50
How many layers for a Boolean MLP?
Express any Boolean function in disjunctive normal form.

Deep Learning 27 / 50
How many layers for a Boolean MLP?
Express any Boolean function in disjunctive normal form.

Deep Learning 28 / 50
How many layers for a Boolean MLP?

Express any Boolean function in disjunctive normal form.

Deep Learning 29 / 50
How many layers for a Boolean MLP?
Express any Boolean function in disjunctive normal form.

Any truth table can be expressed in this manner.


A one-hidden-layer MLP is a Universal Boolean Function.
Deep Learning 30 / 50
Reducing a Boolean Function

Deep Learning 31 / 50
Reducing a Boolean Function
Use K-map to reduce the DNF to find groups and express as reduced DNF.

Deep Learning 32 / 50
Reducing a Boolean Function
Use K-map to reduce the DNF to find groups and express as reduced DNF.

Deep Learning 33 / 50
Largest Irreducible DNF?
What arrangement of ones and zeros simply cannot be reduced further?

How many neurons in a DNF (one-hidden-layer) MLP for this Boolean


function?
Deep Learning 34 / 50
Width of a Single-Layer Boolean MLP
How many neurons in a DNF (one-hidden-layer) MLP for this Boolean function
of 6 variables?

Deep Learning 35 / 50
Width of a Single-Layer Boolean MLP

In general, XOR of N variables will require 2N −1 perceptrons in single hidden


layer. Exponential in N
Deep Learning 36 / 50
Width of a Single-Layer Boolean MLP

In general, XOR of N variables will require 2N −1 perceptrons in single hidden


layer.
How many units if we use multiple layers?
Deep Learning 37 / 50
Width of a Deep Boolean MLP
An XOR needs 3 perceptrons.

This network will require 3x3 = 9 perceptrons.


Deep Learning 38 / 50
Width of a Deep Boolean MLP

This network will require 3x5 = 9 perceptrons.


In general, the XOR of N variables will require 3(N − 1) perceptrons.
Deep Learning 39 / 50
Width of a Deep Boolean MLP

Single hidden layer: Will require 2N −1 + 1 perceptrons in all (including output


unit). Exponential in N.
Deep network: Will require 3(N − 1) perceptrons in a deep network. Linear in
N.
This can be arranged in only 2log2 (N ) layers.
Deep Learning 40 / 50
Summary of MLP
MLPs are connectionist computational models,
I Individual perceptrons are computational equivalent of neurons.
I The MLP is a layered composition of many perceptrons.
MLP can model universal Boolean functions
I Individual perceptrons can act as Boolean gates.
I Networks of perceptrons are Boolean functions.
MLPs are Boolean machines.
I They represent Boolean functions over linear boundaries.
I They can represent arbitrary decision boundaries.
I They can be used to classify data.
MLP can model continuous valued functions.
MLPs as universal classifiers.
MLPs as universal approximators.
Deep Learning 41 / 50
Exercise

Deep Learning 42 / 50
Exercise

Deep Learning 43 / 50
Exercise - Solution

Deep Learning 44 / 50
Exercise

An XOR cannot be represented using a single perceptron. If this statement is true,


demonstrate the alternative way to represent XOR using an ANN.

Deep Learning 45 / 50
Exercise - Solution
An XOR cannot be represented using a single perceptron as the XOR has non-linear
decision boundary. To represent non-linear decision boundary we need a multi-layer
perceptron with one hidden layers.

+1 +1 ak = sign(wk1 x1 + wk 2 x2 + b)
-10
-30

20 20 x1 x2 a1 a2 y
x1 a1 y
20 20 0 0 -10 ∼ 0 20 ∼ 1 -10 ∼ 0
20 -15
0 1 10 ∼ 1 5∼1 10 ∼ 1
-15
x2 a2 1 0 10 ∼ 1 5∼1 10 ∼ 1
1 1 30 ∼ 1 -30 ∼ 0 -10 ∼ 0

Deep Learning 46 / 50
Exercise

How many perceptrons are required to represent W ⊕ X ⊕ Y ⊕ Z ?

Deep Learning 47 / 50
Exercise - Solution
An XOR cannot be represented using a single perceptron as the XOR has non-linear
decision boundary. To represent non-linear decision boundary we need a multi-layer
perceptron with one hidden layers.
Traditional method:
I Number of variables n = 4
I Number of perceptrons = 2n − 1 = 24 − 1 = 15
Alternate method:
I Layer 1: A = W ⊕ X

I Layer 2: B = Y ⊕ Z

I Layer 3: C = A ⊕ B

I Number of perceptrons = 3(n − 1) = 3 ∗ (4 − 1) = 9


I Number of layers = Width = 2 log2 n = 2 log2 4 = 4

Deep Learning 48 / 50
Exercise - Solution
W a1

a3

X a2 a7

a9

Y a4 a8

a6

Z a5
Deep Learning 49 / 50
Further Reading

1 Dive into Deep Learning (T1)

2 http:
//mlsp.cs.cmu.edu/people/rsingh/docs/Chapter1_Introduction.pdf
3 http://mlsp.cs.cmu.edu/people/rsingh/docs/Chapter2_
UniversalApproximators.pdf

Deep Learning 50 / 50

You might also like