Doo.Machine.HTM.HTMCell.GetBestMatchingSegment C# (CSharp) Method

GetBestMatchingSegment() public method

public GetBestMatchingSegment ( int t, bool sequence ) : HTMSegment
t int
sequence bool
return HTMSegment
        public HTMSegment GetBestMatchingSegment(int t, bool sequence)
        {
            HTMSegment bestSegment = null;
            int bestSynapseCount = _column.Region.MinSegmentActivityForLearning;
            int synCount;
            foreach (HTMSegment seg in _distalSegments)
            {
                synCount = seg.GetActiveSynapses(t, false, false).Count;
                if (synCount > bestSynapseCount)
                {
                    bestSynapseCount = synCount;
                    bestSegment = seg;
                }
            }
            return bestSegment;
        }