Example #1
0
        /// <summary>
        /// This method updates the permanence matrix with a column's new permanence values. The column is identified by its index, which reflects the row in
        /// the matrix, and the permanence is given in 'sparse' form, (i.e. an array whose members are associated with specific indexes). It is in charge of
        /// implementing 'clipping' - ensuring that the permanence values are always between 0 and 1 - and 'trimming' - enforcing sparseness by zeroing out all
        /// permanence values below 'synPermTrimThreshold'. Every method wishing to modify the permanence matrix should do so through this method.
        /// </summary>
        /// <param name="htmConfig"></param>
        /// <param name="perm">An array of permanence values for a column. The array is "sparse", i.e. it contains an entry for each input bit, even if the permanence value is 0.</param>
        /// <param name="maskPotential">Indexes of potential connections to input neurons.</param>
        /// <param name="raisePerm">a boolean value indicating whether the permanence values</param>
        public void UpdatePermanencesForColumnSparse(HtmConfig htmConfig, double[] perm, int[] maskPotential, bool raisePerm)
        {
            if (raisePerm)
            {
                HtmCompute.RaisePermanenceToThresholdSparse(htmConfig, perm);
            }

            ArrayUtils.LessOrEqualXThanSetToY(perm, htmConfig.SynPermTrimThreshold, 0);
            ArrayUtils.EnsureBetweenMinAndMax(perm, htmConfig.SynPermMin, htmConfig.SynPermMax);
            SetProximalPermanencesSparse(htmConfig, perm, maskPotential);
        }