The updateActiveCells function has now 1bf77dc been extracted into its own calculator class. A few changes where made mainly to stop constantly changing array sizes and make them a fixed size. This will improve speed as arrays are no longer being appended to. It has made the update structure for storing information about which synapses learning ay be perform on more complicated.
Further improvements can be made by also having in addition to a tensor storing the end connections of all cells distal synapses (distalSynapses) another tensor storing the starting position of every cells distal synapse distalSynapsesSegOrigin. This will help improve the updateActiveCells function as now instead of calling the function getBestMatchingSegment to find for a cell the segment that was active the most for a particular timeStep we can just go through the list of active cells for that timeStep and see which distal synapses have an end connection to them. This means only going through the synapses that are active instead of checking all distal synapses for a particular cell. Each active distal synapses can add 1 to the segment from which it originates form and once you have finished checking all active synapses a total score for each segment will have been created. This total score will indicate which segment is the best matching for a particular cell. The function getBestMatchingSegment can then return this segment.
Below is a cProfiling run on the updateActiveCells function for the following parameters. This is the standard np_activeCells calculator class (no distalSynapsesSegOrigin tensor), it uses the following inputs;
Related to Issue #5
The updateActiveCells function has now 1bf77dc been extracted into its own calculator class. A few changes where made mainly to stop constantly changing array sizes and make them a fixed size. This will improve speed as arrays are no longer being appended to. It has made the update structure for storing information about which synapses learning ay be perform on more complicated.
Further improvements can be made by also having in addition to a tensor storing the end connections of all cells distal synapses (distalSynapses) another tensor storing the starting position of every cells distal synapse distalSynapsesSegOrigin. This will help improve the updateActiveCells function as now instead of calling the function getBestMatchingSegment to find for a cell the segment that was active the most for a particular timeStep we can just go through the list of active cells for that timeStep and see which distal synapses have an end connection to them. This means only going through the synapses that are active instead of checking all distal synapses for a particular cell. Each active distal synapses can add 1 to the segment from which it originates form and once you have finished checking all active synapses a total score for each segment will have been created. This total score will indicate which segment is the best matching for a particular cell. The function getBestMatchingSegment can then return this segment.
Below is a cProfiling run on the updateActiveCells function for the following parameters. This is the standard np_activeCells calculator class (no distalSynapsesSegOrigin tensor), it uses the following inputs;
timeStep, activeColumns, predictiveCells, activeSeg, distalSynapses
Parameters;