neuroevolution-ai / NeuroEvolution-CTRNN_new

MIT License
3 stars 3 forks source link

refactored calculation of individual sizes #58

Closed bjuergens closed 3 years ago

bjuergens commented 3 years ago

adds a info-message to the begging of the experiments, which tells the user how the free parameters are used in a brain.

example (last line):

INFO: Input space: Box(-inf, inf, (8,), float32)
INFO: Output space: Discrete(4)
INFO: Individual size for this experiment: 242
INFO: V: 90, W: 100, T: 40, optimize_y0: 10, optimize_state_boundaries: 2, 

For LNN it looks like this

INFO: Individual size for this experiment: 160
INFO: layer0: 64, layer1: 48, layer2: 48, 

For CNN+CTRNN it looks like this

INFO: Individual size for this experiment: 2337
INFO: CNN: conv1: 375, conv2: 625, CTRNN: V: 1215, W: 60, T: 60, optimize_state_boundaries: 2, _cnn_output_space: Box(-1.0, 1.0, (8, 8, 5), float32), 

For code that calls get_individual_size nothing changes.

For Classes that inherit from IBrain, they leave get_individual_size untouched and instead have to implement get_free_parameter_metadata, which is basically the same as get_individual_size used to be, except that the return value is now a dict instead of an int

bjuergens commented 3 years ago

i am very unsatisfied by the name get_individual_slices. Does someone have a better idea for what this function should be called? (edit: i have changed it to get_free_parameter_metadata, but I am still not satisfied)

I am not sure if the added complexity is worth the benefit of this PR.

bjuergens commented 3 years ago

I have simplified the generation of the output. Now it doesn't have custom code to generate the output, and instead writes the dict to the log.

Now the output looks like this:

INFO: Individual size for this experiment: 2337
INFO: consumption of free parameter: {'CNN': {'conv1': 375, 'conv2': 625}, 'CTRNN': {'V': 1215, 'W': 60, 'T': 60, 'optimize_state_boundaries': 2}, '_cnn_output_space': Box(-1.0, 1.0, (8, 8, 5), float32)}

before this change it looked like this:

INFO: Individual size for this experiment: 2337
INFO: CNN: conv1: 375, conv2: 625, CTRNN: V: 1215, W: 60, T: 60, optimize_state_boundaries: 2, _cnn_output_space: Box(-1.0, 1.0, (8, 8, 5), float32),

Is this still readable?

pdeubel commented 3 years ago

Is this still readable?

Yes for me its good, the added code which would be needed for the "prettier" log is not justified imho. I'll review now