naming htm sequences
So based on what Jeff Hawkins has said, it is useful to give sequences names. One use case is you are following a sequence, you know the name of that sequence, you miss a element or two, but since you know the sequence name you can resume that sequence. Heh. I don't actually know how to do that yet, but as a starting point, let's just name our sequences.
This is very easy. Just one line of code per sequence:
sequence-number |node 0: *> => |sequence-0>
sequence-number |node 1: *> => |sequence-1>
sequence-number |node 2: *> => |sequence-2>
And these two operators to see what we have:
which-sequence |*> #=> sequence-number drop-below[0.5] 50 similar-input[pattern] input-encode |_self>
sequence-table |*> #=> table[ket,which-sequence] rel-kets[encode] |>
which given these three sequences:
"count one two three four five six seven"
"Fibonacci one one two three five eight thirteen"
"factorial one two six twenty-four one-hundred-twenty"
produces this table:
sa: sequence-table
+--------------------+---------------------------------------------------+
| ket | which-sequence |
+--------------------+---------------------------------------------------+
| count | 1.00 sequence-0 |
| one | 1.00 sequence-0, 2.00 sequence-1, 1.00 sequence-2 |
| two | 1.00 sequence-0, 1.00 sequence-1, 1.00 sequence-2 |
| three | 1.00 sequence-0, 1.00 sequence-1 |
| four | 1.00 sequence-0 |
| five | 1.00 sequence-0, 1.00 sequence-1 |
| six | 1.00 sequence-0, 1.00 sequence-2 |
| seven | |
| Fibonacci | 1.00 sequence-1 |
| eight | 1.00 sequence-1 |
| thirteen | |
| factorial | 1.00 sequence-2 |
| twenty-four | 1.00 sequence-2 |
| one-hundred-twenty | |
+--------------------+---------------------------------------------------+
which is all nice and pretty! "count" is only in sequence-0, "one" is in sequence-0, twice in sequence-1, and in sequence-2. Similarly for the rest.
Notes:
1) we can't name the sequence for the final element in each sequence, since it is not defined with respect to the "pattern" operator. You really need to see the sw to understand why.
2) my "which-sequence" operator, as is typical for my language, is rather abstract. Just reading its definition, it is not totally clear how it works.
OK. Let's show how it works!
-- learn rules to keep in mind:
sequence-number |node 0: *> => |sequence-0>
sequence-number |node 1: *> => |sequence-1>
sequence-number |node 2: *> => |sequence-2>
input-encode |*> #=> append-column[50] encode |_self>
which-sequence |*> #=> sequence-number drop-below[0.5] 50 similar-input[pattern] input-encode |_self>
-- step through it given "count" as the input:
sa: similar-input[pattern] input-encode |count>
0.02|node 0: 0>
sa: 50 similar-input[pattern] input-encode |count>
1.0|node 0: 0>
sa: sequence-number 50 similar-input[pattern] input-encode |count>
1.0|sequence-0>
-- step through it given "one" as the input:
sa: similar-input[pattern] input-encode |one>
0.02|node 0: 1> + 0.02|node 1: 1> + 0.02|node 1: 2> + 0.02|node 2: 1>
sa: 50 similar-input[pattern] input-encode |one>
1.0|node 0: 1> + 1.0|node 1: 1> + 1.0|node 1: 2> + 1.0|node 2: 1>
sa: sequence-number 50 similar-input[pattern] input-encode |one>
1.0|sequence-0> + 2.0|sequence-1> + 1.0|sequence-2>
Notes:
1) in the last line, note that sequence-number is applied linearly. Hence:
sequence-number (1.0|node 1: 1> + 1.0|node 1: 2>) == 2.0|sequence-1>
2) we multiply by 50 since that is the column size, and append-column[k] and random-column[k] have 1/k similarity:
-- pick a number, say 13:
-- demonstrate similarity:
sa: ket-simm(append-column[13] encode |count>, random-column[13] encode |count>)
0.077|simm>
Home
previous: simple if then machine classifier
next: visualizing htm sequences
updated: 19/12/2016
by Garry Morrison
email: garry -at- semantic-db.org