htm-community / htm.core

Actively developed Hierarchical Temporal Memory (HTM) community fork (continuation) of NuPIC. Implementation for C++ and Python
http://numenta.org
GNU Affero General Public License v3.0
151 stars 75 forks source link

Optimization for performance #3

Open breznak opened 6 years ago

breznak commented 6 years ago

Steps:

Requirements:

Considered toolkits:

Links:

breznak commented 6 years ago

Related #40 ASM removed

ctrl-z-9000-times commented 6 years ago

Performance improvements for Spatial Pooler Topology / Local Inhibition. I mentioned this on the numenta.org forum, and here I'm hoping to flesh out the idea more and communicate it with you all.

The spatial pooler with global inhibition works great as is; however local inhibition does not scale well because of the algorithms used. The differences between local and global inhibition happen at a large scale, but within a small (topological) area local and global inhibition do the same thing. Poor mans topology uses global inhibition to approximate local inhibition by making a spatial pooler with global inhibition for each area of local inhibition. In other words: Macro columns can use global inhibition and still have a large scale topology, by simulating a macro column for each topological area.

Pros:

Cons:

Implementation: A new C++ class which will create and maintain a list of SpatialPooler instances, one for each macro column. Macro columns are arranged in a uniform grid over the input space. Macro columns inputs are rectangular slices of the input space.

Example: The MNIST dataset would be a good example. Its fast, easy to solve, widely recognized, and its visual data which is pretty.

API: Similar to SpatialPooler class ...

...

breznak commented 5 years ago

153 is a huge performance win for SP (and all HTM, SP being the bottleneck)

Speeds as of now:

[ RUN      ] HelloSPTPTest.performance
starting test. DIM_INPUT=10000, DIM=2048, CELLS=10
EPOCHS = 5000
starting:  5000 iterations.Epoch = 4999
Anomaly = 0.488755
SP= 1571,1576,1581,1582,1583,1585,1586,1588,1589,1591
TP= 1571,1576,1581,1582,1583,1585,1586,1588,1589,1591
==============TIMERS============
Init:   0.071764
Random: 0.000457971
Encode: 0.0203253
SP:     0.680287
TP:     2.02909
AN:     1.33426
Total elapsed time = 4 seconds
[       OK ] HelloSPTPTest.performance (5430 ms)