Beispiel #1
0
        //create Proximal connections from this Column to Columns in Input Layer/Plane
        public void CreateProximalSynapses(Layer lr, Layer ip, double radius, double zoneCoveragePerc)
        {
            //scale layer locations	to InputPlane
            lr.MapPoint(X, Y, ip, out int scaledX, out int scaledY);

            //create random list of columns to connect - Inclusive of centre
            List <Column> potentialColumns = ip.GetColumnsFromCentre(scaledX, scaledY, radius, true);

            ProximalDendrite.CreateSynapses(potentialColumns, zoneCoveragePerc);
        }
Beispiel #2
0
        //General rule for Override functions:
        //1. Override() method sets IsActive, IsPredicting etc.
        //2. DEEP Override() - alters all sub-elements so that Update() will give required results.


        public void OverrideActive(bool active, int depth)
        {
            IsActive     = active;
            InputOverlap = NetConfigData.ColumnStimulusThreshold;
            if (depth < Global.OVERRIDE_DEPTH)
            {
                depth++;
                ProximalDendrite.Override(active, depth);

                foreach (Cell cell in Cells)
                {
                    cell.OverrideActive(active);
                }
            }
        }
Beispiel #3
0
        public void SerializeProximalDendriteTest(int colIndx, double synapsePermConnected, int numInputs)
        {
            ProximalDendrite proximal = new ProximalDendrite(colIndx, synapsePermConnected, numInputs);
            var rfPool = new Pool(1, 28);

            Cell cell = new Cell(12, 14, 16, 18, new CellActivity());

            var distSeg1 = new DistalDendrite(cell, 1, 2, 2, 1.0, 100);

            cell.DistalDendrites.Add(distSeg1);

            var distSeg2 = new DistalDendrite(cell, 44, 24, 34, 1.0, 100);

            cell.DistalDendrites.Add(distSeg2);

            Cell preSynapticcell = new Cell(11, 14, 16, 28, new CellActivity());

            var synapse1 = new Synapse(cell, distSeg1.SegmentIndex, 23, 1.0);

            preSynapticcell.ReceptorSynapses.Add(synapse1);

            var synapse2 = new Synapse(cell, distSeg2.SegmentIndex, 27, 1.0);

            preSynapticcell.ReceptorSynapses.Add(synapse2);

            rfPool.m_SynapsesBySourceIndex = new Dictionary <int, Synapse>();
            rfPool.m_SynapsesBySourceIndex.Add(3, synapse1);
            rfPool.m_SynapsesBySourceIndex.Add(67, synapse2);

            proximal.RFPool = rfPool;

            //HtmSerializer2 htm = new HtmSerializer2();
            using (StreamWriter sw = new StreamWriter($"ser_{nameof(SerializeProximalDendriteTest)}.txt"))
            {
                proximal.Serialize(sw);
            }
            //htm.indent($"ser_{nameof(SerializeProximalDendriteTest)}.txt");
            using (StreamReader sr = new StreamReader($"ser_{nameof(SerializeProximalDendriteTest)}.txt"))
            {
                ProximalDendrite proximal1 = ProximalDendrite.Deserialize(sr);

                Assert.IsTrue(proximal.Equals(proximal1));
            }
        }
Beispiel #4
0
        public void TestModelClasses()
        {
            //Test Segment equality
            Column  column1 = new Column(2, 0);
            Cell    cell1   = new Cell(column1, 0);
            Segment s1      = new DistalDendrite(cell1, 0, 1, 0);

            Assert.IsTrue(s1.Equals(s1)); // test ==
            Assert.IsFalse(s1.Equals(null));

            Segment s2 = new DistalDendrite(cell1, 0, 1, 0);

            Assert.IsTrue(s1.Equals(s2));

            Cell    cell2 = new Cell(column1, 0);
            Segment s3    = new DistalDendrite(cell2, 0, 1, 0);

            Assert.IsTrue(s1.Equals(s3));

            //Segment's Cell has different index
            Cell    cell3 = new Cell(column1, 1);
            Segment s4    = new DistalDendrite(cell3, 0, 1, 0);

            Assert.IsFalse(s1.Equals(s4));

            //Segment has different index
            Segment s5 = new DistalDendrite(cell3, 1, 1, 0);

            Assert.IsFalse(s4.Equals(s5));
            Assert.IsTrue(s5.ToString().Equals("1"));
            Assert.AreEqual(-1, s4.CompareTo(s5));
            Assert.AreEqual(1, s5.CompareTo(s4));

            //Different type of segment
            Segment s6 = new ProximalDendrite(0);

            Assert.IsFalse(s5.Equals(s6));

            Console.WriteLine(s4.CompareTo(s5));
        }
Beispiel #5
0
 public void OverrideProximalDendriteActivationThreshold(int threshold)
 {
     ProximalDendrite.OverrideActivationThreshold(threshold);
 }
Beispiel #6
0
 public void OverrideProximalPermanence(double permanence)
 {
     ProximalDendrite.OverridePermanence(permanence);
 }
Beispiel #7
0
 //get actual number of active Proximal connections to this column.
 public int CountActiveProximalSynapses()
 {
     return(ProximalDendrite.CountActiveSynapses());
 }
Beispiel #8
0
 public int CountProximalSynapses()
 {
     return(ProximalDendrite.CountSynapses());
 }
Beispiel #9
0
 internal void RemoveAllProximalSynapses()
 {
     ProximalDendrite.RemoveAllSynapses();
 }
Beispiel #10
0
 //update Column InputOverlap
 public void Update_Proximal()
 {
     InputOverlap         = Boost * ProximalDendrite.Update();
     InputOverlap_TimeAve = Algebra.RunningAverage(InputOverlap_TimeAve, InputOverlap, Global.DEFAULT_TIME_AVERAGE_PERIOD);
 }