Exemplo n.º 1
0
        /// <summary>
        /// Sets the permanences for each {@link Synapse} specified by the indexes passed in which identify the input vector indexes associated with the
        /// <see cref="Synapse"/>. The permanences passed in are understood to be in "sparse" format and therefore require the int array identify their
        /// corresponding indexes.
        /// </summary>
        /// <param name="connectedCounts"></param>
        /// <param name="htmConfig"></param>
        /// <param name="perms">the floating point degree of connectedness</param>
        /// <param name="inputIndexes"></param>
        /// <remarks>
        /// Note: This is the "sparse" version of this method.
        /// </remarks>
        public void SetPermanences(AbstractSparseBinaryMatrix connectedCounts, HtmConfig htmConfig, double[] perms, int[] inputIndexes)
        {
            var permConnThreshold = htmConfig.SynPermConnected;

            RFPool.ResetConnections();
            // c.getConnectedCounts().clearStatistics(ParentColumnIndex);
            connectedCounts.ClearStatistics(0 /*this.ParentColumnIndex*/);
            for (int i = 0; i < inputIndexes.Length; i++)
            {
                var synapse = RFPool.GetSynapseForInput(inputIndexes[i]);
                synapse.Permanence = perms[i];

                if (perms[i] >= permConnThreshold)
                {
                    connectedCounts.set(1, 0 /*ParentColumnIndex*/, i);
                }
            }
        }
Exemplo n.º 2
0
        public bool Equals(ProximalDendrite obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }

            ProximalDendrite other = (ProximalDendrite)obj;

            if (RFPool == null)
            {
                if (other.RFPool != null)
                {
                    return(false);
                }
            }
            else if (!RFPool.Equals(other.RFPool))
            {
                return(false);
            }

            if (SegmentIndex != other.SegmentIndex)
            {
                return(false);
            }

            if (Synapses == null)
            {
                if (other.Synapses != null)
                {
                    return(false);
                }
            }
            else if (!Synapses.SequenceEqual(other.Synapses))
            {
                return(false);
            }

            //if (boxedIndex == null)
            //{
            //    if (other.boxedIndex != null)
            //        return false;
            //}
            //else if (!boxedIndex.Equals(other.boxedIndex))
            //    return false;

            if (SynapsePermConnected != other.SynapsePermConnected)
            {
                return(false);
            }
            if (NumInputs != other.NumInputs)
            {
                return(false);
            }

            return(true);
        }