Reputation: 1825
I am trying to understand how to create a basic, simple neural network in Python/Pygame. I have read this tutorial and my aim is to create a program similar to the program that is described in "AI junkie". Although this tutorial is pretty simple. I still don't fully get it, and I am not sure about the connection between the output of the neurons to the movement of the tanks. Where can I find a simple, basic code of a program like this written in pygame/python, to try improving my understanding of the implementation of the algorithm?
Thanking you in anticipation!
Upvotes: 3
Views: 4594
Reputation: 16114
Check @Nathan's Python code in this post. It's pretty clean and also good to take as a start point.
If you want logistic activation:
def logistic(x):
return 1/(1+math.exp(-x))
# derivative of logistic
def dlogistic(y):
return y*(1-y)
The default activation function is tanh
in the original code.
It's quite straightforward to construct a network and start training:
# create a network with 5 inputs, 20 hiddens, and one output nodes
n = NN(5, 20, 1)
Upvotes: 1