public void testAdaptSegmentToMax() { TemporalMemory tm = new TemporalMemory(); Connections cn = new Connections(); Parameters p = Parameters.GetAllDefaultParameters(); p.Apply(cn); TemporalMemory.Init(cn); DistalDendrite dd = cn.CreateSegment(cn.GetCell(0)); Synapse s1 = cn.CreateSynapse(dd, cn.GetCell(23), 0.9); tm.AdaptSegment(cn, dd, cn.GetCellSet(23), cn.GetPermanenceIncrement(), cn.GetPermanenceDecrement()); Assert.AreEqual(1.0, s1.GetPermanence(), 0.1); // Now permanence should be at max tm.AdaptSegment(cn, dd, cn.GetCellSet(23), cn.GetPermanenceIncrement(), cn.GetPermanenceDecrement()); Assert.AreEqual(1.0, s1.GetPermanence(), 0.1); }
public void testAdaptSegmentToMin() { TemporalMemory tm = new TemporalMemory(); Connections cn = new Connections(); Parameters p = Parameters.GetAllDefaultParameters(); p.Apply(cn); TemporalMemory.Init(cn); DistalDendrite dd = cn.CreateSegment(cn.GetCell(0)); Synapse s1 = cn.CreateSynapse(dd, cn.GetCell(23), 0.1); cn.CreateSynapse(dd, cn.GetCell(1), 0.3); tm.AdaptSegment(cn, dd, cn.GetCellSet(), cn.GetPermanenceIncrement(), cn.GetPermanenceDecrement()); Assert.IsFalse(cn.GetSynapses(dd).Contains(s1)); }
public void TestAdaptSegmentToMin() { TemporalMemory tm = new TemporalMemory(); Connections cn = new Connections(); Parameters p = Parameters.getAllDefaultParameters(); p.apply(cn); tm.Init(cn); DistalDendrite dd = cn.CreateDistalSegment(cn.GetCell(0)); Synapse s1 = cn.CreateSynapse(dd, cn.GetCell(23), 0.1); cn.CreateSynapse(dd, cn.GetCell(1), 0.3); TemporalMemory.AdaptSegment(cn, dd, cn.GetCellSet(new int[] { }), cn.HtmConfig.PermanenceIncrement, cn.HtmConfig.PermanenceDecrement); //DD Assert.IsFalse(cn.GetSynapses(dd).Contains(s1)); Assert.IsFalse(dd.Synapses.Contains(s1)); }
public void TestAdaptSegmentToMax() { TemporalMemory tm = new TemporalMemory(); Connections cn = new Connections(); Parameters p = Parameters.getAllDefaultParameters(); p.apply(cn); tm.Init(cn); DistalDendrite dd = cn.CreateDistalSegment(cn.GetCell(0)); Synapse s1 = cn.CreateSynapse(dd, cn.GetCell(23), 0.9); TemporalMemory.AdaptSegment(cn, dd, cn.GetCellSet(new int[] { 23 }), cn.HtmConfig.PermanenceIncrement, cn.HtmConfig.PermanenceDecrement); Assert.AreEqual(1.0, s1.Permanence, 0.1); // Now permanence should be at max TemporalMemory.AdaptSegment(cn, dd, cn.GetCellSet(new int[] { 23 }), cn.HtmConfig.PermanenceIncrement, cn.HtmConfig.PermanenceDecrement); Assert.AreEqual(1.0, s1.Permanence, 0.1); }
public void testAdaptSegment() { TemporalMemory tm = new TemporalMemory(); Connections cn = new Connections(); Parameters p = Parameters.GetAllDefaultParameters(); p.Apply(cn); TemporalMemory.Init(cn); DistalDendrite dd = cn.CreateSegment(cn.GetCell(0)); Synapse s1 = cn.CreateSynapse(dd, cn.GetCell(23), 0.6); Synapse s2 = cn.CreateSynapse(dd, cn.GetCell(37), 0.4); Synapse s3 = cn.CreateSynapse(dd, cn.GetCell(477), 0.9); tm.AdaptSegment(cn, dd, cn.GetCellSet(23, 37), cn.GetPermanenceIncrement(), cn.GetPermanenceDecrement()); Assert.AreEqual(0.7, s1.GetPermanence(), 0.01); Assert.AreEqual(0.5, s2.GetPermanence(), 0.01); Assert.AreEqual(0.8, s3.GetPermanence(), 0.01); }
public void TestAdaptSegment() { TemporalMemory tm = new TemporalMemory(); Connections cn = new Connections(); Parameters p = Parameters.getAllDefaultParameters(); p.apply(cn); tm.Init(cn); DistalDendrite dd = cn.CreateDistalSegment(cn.GetCell(0)); Synapse s1 = cn.CreateSynapse(dd, cn.GetCell(23), 0.6); Synapse s2 = cn.CreateSynapse(dd, cn.GetCell(37), 0.4); Synapse s3 = cn.CreateSynapse(dd, cn.GetCell(477), 0.9); tm.AdaptSegment(cn, dd, cn.GetCellSet(new int[] { 23, 37 }), cn.HtmConfig.PermanenceIncrement, cn.HtmConfig.PermanenceDecrement); Assert.AreEqual(0.7, s1.Permanence, 0.01); Assert.AreEqual(0.5, s2.Permanence, 0.01); Assert.AreEqual(0.8, s3.Permanence, 0.01); }