Skip to content
Snippets Groups Projects
Commit 1fed30af authored by Philip Maas's avatar Philip Maas
Browse files

Bugfixing figures

parent 5c8c32e4
No related branches found
No related tags found
1 merge request!2Evo neuro
......@@ -4,17 +4,17 @@ import matplotlib.pyplot as plt
import pickle
import sys
HIDDEN_LAYER = 12
HIDDEN_LAYER = 8
BIAS = True
POP_SIZE = 50
MUTATION_FACTOR = 0.1 # 0 <= x <= 1
LEARNING_RATE = 0.03 # 0 <= x <= 1
GENS = 3000
MAX_STEPS = 1200 # after 1600 steps the Environment gives us a done anyway.
GENS = 7000
MAX_STEPS = 300 # after 1600 steps the Environment gives us a done anyway.
VERSION = 3
TEST_WALKER = False
VERSION = 1
TEST_WALKER = True
LOAD_BRAIN = False
RENDER_BEST = False
if TEST_WALKER:
......@@ -27,6 +27,7 @@ def plot_reward(rewards):
plt.plot(rewards)
plt.savefig(f'./models/{HIDDEN_LAYER}_{VERSION}_{POP_SIZE}_{LEARNING_RATE}.png')
plt.show()
plt.cla()
if __name__ == '__main__':
avg_rewards = []
......@@ -61,6 +62,8 @@ if __name__ == '__main__':
pickle.dump(avg_rewards, fp)
if gen == 1000:
population.lr = 0.01
#if gen == 5000:
#population.lr = 0.005
plot_reward(avg_rewards)
except KeyboardInterrupt:
......
......@@ -89,6 +89,7 @@ class NeuralNetwork():
layer.draw()
pyplot.axis('scaled')
pyplot.savefig(f'./models/mlp_{gen}.png', dpi=300)
pyplot.cla()
#pyplot.show()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment