hello_sp.py contains a simple spatial pooler demonstration written in python.
python hello_sp.py
This script provides 3 examples demonstrating the effects of the spatial pooler on the following 3 sets of input values:
- Displaying the output SDRs of 3 randomized input values.
- Displaying 3 SDR's generated from the same input value.
- Displaying 3 SDR's generated with slightly different input values, by adding 10% and 20% noise to the original input vector.
The script uses a simple binary vector for input.
After running this example and reading through the output you should have a basic understanding of the relationship between input and output of the spatial pooler.
Further reading: Encoders
sp_tutorial.py replicates figures 5, 7 and 9 from the paper Porting HTM Models to the Heidelberg Neuromorphic Computing Platform. This will show some basic properties of the spatial pooler.
python sp_tutorial.py
The script is divided in three parts, each of them addressing one of the following questions:
- What is the distribution of the overlap scores in a spatial pooler for a random binary input?
- How robust is the spatial pooler against input noise when untrained?
- How robust is it after training?
More details can be found in the comments of the script as well as in its command-line output.