CodeReclaimers / neat-python

Python implementation of the NEAT neuroevolution algorithm
BSD 3-Clause "New" or "Revised" License
1.42k stars 492 forks source link

Understanding chromosome representation #88

Closed amarzullo24 closed 7 years ago

amarzullo24 commented 7 years ago

Dear all, Working on the framework I realized that I can't fully understand how a chromosome is represented: I defined in the configuration file 3 input neurons and 1 output neuron. However, when I print the chromosomes in order to visualize their composition, an example of output is:

Nodes:

Connections:

Here seems that I have just two nodes in this network (while I expected to see at least four). Are input and output nodes omitted in the representation?

Moreover the keys of the connections contains negative numbers, which are not keys of the nodes. How I have to read it?

In a previous version of the framework I used to access the input and output nodes of a connection as connection.in_node_id and connection.out_node_idwhich were both positive ids.

Thank you for your help.

CodeReclaimers commented 7 years ago

Correct, the inputs don't have nodes associated with them. I need to document this, but the internal term I use for inputs and outputs is "pins" which are not neurons. This is originally because having full nodes for inputs meant you had a bunch of useless machinery in every input neuron that didn't do much of anything. (I sometimes still wonder if that was a good idea...but I haven't talked myself into changing it back yet.)

Each input pin is labeled with a negative integer, starting at -1. Each output pin always has an associated node (which can't be deleted by mutation), and the output pins/neurons are always numbered starting at 0. So in your example, 0 is the output node/pin, and 1 is a hidden node that is connected to inputs 1 and 3.

evolvingfridge commented 7 years ago

@CodeReclaimers, do you wounder of extension to multi-model-neat ?

drallensmith commented 7 years ago

By multi-model, exactly what are you meaning? (If it's a specific NEAT variant that someone has implemented in another language, a reference would be nice...)

evolvingfridge commented 7 years ago

This one: https://github.com/schrum2/MM-NEATv2 I don't think there is comparison of EShyperNeat vs MM-NEAT.

drallensmith commented 7 years ago

Oh, right - with modules governed by selection outputs - multi-modular NEAT. (Bringing in multiobjective evolution is also of interest, particularly for me, as it happens.) Certainly an interesting one for "broken" domains. I suspect that an alternative method for such domains, RBF-NEAT, may be easier to do. (And, eventually, they could be combined.)

BTW, @d0pa, you might want to put this into a new issue - in a closed one, it's less likely to be noticed by most means.

evolvingfridge commented 7 years ago

Evolving cooperative decision processes under uncertainty in complex environments is of my interest also, looks like we are working on a same problems :)

drallensmith commented 7 years ago

Hmm, yes, LARG/HFO is also a cooperative decision problem, although I am a bit more focused in the short-term on the competitive coevolution aspect. (For instance, the goalie appears to require low-level actions; it will take a bit for me to have a NEAT defense (non-goalie) player that is doing low-level actions to use as a base for a goalie, so for the time being it's likely to remain the default/base, non-learning, goalie.)

evolvingfridge commented 7 years ago

If I understand you correctly you want to use non-goalie evolved behavior in goalie behavior with minimal retraining. If yes this goes back to my issue with statistical model that I mentioned in reporting.

drallensmith commented 7 years ago

I apologize, BTW, for my tendency toward overly-complex and hard-to-understand sentences; I initially write the way I think, then later edit it down...

Regarding goalies - As a longer-term project, yes.

One thing that might help out statistical looks at hidden node behavior would be implementing something that's in some other versions of NEAT - nodes that originate with analogous mutations (as in, same connection being replaced) being given the same innovation number, at least if it happens in the same generation (possibly longer-term than that, although some limit would be needed both for practical reasons - space, admittedly not much space - and because older "versions" of the mutation would be likely to be different due to additional inputs, shifts of variables beyond the original init ranges, etc).

evolvingfridge commented 7 years ago

No need to apologize at all, I am self-thought (never go to any school) so I might be a bit slow at times :)

That's good to know, I need to sort out my time schedule to dedicate time and effort on neat, would you be interested if we collaborate on research. Since my current project is your longer-term project and possible your research overlaps with research I done in past.

I am testing right now self organizing model defined by input space and time frames, this is speculative but it looks like best way to simplify computation.

drallensmith commented 7 years ago

Heh. I'm actually pretty much completely self-taught when it comes to computers, and uneducated != slow.

I am personally very uncertain how much time I will have to work on matters - I've gone from being part-time employed as an adjunct professor (not in computers, although I'd proposed a "Computers for Scientists" course) to being very occasionally employed, while my wife went from part-time employed, full-time student to full-time employed. I am looking for either part-time online work or full-time long-term (ideally tenured) work... but if I can get some research done in the meantime, ideally that I could continue at least part-time later, so much the better. I'm currently mostly laying the groundwork, learning about tools and seeing how they can be expanded for research purposes. (Plus I simply like helping out on things I'm interested in!)

Self-organizing model - like self-organizing maps? Regarding timeframes, another perspective (as well as those I mentioned in the other thread) on this would be from areas like anomaly detection (everything from network intrusion to figuring out that an elderly person may be ill based on alterations in their detected routine). If the data is temporally continuous, then it's partially a matter of matching up curves (frequently with some degree of temporal rate differences); if not, then it's more sequence-oriented.

evolvingfridge commented 7 years ago

I guess it is a self-organizing map in formal term, but model organizes recurrency depth.

I am in same boat with you on time to work on a research project. Since I am self thought, it is hard for me to approach institutions with a grant for research project. I am not saying there is any guarantee of getting any funding for research, but I think there is a good chance (3 years of working on understanding funding opportunities). Please note my motivation is not money from grant, but a contribution to science and personal achievement :).

"Temporally or sequence oriented" that's where things get fuzzy for me, because DNA or text can be represented and analyzed as time series data also.

drallensmith commented 7 years ago

I understand. I've now acquired an adjunct position, but it's part-time and I should still be able to work on research & related.

Text I can definitely see as time-series. DNA... I suppose one could analyze it in terms of base proportions (or maybe even codon usage, likelihood of matching to a set of patterns...), in order to do, in essence, waveforms and work with those - not sure if that would be temporal as such. Amino acid sequences are a bit more temporal, in that they do emerge from the ribosome a bit at a time (something that protein folding work could probably use paying more attention to); they frequently get altered after that and undergo lots of nonlocal interactions, however.

evolvingfridge commented 7 years ago

I mentioned DNA because of this, it is possible build similar sequences of DNA that will be times series datasets like an stock prices :). I guess most fuzzy part for me is in definition of temporal dataset and sequence dataset.