From 7f5dbe51c2ecdd4f5c55ba4be65fdfbd319fa9d9 Mon Sep 17 00:00:00 2001 From: Martin Pilka Date: Mon, 4 Jul 2011 16:37:14 +1000 Subject: [PATCH 1/2] Consider whole (including borders) input space as srcPos of a column inputWidth = 80 inputHeight = 60 Before change srcPos = (int(cx*self.xSpace), int(cy*self.ySpace)) = (79, 58) ==> Border not considered After change srcPos = (int(round(cx*self.xSpace)), int(round(cy*self.ySpace))) = = (79, 59) ==> Border considered --- src/HTM/Region.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HTM/Region.py b/src/HTM/Region.py index b75917a..06b0bb6 100644 --- a/src/HTM/Region.py +++ b/src/HTM/Region.py @@ -130,7 +130,7 @@ def __init__(self, inputSize, colGridSize, pctInputPerCol=0.05, pctMinOverlap=0. for cx in xrange(self.width): yCols = [] for cy in xrange(self.height): - srcPos = (int(cx*self.xSpace), int(cy*self.ySpace)) + srcPos = (int(round(cx*self.xSpace)), int(round(cy*self.ySpace))) col = Column(self, srcPos, (cx,cy)) yCols.append(col) self.columns.append(col) From 9bf340ade54f7524105598022919173d5a72b481 Mon Sep 17 00:00:00 2001 From: Martin Pilka Date: Mon, 4 Jul 2011 16:54:36 +1000 Subject: [PATCH 2/2] Use more suitable std-dev (sigma) parameter for Gauss distribution Before change Function graph was http://www.wolframalpha.com/input/?i=N%280.2%2C0.05*2%29&a=*MC.N%28-_*DistributionAbbreviation- Values "< 0" or "> 1" are possible --> not desired After change Function graph is http://www.wolframalpha.com/input/?i=N%280.2%2C0.05^2%29&a=*MC.N%28-_*DistributionAbbreviation- Values are between 0.05 and 0.35 --- src/HTM/Region.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HTM/Region.py b/src/HTM/Region.py index 06b0bb6..c4c85f3 100644 --- a/src/HTM/Region.py +++ b/src/HTM/Region.py @@ -184,7 +184,7 @@ def __init__(self, inputSize, colGridSize, pctInputPerCol=0.05, pctMinOverlap=0. allPos.append((x,y)) for rx,ry in random.sample(allPos, synapsesPerSegment): inputCell = InputCell(rx, ry, self.inputData) - permanence = random.gauss(Synapse.CONNECTED_PERM, Synapse.PERMANENCE_INC*2) + permanence = random.gauss(Synapse.CONNECTED_PERM, Synapse.PERMANENCE_INC**2) distance = sqrt((col.ix-rx)**2 + (col.iy-ry)**2) localityBias = (RAD_BIAS_PEAK/0.4)*exp((distance/(longerSide*RAD_BIAS_STD_DEV))**2/-2) syn = Synapse(inputCell, permanence*localityBias)