I’m sorry, I think I did not understand correctly. Would you mind explaining more? I want to run the mnist.py code in the example folder, so should I add sp.setIterationNum(UInt iterationNum) to this code? For example, as follows:
def main(parameters=default_parameters, argv=None, verbose=True):
# Load data.
train_labels, train_images, test_labels, test_images= load_ds('mnist_784', 10000, shape=[28,28])
training_data = list(zip(train_images, train_labels))
test_data = list(zip(test_images, test_labels))
#random.shuffle(training_data)
# Setup the AI.
enc = SDR(train_images[0].shape)
sp = SpatialPooler(
inputDimensions = enc.dimensions,
columnDimensions = parameters['columnDimensions'],
potentialRadius = parameters['potentialRadius'],
potentialPct = parameters['potentialPct'],
globalInhibition = True,
localAreaDensity = parameters['localAreaDensity'],
stimulusThreshold = int(round(parameters['stimulusThreshold'])),
synPermInactiveDec = parameters['synPermInactiveDec'],
synPermActiveInc = parameters['synPermActiveInc'],
synPermConnected = parameters['synPermConnected'],
minPctOverlapDutyCycle = parameters['minPctOverlapDutyCycle'],
dutyCyclePeriod = int(round(parameters['dutyCyclePeriod'])),
boostStrength = parameters['boostStrength'],
seed = 1, # this is important, 0="random" seed which changes on each invocation
spVerbosity = 99,
wrapAround = False)
sp.setIterationNum(30)
I did this, but after executing the code, the following parameters were printed in the output (ie, the same values written in the file spatialpooler.cpp)
---------------CPP SpatialPooler Parameters ------------------
iterationNum = 0
iterationLearnNum = 0
numInputs = 784
numColumns = 784
numActiveColumnsPerInhArea = 0
potentialPct = 0.1
globalInhibition = 1
localAreaDensity = 0.1
stimulusThreshold = 6
synPermActiveInc = 0.14
synPermInactiveDec = 0.02
synPermConnected = 0.5
minPctOverlapDutyCycles = 0.2
dutyCyclePeriod = 1000
boostStrength = 0
spVerbosity = 99