numenta / nupic-legacy

Numenta Platform for Intelligent Computing is an implementation of Hierarchical Temporal Memory (HTM), a theory of intelligence based strictly on the neuroscience of the neocortex.
http://numenta.org/
GNU Affero General Public License v3.0
6.33k stars 1.56k forks source link

docs/examples/algo/complete-algo-example.py seems broken #3789

Closed ghost closed 6 years ago

ghost commented 6 years ago

The quick start example of Algorithms API shows very low predication rates.

$ python complete-algo-example.py
1-step:             21.2 (100.0%)
1-step:             21.2 (0.1996%)
1-step:             21.2 (0.1996%)
1-step:             21.2 (0.1996%)
1-step:             21.2 (0.1996%)
1-step:             23.5 (0.1996%)
1-step:             47.5 (0.1984%)
1-step:             47.5 (0.1883%)
1-step:             47.5 (0.1883%)
1-step:             47.5 (0.1883%)

The OPF version, for comparison.

$ python complete-opf-example.py
1-step:             21.2 (100.0%)      5-step:             21.2 (100.0%)
1-step:             16.4 (99.8%)       5-step:             16.4 (99.8%)
1-step:              4.7 (99.6%)       5-step:              4.7 (99.6%)
1-step:              4.7 (99.6%)       5-step:              4.7 (99.6%)
1-step:              4.6 (99.4%)       5-step:              4.6 (99.4%)
1-step:             23.5 (99.4%)       5-step:             23.5 (99.4%)
1-step:             47.5 (99.21%)      5-step:             47.5 (99.21%)
1-step:             45.4 (99.06%)      5-step:             45.4 (99.06%)
1-step:             46.1 (98.87%)      5-step:             46.1 (98.87%)
1-step:             41.5 (98.87%)      5-step:             41.5 (98.87%)
rhyolight commented 6 years ago

The OPF uses a different implementation of temporal memory than the one used in the Network API. We are aware of the discrepancy. For streaming anomaly detection applications, use the OPF. If you want to do more advanced configurations you should use the more biologically sound TemporalMemory algorithm used in the network example.

ghost commented 6 years ago

How does the different implementation produce 0.2% and 99% difference?

rhyolight commented 6 years ago

I can't really answer your question. The algorithm implementations are different. The one in the Network API is the one we are currently using for sensorimotor circuits. The one used in the OPF is a legacy model. It used non-biological tricks like backtracking to come up with better predictions. We wanted to keep our core algorithms biological, so we've taken another direction. The TM is not really just a temporal algorithm, you see. It also processes spatial patterns in other contexts.