Hello!
I have been perusing HTM literature (YouTube, GitHub, HTM school, BAMI papers, etc.) for awhile, and I am finally starting to “get my hands dirty”. I am working with a sequence of integers from OEIS as a way to understand how to implement the HTM code from htm.core. I know there is a pre-built scalar encoder, and I understand that this is pretty standard. However, some of the sequences in the encyclopedia have elements that are super large (order of magnitude can be 16+), and one may have to predict an integer that is higher in order of magnitude.
Given that the scalarEncoder requires a maximum value, it feels limited to me. I know other options include: using a hash function, according to Scott Purdy but I can’t seem to find an example of how to do this, the adaptive scalar or logarithmic encoders from the nupic repository, or a delta encoder (which, in the end, will probably be the encoder I want to use since predictions will be poor for these sequence values?). Adapting the code from nupic for htm.core source code seems more difficult to me, so I attempted to create my own encoder, and I’m here to double-check my thought process with others who have more experience than me. I believe I am following the features described in the literature for encoders.
Let the sample sequence be s = [1, 2, 5, 8158194850]. What I do to encode these integers is to create a matrix of zeroes that has as many rows as the longest number has digits (for s, that is 10 rows, and the last row will represent the ones place, the 9th row will represent the tens place, … ), and 10 columns (one for 0, 1, 2, 3, 4, …, 9; though if you want, say, 5 ones to represent the number 1, there would be 50 columns total). Then, for each element in s, a 10x10 matrix of 0’s is created. For s[0], the 10x10 matrix will have a 1 in the [10,1]-position of the matrix; s[1] will have a 1 in the [10,2]-position; but, s[3] will have a 1 in [10,0], [9,5], [8,8,], …, [2,5], [1,1], and [0,8] positions. Each matrix is embedded into a slightly longer matrix to account for predictions that may be higher in magnitude. The flattened version of this matrix is used to create the SDR data structure.
Any comments would be helpful! Please note I have superficial experience in ML, DL, DS, and the brain, so I may not fully understand certain jargon. Thank you again.