Monte Carlo Simulation of the Evolution of Category Detection

In the process of writing the evolution of reflexes program, it became evident that an even more significant process, the ability to categorize, might also be modeled. This program seeks to determine whether it is possible to model the evolution of a simple act of categorization, for example the experience of “few” vs. “many”, using the same rules for synaptic modification and model of evolution. This program inherits from the evolution of reflexes the idea that if a neuron generates a behavior that has adaptive significance, natural selection can/should enable the evolution of a stimulus-response reflex. What is different about this program is we attempt to model not the connection of a particular stimulus to a behavior but rather a category of stimuli.

Program Description

In this simulation we model only two behaviors, the product of only two neurons: turn towards or turn away. We use again a 4 x 4 detector that generates a 16 column stimulus vector to be presented, eventually, to a 20 row matrix which models the two neurons in 10 different animals. In order to maintain the authenticity of a neural model, the process required an intermediate step where the number of “lighted” detector elements is “counted” by a prior neural network and that result becomes the stimulus that generates behavior and its associated adaptive (or not) outcomes.

This first stage is a hard wired, 16 by 16, “counter” matrix, where the rows are neurons that fire if a certain number of elements of the the detector are “on”. As usual, behavior = counter * stimNumber. Each element of a given row of counter is set to a value equal to threshold/(number of elements to be detected). For example, the first row values are each set to threshold/16. As a result, it would fire if and only if all 16 elements of the detector were “on.” (threshold/16 * 16 = threshold). The second row fires if any 15 elements are 1’s, and so on. The last row of the counter matrix values are equal to threshold/1 which equals threshold. Therefore if any element of the detector is on, the sixteenth row neuron will fire.

Convienently, this method ensures that the network can easily “count” the number of activated detector elements (stims). Consider a stimulus with (any) 8 of the 16 detector elements “on”. When we do the matrix multiplication, 8 on is NOT enough to fire rows (neurons) 16, 15, 14, etc. However it would
fire row 8, and also fire rows 7, 6, 5 etc. But because the FIRST firing will always be the one of interest, the one that indicates the number of activated detector elements, we simply stop checking sums at the first firing and then put a ‘1’ into the appropriate position of the second stimulus matrix…”stimulus”. (This could also be accomplished by neural circuitry in which the firing of a higher number neuron inhibits the firing of all lower number neurons so that only the one value becomes input into the stimulus matrix.)

The program counts and categorizes the number of detector elements(1 thru 4 are “small”, 9 thru 12 are “large”, any other values are random, “control” stimuli). This is done ONLY for the purpose of evaluating the adaptive value of each behavior according to the number of detector elements present. That is to say, the categorization is not available to any neural circuits and has no effect on any network activities. The adaptive value of behavior is predicated on the hypothesis that, in general, turning towards something little, or small, or lesser, which might more probably be food, is adaptive whereas turning towards something big or many, which might be a larger predator, would be maladaptive. Based on this assumption the adaptive value of each category of stims presented and the subsequent emitted behavior is calculated. Over the course of 36 presentations (a “generation”) the fitness of the ten “animals brains”, each with two neurons, is calculated. The process of evolution through selection and random variation is the same as in the program modeling the evolution a reflex which is described in more detail there. Essentially, the animal with the highest fitness is cloned, with the copy replacing the lowest fitness animal, and the set of encounters are presented again until one animal evolves the capacity to always turn towards a small number of stims and away from a large number.

Unique Details of This Program

As described above, this program models a situation in which the output of one neural network becomes the input to another. Probably a not uncommon occurrence in animal nervous systems.

The Neural Networks

In these cases, it is easier to imagine the neural network from the matrix than it is to draw it. In the case of “Counter” 16 stimuli make synaptic connections with each of 15 output neurons. In the case of “Category Detection” 16 stimuli neurons make synaptic connections with 20 neurons that constitute the final common path to 2 behaviors in each of 10 animals.

The Matrix Representation

The matrix above is filled with random values typical at the start of the simulation.

The Code

https://github.com/Ondaweb/CLASSIFIER