Learning From Data – A Short Course: Problem 7.1

Page 43

Implement the decision function below using a 3-layer perceptron.
2016-10-05_233047

First I’ll construct a rectangle like this:

untitled-1

It’s easy to see how: Consider the four lines x = -2, x = 2, y = -1, y = 2 and what we want is the hypothesis  h_{1}(x) = \text{AND}(\text{sign}(x+2), \text{sign}(-x+2), \text{sign}(y+1), \text{sign}(-y+2)).

The corresponding MLP:

untitled-2

Next I’ll try to construct a cooler shape:

untitled-1

Now consider the three lines x = -1, x = 1 and y = 1 and we want h_{2}(x) = \text{OR}(\text{AND}(\text{sign}(x+1), \text{sign}(-x+1)), \text{sign}(-y+1))). It looks like what’s left is to combine h_{1}(x) and h_{2}(x) into g(x) = \text{AND}(h_{1}(x), h_{2}(x)), however in such case the the number of layers we used is 4, which exceeds 3. I think we can simplify h_{2}(x) a little bit:

    \[ h_{2}(x) = \text{sign}(\text{sign}(x+1) + \text{sign}(-x+1) + 2\times\text{sign}(-y+1)+0.5) \]

So the 3-layer perceptron in question is:

 g(x) = \text{AND}(h_{1}(x), h_{2}(x)) = \text{sign}(h_{1}(x) + h_{2}(x) - 1.5) = \text{sign}(\text{sign}(\text{sign}(x+2) + \text{sign}(-x+2) + \text{sign}(y+1) + \text{sign}(-y+2) - 3.5) +  \text{sign}(\text{sign}(x+1) + \text{sign}(-x+1) + 2\times\text{sign}(-y+1)+0.5) - 1.5)

 

 


Facebooktwitterredditpinterestlinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *