Example #1
0
        public void CreateBasalSynapses(List <Column> potentialColumns, double zoneCoveragePerc)
        {
            zoneCoveragePerc = zoneCoveragePerc < 0 ? 1.0 : zoneCoveragePerc;

            //create random list of columns to connect
            int numSynapsesRequired = (int)(potentialColumns.Count * zoneCoveragePerc);
            int numNewSynapses      = numSynapsesRequired - BasalDendrite.Synapses.Count;

            if (numNewSynapses > 0)             //add synapses
            {
                //remove columns already connected from the potential list
                List <Column> alreadyConnected = BasalDendrite.GetConnectedColumnsList();
                potentialColumns.RemoveAll(x => alreadyConnected.Contains(x));

                IEnumerable <Column> connectColumns = potentialColumns.RandomSample(numNewSynapses, false);
                foreach (Column col in connectColumns)
                {
                    BasalDendrite.CreateSynapse(col);
                }
            }

            if (numNewSynapses < 0)              //remove synapses
            {
                while (BasalDendrite.Synapses.Count > 0 && BasalDendrite.Synapses.Count > numSynapsesRequired)
                {
                    //remove random synapse
                    BasalDendrite.RemoveSynapseAt(Global.rnd.Next(BasalDendrite.Synapses.Count));
                }
            }
        }
Example #2
0
 public void OverridePredicting(bool predicting, int depth)
 {
     IsPredicting = predicting;
     if (depth < Global.OVERRIDE_DEPTH)
     {
         BasalDendrite.Override(predicting, depth);
     }
 }
Example #3
0
 //Main function to update all cell states
 public void Update()
 {
     BasalDendrite.Update();
     IsPredicting = BasalDendrite.IsActive;
 }
Example #4
0
 public void OverrideBasalDendriteActivationThreshold(int threshold)
 {
     BasalDendrite.OverrideActivationThreshold(threshold);
 }
Example #5
0
 public int CountActiveBasalSynapses()
 {
     return(BasalDendrite.CountActiveSynapses());
 }
Example #6
0
 public int CountBasalSynapses()
 {
     return(BasalDendrite.CountSynapses());
 }