4

I want to have an artificial neural network:

  • 42 input neurons
  • 168 hidden neurons
  • 7 output neurons

This network is to play the game of "Connect Four". At the end of each game, the network gets feedback (game result / win?).

Learning should be done with Temporal Difference Learning.

My questions:

  • What values should be in my reward array?
  • And finally: How can I apply it to my game now?

Thank you so much in advance!

caw
  • 30,999
  • 61
  • 181
  • 291
  • 15
    What do you mean, "what's wrong"? You tell us. What's wrong with this? Does it not compile? Does it compile but it gives errors when you run it? Does it just not give the right output? It's a lot easier to help out with questions like this when you give us something to go on. – Mason Wheeler Jan 18 '11 at 23:15
  • 1
    It compiles fine in Delphi 2010! – IElite Jan 19 '11 at 00:33
  • 2
    @user89818, after answering Mason's question and fixing the bug found by Sertac: Start small, you can't test with 217 neurons total, decrease the number to something much, much smaller; Set up a nice Excel work sheet, run your program in the debugger and for each step update the Excel worksheet *by hand* and compare the values with what you see in Delphi. This will help spot any logic errors. – Cosmin Prund Jan 19 '11 at 10:08

4 Answers4

4

First hit is: you're assigning '0' to t in 'main', but your arrays' low-bound is '1', so you're accessing a non-existing element in the loops, hence the AV.

If you had enabled range-checking in compiler options, you'd be getting a range check error and you probably would have find the reason earlier.

BTW, since I have no idea what the code is doing, I wouldn't possibly notice any other errors at this time..

Sertac Akyuz
  • 54,131
  • 4
  • 102
  • 169
1

Other links that may be helpful for you:

http://delphimagic.blogspot.com.ar/2012/12/red-neuronal-backpropagation.html (Includes source code) Coding a Backpropagation neural network with two input neurons, two output and one hidden layer. The sample provides two sets of data that can train the network and see how accurate learning minimizing the error shown in a graph. Modifying the program can change the number of times the network trained with test data (epochs)

Carlos
  • 11
  • 1
1

If you're interested in using a third party library (free for non-commercial products, I've been very happy with some tools from this company http://www.mitov.com/html/intelligencelab.html (although I've never used their intelligence lab, just video tools.)

RobertFrank
  • 7,332
  • 11
  • 53
  • 99
1

Fast Artificial Neural Network (FANN) is a good open source library, its been optimised and used by a large community, with plenty of support and delphi bindings.

Using dependencies in this area is advised if you don't fully understand what your doing, the smallest detail can have a big impact on how a neural network performs; so best spend your time on your implementation of the network, then on anything else.

hiddensunset4
  • 5,825
  • 3
  • 39
  • 61