Author Topic: Neural Networks  (Read 2845 times)

0 Members and 1 Guest are viewing this topic.

Offline psygate

  • Completly Insane.
  • Atari ST
  • ***
  • Posts: 173
  • Karma: 7
  • That boy needs therapy.
    • View Profile
Neural Networks
« on: April 27, 2007 »
I need really help. As I know, you're very experienced programmers and I'm, I'm just not. ;)

Could someone help me and give me the source of a neural network solving the XOR Problem? (post if you need further information!)

THX
He who controlles the minds commands the many.
He who commands the many, conqueres the minds.

Offline Paul

  • Pentium
  • *****
  • Posts: 1490
  • Karma: 47
    • View Profile
Re: Neural Networks
« Reply #1 on: April 27, 2007 »
This probably doesn't help a shit but here anyway, if you get it to do something i would be very intested to know.
This one is by AntMan and contains no examples.
http://www.blitzbasic.com/codearcs/codearcs.php?code=1158
I will bite you - http://s5.bitefight.se/c.php?uid=31059
Challenge Trophies Won:

Offline psygate

  • Completly Insane.
  • Atari ST
  • ***
  • Posts: 173
  • Karma: 7
  • That boy needs therapy.
    • View Profile
Re: Neural Networks
« Reply #2 on: April 28, 2007 »
I managed to program a network which actually does what I want, but it doesn't learn. My XOR-Network just... tries every possbile configuration of weights and then pics the right one, actually, it's not more intelligent than a fucking normal program. :'( :-\

I'll jsut post it for fun,

Code: [Select]
'Simple "Neural Network" by psygate
'Solving the XOR-Problem, which can't be solved by a perceptron.
'At the moment... It's a very very stupid network and doesn't learn anything.
'
'Activation function is just a binary one. 0 or 1.
'Weights are chosen by random.
'2 input and 1 output neuron.

'Sorry for the shitty code!

randomize timer
option explicit

dim as integer a,b,c,d,t
const numofneuro=5

type neuron
    pot as double                                               'Activation potencial
    weight(numofneuro) as double                                'Weight of Synapses to other neurons
    threshold as integer                                        'Activation Threshold
end type

declare function process(a as ubyte,b as ubyte) as ubyte
dim shared as neuron n(numofneuro)

while t<>1
    for a=1 to numofneuro                                       'Initialize every neuron
        with n(a)
            .pot=0                                              'Set potencial to 0
            .threshold=.5                                       'Set an appropriate threshold
        end with
        for b=1 to numofneuro
                if b<>a then
                    n(a).weight(b)=(-1)^int(rnd*2)*int(rnd*3)   'Initialize synapses weight.
                else
                    n(a).weight(b)=0                            'Prohibits loops from neuron1 to neuron1
                end if
        next b
    next a
    if process(0,0)=0 and process(1,0)=1 and process(0,1)=1 and process(1,1)=0 _
    then t=1
wend

for a=1 to numofneuro
    for b=1 to numofneuro-1
        if b<>a then print n(a).weight(b)
    next
next
sleep

function process(a as ubyte,b as ubyte) as ubyte
    dim as integer l,m
    n(1).pot=a
    n(2).pot=b
    for l=1 to  numofneuro
        for m=1 to numofneuro
            n(m).pot+=n(l).weight(m)*n(l).pot
        next
    next
    return n(numofneuro).pot
end function

He who controlles the minds commands the many.
He who commands the many, conqueres the minds.

Offline ferris

  • Pentium
  • *****
  • Posts: 841
  • Karma: 84
    • View Profile
    • Youth Uprising Home
Re: Neural Networks
« Reply #3 on: May 04, 2007 »
I once bought a book called "AI for Game Developers" which had a huge section on it. I'd post about the subject, but I'm not at home.
http://iamferris.com/
http://youth-uprising.com/

Where the fun's at.
Challenge Trophies Won: