# See your HTM run: Stacks of time series

*This post is about HTM. It’s written mostly in pictures. The underlying code is discussed in
my previous posts.*

Seeing your HTM run is an art. You have to jump around and look at it from multiple angles.

These graphics are zoomable, just use your mouse wheel or gestures.

## A totally predictable sequence

Here the input data is a repeating sequence
`[0, 4, 8, ..., 92, 96, 0, 4, 8, ...]`

. This intentionally mimics the hotgym data set, using a period near 24.

There’s always some bursting, and it really starts freaking out around step 3000!

## A sine wave: mostly predictable

The input data is a sine wave that oscillates between 0 and 100, using a period of 8π. It, too, intentionally mimics the hotgym data set, using a period near 24.

Similar to before, the HTM has a sort of mid-life crisis after a few thousand timesteps.

## Actual data: kinda predictable

This is Numenta’s “hotgym” data set.

It’s interesting seeing how many segments have zero connected synapses at any given time. Now I want to sort them by segment ID and see whether these empty segments are recently created, or if some of them are old segments.

Also, notice that there’s a little burst of predictions toward the beginning. The burst ends at step 51. At this point, synapse permanences (and, hence, the number of connected synapses) are held constant for almost 50 timesteps. Meanwhile, potential synapses are added again and again.

## Not predictable: random integers

Now let’s look at the other extreme: random integers between 0 and 100.

A really big segment count. Sure enough, looking across these data streams, the number of segments increased as the predictability of the stream decreased.

## What am I looking at?

Oh, sorry, I should have explained.

These plots show:

- The input data
- The number of active and predicted columns
- The total distribution of dendrite segments, colored by their number of connected synapses
- The delta of dendrite segments
- The delta of connected synapses
- i.e. when a potential synapse’s permanence crosses the connected threshold

- The delta of potential synapses
- The number of synapses whose permanence was strengthened or weakened

The left-right dimension is time.

These plots focus on distal synapses, i.e. on the Temporal Memory.

I generated this data using nupic. Here’s my ipython notebook, feel free to tweak it.

## Next steps

- Combine this with Sanity. When you zoom in on individual timesteps, it’d be nice to be able to inspect the HTM at those timesteps.
- Using Sanity, show why the HTM receiving predictable data suddenly starts freaking out around timestep 3000.
- Allow different sort orders on the distal segments chart. I want to sort by segment ID to see whether that pool of segments-with-no-connected-synapses is filled with recently created segments, or if lots of them are old segments. Although the file size of this trace will be huge, because it means one column per segment per timestep.

*Thanks to Felix Andrews for providing feedback and insights.*