#numActiveColumnsPerInhArea = -1, # Using percentage instead numActiveColumnsPerInhArea=1, # Only one feature active at a time # All input activity can contribute to feature output stimulusThreshold=0, synPermInactiveDec=0.3, synPermActiveInc=0.3, synPermConnected=0.3, # Connected threshold maxBoost=2, seed=1956, # The seed that Grok uses spVerbosity=1) # Instantiate the spatial pooler test bench. tb = VisionTestBench(sp) # Instantiate the classifier clf = exactMatch() # Train the spatial pooler on trainingVectors. numCycles = tb.train(trainingVectors, trainingTags, clf, maxTrainingCycles) # View the permanences and connections after training. tb.showPermsAndConns() #tb.savePermsAndConns('perms_and_conns.jpg') # Get testing images and convert them to vectors. testingImages, testingTags = data.getImagesAndTags(testingDataset) testingVectors = encoder.imagesToVectors(testingImages) # Test the spatial pooler on testingVectors. accuracy = tb.test(testingVectors, testingTags, clf, verbose=1)
#numActiveColumnsPerInhArea = -1, # Using percentage instead numActiveColumnsPerInhArea = 1, # Only one feature active at a time # All input activity can contribute to feature output stimulusThreshold = 0, synPermInactiveDec = 0.3, synPermActiveInc = 0.3, synPermConnected = 0.3, # Connected threshold maxBoost = 2, seed = 1956, # The seed that Grok uses spVerbosity = 1) # Instantiate the spatial pooler test bench. tb = VisionTestBench(sp) # Instantiate the classifier clf = exactMatch() # Train the spatial pooler on trainingVectors. numCycles = tb.train(trainingVectors, trainingTags, clf, maxTrainingCycles) # View the permanences and connections after training. tb.showPermsAndConns() #tb.savePermsAndConns('perms_and_conns.jpg') # Get testing images and convert them to vectors. testingImages, testingTags = data.getImagesAndTags(testingDataset) testingVectors = encoder.imagesToVectors(testingImages) # Test the spatial pooler on testingVectors. accuracy = tb.test(testingVectors, testingTags, clf, verbose=1)
maxBoost = 1.0, seed = 1956, # The seed that Grok uses spVerbosity = 1) # Instantiate the spatial pooler test bench. tb = VisionTestBench(sp) # Instantiate the classifier clf = KNNClassifier() # Get training images and convert them to vectors. trainingImages, trainingTags = data.getImagesAndTags(trainingDataset) trainingVectors = encoder.imagesToVectors(trainingImages) # Train the spatial pooler on trainingVectors. numCycles = tb.train(trainingVectors, trainingTags, clf, maxTrainingCycles, minAccuracy) # Save the permanences and connections after training. #tb.savePermanences('perms.jpg') #tb.showPermanences() #tb.showConnections() # Get testing images and convert them to vectors. testingImages, testingTags = data.getImagesAndTags(testingDataset) testingVectors = encoder.imagesToVectors(testingImages) # Reverse the order of the vectors and tags for testing testingTags = [testingTag for testingTag in reversed(testingTags)] testingVectors = [testingVector for testingVector in reversed(testingVectors)] # Test the spatial pooler on testingVectors.
stimulusThreshold=0, synPermInactiveDec=synPermDec, synPermActiveInc=synPermInc, synPermConnected=synPermConn, maxBoost=1.0, seed=1956, # The seed that Grok uses spVerbosity=1) # Instantiate the spatial pooler test bench. tb = VisionTestBench(sp) # Instantiate the classifier clf = KNNClassifier() # Train the spatial pooler on trainingVectors. numCycles = tb.train(trainingVectors, trainingTags, clf, maxTrainingCycles, minAccuracy) # Save the permanences and connections after training. #tb.savePermanences('perms.jpg') #tb.showPermanences() #tb.showConnections() # Get testing images and convert them to vectors. testingImages, testingTags = data.getImagesAndTags(testingDataset) testingVectors = encoder.imagesToVectors(testingImages) # Reverse the order of the vectors and tags for testing testingTags = [testingTag for testingTag in reversed(testingTags)] testingVectors = [ testingVector for testingVector in reversed(testingVectors) ]
numActiveColumnsPerInhArea = 64, # All input activity can contribute to feature output stimulusThreshold = 0, synPermInactiveDec = synPermDec, synPermActiveInc = synPermInc, synPermConnected = synPermConn, # Connected threshold maxBoost = 3, seed = 1956, # The seed that Grok uses spVerbosity = 1) # Instantiate the spatial pooler test bench. tb = VisionTestBench(sp) # Train the spatial pooler on trainingVectors. trainSDRIs, numCycles = tb.train(trainingVectors, trainingTags, maxTrainingCycles, usePPM=False) # Save the permanences and connections after training. tb.savePermsAndConns('perms_and_conns.jpg') #tb.showPermsAndConns() # Get testing images and convert them to vectors. testingImages, testingTags = data.getImagesAndTags(testingDataset) testingVectors = encoder.imagesToVectors(testingImages) # Test the spatial pooler on testingVectors. testSDRIs = tb.test(testingVectors, testingTags) if testSDRIs != trainSDRIs: print "Yo! SDRs don't match!" #for i in range(len(testSDRIs)):