Marcel February 2016

Basics: How does a neural network work? (Decision)

first of all: I know that there are similar questions like this. But I wanna know the plain basics. Somehow I do miss something important.

Let's assume I Have some data (x,y) -> z where z can be 0 or 1 and x,y in [0,1]. Now I wanna train a neural network with that data and my desired output should be a boundary or a line or curved line in the x,y space where it splits the zeros from the ones (e.g. male/female or whatever).

So, I wanna have one hidden layer. I guess I somehow understand how to feed the network:

  1. feed it with X = (x,y) to the first layer
  2. Do some computation with weights and bias atc.
  3. Compute an Error or Loss function
  4. train the network with e.g. gradiant descent (i.e. updating the weights, etc)
  5. yeah, now comes my problem :D

What is the output in the end? With a given data set the network tries to reproduce my z values for given x,y, right? So, how do I get a Fit or decision boundary or whatever? What is the stuff that one "plots" in the end in the x,y space?

How do I generate "new data" by the network, or is that not possible?

So, my main question is: What is the output? And how do I handle the output? And what are the steps to get a logistic regression plot in the end (that can be found everywhere in the internet, but they do not say what they plot in the end :D)

I really do not get it:D Sorry^^.

Thanks in advance,

Marcel

Answers


Marcel February 2016

So, after a discussion with a friend (who was not around the last days) I finally think I got it.

After training I can just use the network as a function F(x,y) to make new predictions.

To find a decision boundary (the hyperplane in the X space) I can just solve F(x,y) = 1/2 for x(y) or vice versa and plot it. Then I am done:D

Cheers,

Marcel speaking to myself :D


Raj Samant February 2016

Let's consider an example of famous XOR problem


Training Data
X | Y | Z
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0

Now create a neural network, leat's assume MLN (2,4,1). Train it with your training data till convergence.

Now for the decision Boundary Plot.

Create Test Data

**x** [0 0.01 0.02 0.03 .... 1] (100x1)
**y** [0 0.01 0.02 0.03 .... 1] (100x1)

Then find z for each (x, y) pair, (0,0) (0.01,0) (0.02,0)...(0,0.01) (0,0.02), so z will be 100x100 matrix.

For XOR we know output space is 0 or 1. so we quantize z

if (z(x,y)>0.5)
     zq(x,y) = 1
else 
     zq(x,y) = 0

Now plot x,y,zq. which will give you a decision surface.

if you want decision boundary. check where ever z = 0.5 and mark that point. line created by all points will be decision boundary.

Post Status

Asked in February 2016
Viewed 2,071 times
Voted 9
Answered 2 times

Search




Leave an answer