Closed SilverDash closed 2 years ago
Thanks for opening this issue - I’ve a lot of stuff to do at the moment, but I’ll dig into this when I eventually get the time.
Thank you. I want to add that other agents resulted in the same error
Hi. I can confirm this issue. It happens in all environments
Hello. As mentioned by the ticket's author, the issue still persists. For instance, I'm trying to create a phenotype with 130 inputs and the exception that it arises is the following:
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/USER/miniconda3/envs/HyperNEAT-conda/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "trainingBehavior.py", line 88, in eval_genome
net = create_phenotype_network(cppn, sub)
File "/home/USER/miniconda3/envs/HyperNEAT-conda/lib/python3.8/site-packages/pureples-0.0-py3.8.egg/pureples/hyperneat/hyperneat.py", line 29, in create_phenotype_network
im = find_neurons(cppn, oc, layer, hidden_nodes[idx], False)
File "/home/USER/miniconda3/envs/HyperNEAT-conda/lib/python3.8/site-packages/pureples-0.0-py3.8.egg/pureples/hyperneat/hyperneat.py", line 68, in find_neurons
w = query_cppn(coord, node, outgoing, cppn, max_weight)
File "/home/USER/miniconda3/envs/HyperNEAT-conda/lib/python3.8/site-packages/pureples-0.0-py3.8.egg/pureples/hyperneat/hyperneat.py", line 84, in query_cppn
w = cppn.activate(i)[0]
File "/home/USER/miniconda3/envs/HyperNEAT-conda/lib/python3.8/site-packages/neat_python-0.92-py3.8.egg/neat/nn/feed_forward.py", line 13, in activate
raise RuntimeError("Expected {0:n} inputs, got {1:n}".format(len(self.input_nodes), len(inputs)))
RuntimeError: Expected 130 inputs, got 5
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "trainingBehavior.py", line 152, in <module>
winner = run(300)[0]
File "trainingBehavior.py", line 143, in run
winner = pop.run(pe.evaluate, 150)
File "/home/USER/miniconda3/envs/HyperNEAT-conda/lib/python3.8/site-packages/neat_python-0.92-py3.8.egg/neat/population.py", line 88, in run
File "/home/USER/miniconda3/envs/HyperNEAT-conda/lib/python3.8/site-packages/neat_python-0.92-py3.8.egg/neat/parallel.py", line 31, in evaluate
File "/home/USER/miniconda3/envs/HyperNEAT-conda/lib/python3.8/multiprocessing/pool.py", line 771, in get
raise self._value
RuntimeError: Expected 130 inputs, got 5
Hi. I'm facing the same issue as listed above.
So the problem seems to be in is the ESNetwork
class.
First, I've created an ESNetwork
object from pureples.es_hyperneat.es_hyperneat
and called the function self.create_phenotype_network()
which called self.es_hyperneat()
.
The thing is that self.es_hyperneat()
then calls two functions: self.division_initialization()
and self.pruning_extraction()
and both functions call query_cppn()
from pureples.hyperneat.hyperneat
which calls .activate()
from the neat-python package.
And this last function expects a list with one value for each input node, but query_cppn()
always feeds 4 coordinates + 1 (directly from code: [coord1[0], coord1[1], coord2[0], coord2[1], 1.0]
).
Could it be the case that it's hardcoded for only 5 inputs?
Hi all, Could any of you above provide me with a minimal "working" example with config file and an experiment specification with input/output, fitness function etc.? Then I'll have a look ASAP.
@aacoimbra: What you describe with the query_cppn()
is at least on purpose; this function should query the CPPN from one point to another, hence coord1
to coord2
in the code.
@ukuleleplayer Thanks for the reply. Here is a quick minimal example raising the following error: RuntimeError: Expected 20 inputs, got 5
.
This behavior could very well be a misusage of the library.
@aacoimbra: Your example is working for me, if I use the config_cppn_xor
provided. Try to get the latest code, put your training.py
inside the experiments/xor folder. Change the path of the config to point to the existing CPPN config.
The input stuff seems to be mismatch between the number of input coordinates and the number of input values. Try to hardcode it first to something you know - like 20 input coordinates and 20 input values (while keeping output coordinates and values to 1). If this doesn't take you further than your described error with input, then please provide one more example 👍
I just played around with XOR, trying to add 10 input parameters and 10 input values and that worked (even though XOR doesn't make sense with 10 values...).
Thank you @ukuleleplayer, I was mixing some concepts.
For those who face this problem:
NEAT-Python
configuration file must be set to 5 inputs[(-1.0, -1.0), (0.0, -1.0), (1.0, -1.0)]
will set the network to receive 3 inputs at theses specific coordinates.If you are uncertain about placing your input nodes here's a quick tip from this link:
Why do I still have to decide on the placement of Input and Output nodes? While ES-HyperNEAT frees the user from deciding on the position of the hidden nodes, placing the inputs and outputs allows the user to insert knowledge about the problem geometry into the evolutionary search, which is invisible to traditional encodings. For example, the sensors of an autonomous robot can be placed from left to right on the substrate in the same order that they exist on the robot. Outputs for moving left or right can also be placed in the same order, allowing ES-HyperNEAT to understand from the outset the correlation of sensors to effectors. Therefore, allowing to user to inject such knowledge from the start is a potential advantage.
Hello, Sorry to add to a closed issue but I have a question regarding this problem. I am using the XOR template for a problem with around 150 inputs, but with the config file inputs set at 5 the output cppn only has 5 inputs. I would like to see the cppn with my inputs, is this possible?
@ASJB - hey! Not sure exactly what you mean. Try to have a look at the examples, some nets are drawn there in the bottom of the files. Also, have a look at the visualize.py which contains various drawing magic. It should be able to draw your CPPN. So.. save your CPPN after running your experiment and then feed it to some visualisation.
I ran this through the Debugger and found that at some point some random float values replace the existing number of inputs that initially gets set.
I could even see that at some point during execution the correct number of inputs was actually used.
I've been fighting to find the cause and I've come to the conclusion that something has to be wrong in the module.
for some context, I took one of the examples and attempted to configure it to run a gym retro env.
As you can see though the only thing stopping me is the inputs being messed up somehow.
If you need more information please let me know.