neat-python
neat-python copied to clipboard
Question about multiparameter.py
As I understand it allows to replace default function with one of specified functions in config file by user, to evolve at same time activation and aggregation functions for each genome or only activation or only aggregation. - correct ?
Yes - one or more specified functions for activation, aggregation, or both. Check out examples/picture2d/novelty_config and evolve_novelty.v2.py for an example using, potentially, lots for a CPPN.
Thanks ! I am trying to make config that includes multiparameters and hyperneat :)
multiparam_func not only updates function, but also updates function parameters - correct ?
Function are not combined in any way like func(func()), this is job of CPPN - correct ?
I have XOR example with multiparam_func can I do PR request ? :)
Regarding the first, multiparam functions are treated as a type of attribute - FuncAttribute in attributes.py, which is used instead of StringAttribute. It can do either regular non-multiparameter functions or multiparameter functions. If it's asked to initialize or mutate the function attribute, it first decides on what function is in use, then - if it's multiparameter - calls the init_value or mutate_value method (in multiparameter.py's EvolvedMultiParameterFunction class), which in turn calls the appropriate init_value or mutate_value for each of the function's parameters. (If a function is not currently in use, its parameters are not mutated. I'm not sure whether this is a bug or a feature. One thing I'm currently working on is having multiparameter functions share some parameters, but have only gotten as far as figuring out what parameters should be shared of the various multiparameter activation, and some multiparameter aggregation, functions.)
Regarding the second, correct; it is not done automatically. (I have created some non-multiparameter functions that call other functions, such as producing a square wave via step_activation(sin_activation()) - that was to make sure it had the same phase, so that they could be merged in wave_activation. Some of the multiparameter functions fuse together (weighted average) other activation/aggregation functions to enable smoothly going between them as well as abrupt jumps.)
Are you meaning an XOR example of a multiparameter-using CPPN for HyperNEAT, creating a network that solves XOR? I'd be very happy with such, although I would need to make sure to fully merge in @bennr01's hyper.py work to make sure the CPPN-to-NEAT would work right.
In terms of having a multiparameter NEAT network solving XOR, that's actually very easy - just plug in multiparameter functions in the config file in place of, or as well as, existing activation/aggregation functions. (XOR can be solved in 1 generation by any of the multiparameter functions that can do either abs or hat, like multiparam_relu and hat_gauss_rectangular. Take a look at the test_xor_example.py file in multiparam_funcs' tests directory; other than just checking to be sure it does work with multiparam_relu without saving, I had to avoid using any of those for testing saving and restoring with multiparameter functions.)
I admittedly have yet to update the examples/xor* directory; I'd also be happy to merge a PR that updated that or various of the other examples I haven't gotten to yet. (Multiparameter functions work wonders, in my biased opinion of course, in the pictures2d CPPNs. I'm currently looking at the lander code - I may use it for some testing of what adjustments work well together.)
Unfortunately, I could not make hyper.py work (probably had to spend more time), but I hit some weird errors first I was thinking I am doing something wrong, but now realized I am missing something very important. I was thinking just adding xor-feedforword-multiparam.py simple example, it does actually requires only modifying config-file that it is really cool :)
The 👍 is for the "really cool", of course...
:-1: and for not being able to figure out how to run hyper.py :)
I'm not sure if the hyper.py code is in a functional state yet, from what @bennr01 has written.
I am still trying just to initialize it (last comment), just to be up to speed with @benrr01 code, otherwise will be harder in future to figure out where what is and how it works, also have better chance to code something useful :)