Exemplo n.º 1
0
def run():
    sp = SpatialPooler(inputDimensions=[10, 15],
                       columnDimensions=[5, 10],
                       potentialRadius=2,
                       potentialPct=0.5,
                       synPermInactiveDec=0.1,
                       synPermActiveInc=0.1,
                       synPermConnected=0.1,
                       localAreaDensity=0.1,
                       numActiveColumnsPerInhArea=-1,
                       globalInhibition=True)
    inputArray = numpy.zeros(sp.getNumInputs())
    activeArray = numpy.zeros(sp.getNumColumns())

    Patcher().patchSP(sp)

    for i in range(100):
        generateInput(inputArray)
        sp.compute(inputArray, True, activeArray)
        print "Ran iteration:\t{0}".format(i)
Exemplo n.º 2
0
def run():
  sp = SpatialPooler(
    inputDimensions=[10, 15],
    columnDimensions=[5, 10],
    potentialRadius=2,
    potentialPct=0.5,
    synPermInactiveDec=0.1,
    synPermActiveInc=0.1,
    synPermConnected=0.1,
    localAreaDensity=0.1,
    numActiveColumnsPerInhArea=-1,
    globalInhibition=True
  )
  inputArray = numpy.zeros(sp.getNumInputs())
  activeArray = numpy.zeros(sp.getNumColumns())

  Patcher().patchSP(sp)

  for i in range(100):
    generateInput(inputArray)
    sp.compute(inputArray, True, activeArray)
    print "Ran iteration:\t{0}".format(i)
Exemplo n.º 3
0
                   spVerbosity=0)

tm = TemporalMemory(
    columnDimensions=sp.getColumnDimensions(),
    initialPermanence=0.4,
    connectedPermanence=0.5,
    minThreshold=4,
    maxNewSynapseCount=4,
    permanenceDecrement=0.05,
    permanenceIncrement=0.05,
    activationThreshold=4,
)

cla = CLAClassifierCond((1, 2))

spIn = numpy.zeros(sp.getNumInputs(), dtype=numpy.uint8)
spOut = numpy.zeros(sp.getNumColumns(), dtype=numpy.uint8)

trainingData = [['a', 'b', 'c'], ['a', 'c', 'b']]
trainingData2 = [(['b', 'c', 'a'], ['z', 'x', 'y'])]

recordNum = 0

for i in xrange(20):

    #    recordNum = 0
    #    for dataList in trainingData:
    #        print("----------dataList = {}----------".format(dataList))
    #
    #        for data in dataList:
    #            spIn.fill(0)