Skip to content

Commit

Permalink
chore: change testing code
Browse files Browse the repository at this point in the history
  • Loading branch information
suhdonghwi committed Aug 22, 2021
1 parent 8247751 commit 3004547
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Binary file modified .DS_Store
Binary file not shown.
18 changes: 14 additions & 4 deletions analysis/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def plot_succ_gens(cases, fitness_threshold):
break

print("Success : " + str(len(succ_gens)))
print("Mean : " + str(sum(succ_gens) / len(succ_gens)))
sns.histplot(succ_gens, kde=True)


Expand All @@ -94,24 +95,33 @@ def plot_size(cases, fitness_threshold):
sns.countplot(x=sizes)


case1 = split_cases("./analysis/output.txt")
fitness_threshold = 3.95
cases = [(case1, "")]
case1 = split_cases("./analysis/output-yes.txt")
case2 = split_cases("./analysis/output-no.txt")
fitness_threshold = 3.9

for case, _ in cases:
cases = [
(case1, "With destructive mutation"),
(case2, "Without destructive mutation"),
]

for case, label in cases:
plot_fitness_max(case)

plt.title(label)
plt.show()


for case, label in cases:
plot_succ_gens(case, fitness_threshold)

plt.title(label)
plt.xlabel("Generation")
plt.show()


for case, label in cases:
plot_size(case, fitness_threshold)

plt.title(label)
plt.xlabel("Size")
plt.show()
6 changes: 3 additions & 3 deletions params/xor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ output_activation = 'Sigmoid'
weight_perturbation = 0.8
weight_assign = 0.1
add_connection = 0.5
remove_connection = 0.5
remove_connection = 0.0
toggle_connection = 0.0
add_node = 0.2
remove_node = 0.2
remove_node = 0.0

weight_min = -10.0
weight_max = 10.0
Expand All @@ -29,4 +29,4 @@ elitism = 5
survival_rate = 0.1

[reproduction]
crossover_rate = 0.3
crossover_rate = 0.3

0 comments on commit 3004547

Please sign in to comment.