ukuleleplayer / pureples

Pure Python Library for ES-HyperNEAT. Contains implementations of HyperNEAT and ES-HyperNEAT.
MIT License
114 stars 36 forks source link

Line 169 in es_hyperneat.py is different from the algorithm in the original paper #16

Closed yamatakeru closed 3 years ago

yamatakeru commented 3 years ago

Hi,

The following part seems to be different from the algorithm in https://eplex.cs.ucf.edu/papers/risi_alife12.pdf.

160 | for i in range(self.iteration_level):  # Explore from hidden.
161 |     for x, y in unexplored_hidden_nodes:
162 |         root = self.division_initialization((x, y), True)
163 |         self.pruning_extraction((x, y), root, True)
164 |         connections2 = connections2.union(self.connections)
165 |         for c in connections2:
166 |             hidden_nodes.add((c.x2, c.y2))
167 |         self.connections = set()
168 | 
169 | unexplored_hidden_nodes -= hidden_nodes

According to pseudocode on page 47, line 169 should be indented once again. Also, unexplored_hidden_nodes will always be the empty set if we remove hidden_nodes from unexplored_hidden_nodes (because hidden_nodes is always greater than unexplored_hidden_nodes). I think it needs to be corrected as follows.

160 | for i in range(self.iteration_level):  # Explore from hidden.
161 |     for x, y in unexplored_hidden_nodes:
162 |         root = self.division_initialization((x, y), True)
163 |         self.pruning_extraction((x, y), root, True)
164 |         connections2 = connections2.union(self.connections)
165 |         for c in connections2:
166 |             hidden_nodes.add((c.x2, c.y2))
167 |         self.connections = set()
168 | 
169 - unexplored_hidden_nodes -= hidden_nodes
    +     unexplored_hidden_nodes = hidden_nodes - unexplored_hidden_nodes
ukuleleplayer commented 3 years ago

Whoa, that was quite the find. Have you tried this solution? I'm just amazed it worked as well as it did without this tweak actually working. If you have tried it and it's working, could you create this as a PR? I'll merge it right away.

yamatakeru commented 3 years ago

I tried this solution and confirmed the emergence of a more complex network by increasing iteration_level. Thus, I have just created a PR.

P. S. This solution is correct, but the emergence of a more complex network by increasing iteration_level was probably due to stochastic fluctuations. In fact, a network's complexity increased only very slightly in the case of many of tasks or parameter settings. I think this result corresponds to the following description in http://eplex.cs.ucf.edu/ESHyperNEAT/.

For most tasks the following default settings can remain unchanged:

Bandpruning threshold = 0.3 Initial resolution = 8x8 (corresponds to a quadtree depth of 4) Variance treshold = 0.03 Division threshold = 0.03 Iteration level = 1

ukuleleplayer commented 3 years ago

Thanks for creating the PR - it’s merged now. Great find!