Jump to content

Neural network from first principles - 3


Recommended Posts

  • Moderators

So setting up a neural network like this, in the end it all works out quite well.

 

Training the network on the non-trivial question 'is it a bird, is it a plane ?' and training it on the following 2 examples :

beak = 0, engine =1    :  plane

beak = 1, engine = 0   :  bird

 

just takes a second or so and fewer than 10000 iterations to reduce the error to less than 0.000x

 

Increasing the nr of neurons in the hidden layers decreases the nr of iterations

Interestingly once in a while the network is unable to converge and comes up with 0.5 as the answer, equivalent to 'I don't know' on a network with 1 output neuron or 'either/or' on a 2-neuron output network

 

If anyone is interested, the project source can be found here

Note this is proof-of-concept code only, not a professional neural network component

Link to post
Share on other sites
  • 4 weeks later...
  • Moderators

Cleaning up the code somewhat it works actually better than anticipated.

 

As an example I used the iris-dataset (https://archive.ics.uci.edu/ml/datasets/Iris)

Sir Ronald Fisher (1936) collected this data set which contains 3 classes of 50 instances each, where each class refers to a type of iris plant.  
One class is linearly separable from the other 2; the latter are NOT linearly separable from each other.
 
The dataset has 150 rows (50 in each of three classes) and each row has 4 input attributes and 1 output :
Input attributes
   1. sepal length in cm
   2. sepal width in cm
   3. petal length in cm
   4. petal width in cm
 
sepal refers to the outermost petals of the iris flower and petals refer to the innermost petals.
 
Output attribute Iris flower class: 
      -- Iris Setosa
      -- Iris Versicolour
      -- Iris Virginica
 
Code for this experiment can be found here
 
I also did some experiments to push some code execution to the gpu rather than the cpu using the gpu.js library
Interesting way of doing that. On my macbook it looks like that results in a 2.5 times accellaration
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...