Skip to content

Instantly share code, notes, and snippets.

@rcrowder
Created December 8, 2014 20:49
Show Gist options
  • Save rcrowder/ad457d05033ba3497aca to your computer and use it in GitHub Desktop.
Save rcrowder/ad457d05033ba3497aca to your computer and use it in GitHub Desktop.
hello_tp.py
C:\Python27\python.exe "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py" --multiproc --client 127.0.0.1 --port 50347 --file C:/github-Burt/nupic/examples/tp/hello_tp.py
pydev debugger: process 8148 is connecting
Connected to pydev debugger (build 135.1057)
This program shows how to access the Temporal Pooler directly by demonstrating
how to create a TP instance, train it with vectors, get predictions, and inspect
the state.
The code here runs a very simple version of sequence learning, with one
cell per column. The TP is trained with the simple sequence A->B->C->D->E
HOMEWORK: once you have understood exactly what is going on here, try changing
cellsPerColumn to 4. What is the difference between once cell per column and 4
cells per column?
PLEASE READ THROUGH THE CODE COMMENTS - THEY EXPLAIN THE OUTPUT IN DETAIL
-------- A -----------
Raw input vector
1111111111 0000000000 0000000000 0000000000 0000000000
All the active and predicted cells:
Inference Active state
1111111111 0000000000 0000000000 0000000000 0000000000
0000000000 0000000000 0000000000 0000000000 0000000000
Inference Predicted state
0000000000 0000000000 0000000000 0000000000 0000000000
0000000000 1111111111 0000000000 0000000000 0000000000
The following columns are predicted by the temporal pooler. This
should correspond to columns in the *next* item in the sequence.
[10 11 12 13 14 15 16 17 18 19]
-------- B -----------
Raw input vector
0000000000 1111111111 0000000000 0000000000 0000000000
All the active and predicted cells:
Inference Active state
0000000000 0000000000 0000000000 0000000000 0000000000
0000000000 1111111111 0000000000 0000000000 0000000000
Inference Predicted state
0000000000 0000000000 0000000000 0000000000 0000000000
0000000000 0000000000 1111111111 0000000000 0000000000
The following columns are predicted by the temporal pooler. This
should correspond to columns in the *next* item in the sequence.
[20 21 22 23 24 25 26 27 28 29]
-------- C -----------
Raw input vector
0000000000 0000000000 1111111111 0000000000 0000000000
All the active and predicted cells:
Inference Active state
0000000000 0000000000 0000000000 0000000000 0000000000
0000000000 0000000000 1111111111 0000000000 0000000000
Inference Predicted state
0000000000 0000000000 0000000000 0000000000 0000000000
0000000000 0000000000 0000000000 1111111111 0000000000
The following columns are predicted by the temporal pooler. This
should correspond to columns in the *next* item in the sequence.
[30 31 32 33 34 35 36 37 38 39]
-------- D -----------
Raw input vector
0000000000 0000000000 0000000000 1111111111 0000000000
All the active and predicted cells:
Inference Active state
0000000000 0000000000 0000000000 0000000000 0000000000
0000000000 0000000000 0000000000 1111111111 0000000000
Inference Predicted state
0000000000 0000000000 0000000000 0000000000 0000000000
0000000000 0000000000 0000000000 0000000000 1111111111
The following columns are predicted by the temporal pooler. This
should correspond to columns in the *next* item in the sequence.
[40 41 42 43 44 45 46 47 48 49]
-------- E -----------
Raw input vector
0000000000 0000000000 0000000000 0000000000 1111111111
All the active and predicted cells:
Inference Active state
0000000000 0000000000 0000000000 0000000000 0000000000
0000000000 0000000000 0000000000 0000000000 1111111111
Inference Predicted state
0000000000 0000000000 0000000000 0000000000 0000000000
0000000000 0000000000 0000000000 0000000000 0000000000
The following columns are predicted by the temporal pooler. This
should correspond to columns in the *next* item in the sequence.
[]
Process finished with exit code -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment