neat-python icon indicating copy to clipboard operation
neat-python copied to clipboard

Question about multiparameter.py

Open evolvingfridge opened this issue 8 years ago • 9 comments
trafficstars

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 ?

evolvingfridge avatar Aug 28 '17 07:08 evolvingfridge

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.

drallensmith avatar Aug 28 '17 12:08 drallensmith

Thanks ! I am trying to make config that includes multiparameters and hyperneat :)

evolvingfridge avatar Aug 28 '17 12:08 evolvingfridge

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 ? :)

evolvingfridge avatar Sep 03 '17 21:09 evolvingfridge

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.)

drallensmith avatar Sep 03 '17 23:09 drallensmith

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 :)

evolvingfridge avatar Sep 04 '17 01:09 evolvingfridge

The 👍 is for the "really cool", of course...

drallensmith avatar Sep 04 '17 01:09 drallensmith

:-1: and for not being able to figure out how to run hyper.py :)

evolvingfridge avatar Sep 04 '17 01:09 evolvingfridge

I'm not sure if the hyper.py code is in a functional state yet, from what @bennr01 has written.

drallensmith avatar Sep 04 '17 02:09 drallensmith

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 :)

evolvingfridge avatar Sep 04 '17 02:09 evolvingfridge