I wanted to talk a bit about using *topology* with HTM. Most of this is just me working these thoughts out in my head, so some of it might be confusing or inaccurate. I welcome feedback and discussion.

With no topology (the default today in NuPIC), the input space for the Spatial Pooler contains cells with no relationships to each other. The state of any bit in the input will never be correlated to the state of any other bit in the input. With topology enabled, the Spatial Pooler will calculate “neighborhoods” around SP columns based on Euclidean distance in N-dimensional space. This allows us to create a multidimensional input space and Spatial Pooler, also effectively enabling sequence memory to work on multidimensional input. These “neighborhoods” can be calculated no matter the number of dimensions in the input space.

### We don’t do it much today

Pretty much all our code examples do **not** use topology. One major reason is that each additional dimension added to the input space exponentially increases the processing time necessary to make inferences because of the neighborhood calculations involved. With no topology (or “global inhibition”), there is only one neighborhood to calculate. For each additional dimension of topology, that calculation will be increased by a factor of the # of columns in the SP.

Another reason we don’t use topology much in our examples is because we focused on scalar anomaly detection applications for several years. Those applications did not need topology to generate valuable anomaly indications, so we stepped away from it.

### Experiments

From my experiments with 2D topology, I have been limited to an input space of 64x64 bits, which is not much. Anything larger than that is prohibitively expensive to run on my laptop for visualizations.

Here is an example of topology. You can ignore the boost factors grid on the right.

The input space is a two-dimensional input (50x50 bits). There are 60 steps in the animation, and it repeats forever. The white dots on the grids are the active columns in the spatial pooler. The green / red gradient indicates active duty cycle for each column (on the center grid) and applied boost factors (on the right grid, which you can ignore).

As you can clearly see in the SP, the active columns have spatial relationships to each other. As the active duty cycle gradient shows, the majority of the active columns are within the center point of the animation, where most of the activity is occurring.

### Getting Predictions

I haven’t tried analyzing the predicted cells coming out of the temporal memory algorithm at this point, but I would like to as a part of this discussion. I assume I will need to use a classifier to do this, but I have not done it before. If anyone wants to help guide me in creating a classifier to turn predicted cells into input space bits, let me know.

### Beyond the Brain?

The topic of N-dimensional processing brings up an interesting idea. Cortical mini-columns in the brain are topologically restricted to 3 dimensions by the reality of our physical world. But there’s nothing keeping us from creating cortical structures in computers that can process any number of dimensional inputs. Just a thought.