Пример #1
0
        ///<summary>
        /// Add a new <see cref="SegmentUpdate"/> object to this <see cref="Cell"/>
        /// containing proposed changes to the specified segment.
        ///</summary>
        ///<remarks>
        /// If the segment is None, then a new segment is to be added, otherwise
        /// the specified segment is updated.  If the segment exists, find all active
        /// synapses for the segment (either at t or t-1)
        /// and mark them as needing to be updated.  If newSynapses is true, then
        /// Region.newNumberSynapses - len(activeSynapses) new synapses are added to the
        /// segment to be updated.  The (new) synapses are randomly chosen from the set
        /// of current learning cells (within Region.localityRadius if set).
        ///
        /// These segment updates are only applied when the applySegmentUpdates
        /// method is later called on this Cell.
        ///</remarks>
        internal SegmentUpdate UpdateDistalSegmentActiveSynapses(int t, DistalSegment distalSegment, bool newSynapses = false)
        {
            // Let ActiveSynapses be the list of active synapses where the originating
            // cells have their ActiveState output = true at time step t.
            // (This list is empty if segment = null since the segment doesn't exist.)
            var activeSynapses = new List <Synapse>();

            if (distalSegment != null)
            {
                activeSynapses = distalSegment.GetActiveSynapses(t);
            }

            var segmentUpdate = new SegmentUpdate(this, distalSegment, activeSynapses, newSynapses);

            this.SegmentUpdates.Add(segmentUpdate);

            return(segmentUpdate);
        }
Пример #2
0
        ///<summary>
        /// Add a new <see cref="SegmentUpdate"/> object to this <see cref="Cell"/>
        /// containing proposed changes to the specified segment. 
        ///</summary>
        ///<remarks>
        /// If the segment is None, then a new segment is to be added, otherwise
        /// the specified segment is updated.  If the segment exists, find all active
        /// synapses for the segment (either at t or t-1)
        /// and mark them as needing to be updated.  If newSynapses is true, then
        /// Region.newNumberSynapses - len(activeSynapses) new synapses are added to the
        /// segment to be updated.  The (new) synapses are randomly chosen from the set
        /// of current learning cells (within Region.localityRadius if set).
        ///
        /// These segment updates are only applied when the applySegmentUpdates
        /// method is later called on this Cell.
        ///</remarks>
        internal SegmentUpdate UpdateDistalSegmentActiveSynapses(int t, DistalSegment distalSegment, bool newSynapses = false)
        {
            // Let ActiveSynapses be the list of active synapses where the originating
            // cells have their ActiveState output = true at time step t.
            // (This list is empty if segment = null since the segment doesn't exist.)
            var activeSynapses = new List<Synapse>();
            if (distalSegment != null)
            {
                activeSynapses = distalSegment.GetActiveSynapses(t);
            }

            var segmentUpdate = new SegmentUpdate(this, distalSegment, activeSynapses, newSynapses);
            this.SegmentUpdates.Add(segmentUpdate);

            return segmentUpdate;
        }