Building an unprofessional neural network

Joined
Sep 20, 2022
Messages
313
Reaction score
41
Personally I think neural networks are the second dumbest way to write a program, but on the other hand, I do like the simplicity of a perceptron.

Rather than pollute my mind with the statistical gooble-de-gook of training, I thought I would make a few networks manually, just for fun.

I was planning a NAND function, but that was too ambitious, so I'm working on NOT.

x goes in, NOT(x) comes out.

Using a "rectified linear unit" output function, I got it working with 2 inputs, 1 in the middle, and 1 output.

A version that uses the "sigmoid" output function is taking me a bit longer.
 
Joined
Sep 20, 2022
Messages
313
Reaction score
41
First attempt.
x = 0, output close to 1.
x = 1, output close to 0.
Code:
3 perceptrons using the sigmoid function

  -10    100
x ---( )---\
            \
             ( )--- not x
            /
1 ---( )---/
  100    -5
Ugly. Does anyone see a better way?
 
Joined
Sep 20, 2022
Messages
313
Reaction score
41
Oh no, NOT again.
I cheated and used a genetic algorithm to find suitable weights. Don't ask me what's happening with weight a. I got the GA idea from a book, I had no idea they could be used on NNs.
Code:
      a       c
    -----(P)-----
  /               \
x                  (R)---
  \   b       d   /
    -----(Q)-----

LAYER 0
 PERCEPTRON P
 a = -91160832560779.5
 PERCEPTRON Q
 b = 3.34041516534408
OUTPUT LAYER
 PERCEPTRON R
 c = 250.8517772713261
 d = -177.0801589214439
Still ugly.
 
Joined
Sep 20, 2022
Messages
313
Reaction score
41
Code:
     -a     3a
    ----(P)----
  /             \
x                (R)---
  \   a     -a  /
    ----(Q)----
a > 10 gets the job done
 
Joined
Apr 25, 2017
Messages
279
Reaction score
36
Oh no, NOT again.
I cheated and used a genetic algorithm to find suitable weights. Don't ask me what's happening with weight a. I got the GA idea from a book, I had no idea they could be used on NNs.
Code:
      a       c
    -----(P)-----
  /               \
x                  (R)---
  \   b       d   /
    -----(Q)-----

LAYER 0
 PERCEPTRON P
 a = -91160832560779.5
 PERCEPTRON Q
 b = 3.34041516534408
OUTPUT LAYER
 PERCEPTRON R
 c = 250.8517772713261
 d = -177.0801589214439
Still ugly.
which book?
 
Joined
Sep 20, 2022
Messages
313
Reaction score
41
I don't do adverts. The book only had 2 good ideas in it, I had to wade through 192 pages of waffle to find them. Not something I will recommend.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,460
Messages
2,571,764
Members
48,797
Latest member
PeterSimpson
Top