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.34k stars 1.56k forks source link

Adding an interface over TM implementations in TM Region #3658

Closed rhyolight closed 7 years ago

rhyolight commented 7 years ago

Fixes #3648

I needed to register the subclasses with the super class using abc because they did not play nice with the mixins going on in other places unless I it that way.

When I document these, I'll be sure to point out the inheritance in the docstrings in case Sphinx does not pick them up automatically.

rhyolight commented 7 years ago

Well those tests used to pass before I changed everything.

rhyolight commented 7 years ago

🤕 Any clue what is causing this error?

extensive_tm_cpp_test.py F
======================================================
Test: tests.integration.nupic.algorithms.extensive_tm_cpp_test.ExtensiveTemporalMemoryTestCPP.testB1 
Basic sequence learner.  M=1, N=100, P=1.
======================================================

Backend MacOSX is interactive backend. Turning interactive mode on.

tests/integration/nupic/algorithms/extensive_tm_test_base.py:211 (ExtensiveTemporalMemoryTestCPP.testB1)
self = <tests.integration.nupic.algorithms.extensive_tm_cpp_test.ExtensiveTemporalMemoryTestCPP testMethod=testB1>

    def testB1(self):
      """Basic sequence learner.  M=1, N=100, P=1."""
      self.init()

      numbers = self.sequenceMachine.generateNumbers(1, 100)
      sequence = self.sequenceMachine.generateFromNumbers(numbers)

>     self.feedTM(sequence)

extensive_tm_test_base.py:219: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
extensive_tm_test_base.py:589: in feedTM
    sequence, learn=learn, num=num)
../../../../src/nupic/support/unittesthelpers/abstract_temporal_memory_test.py:81: in feedTM
    self.tm.compute(pattern, learn=learn)
../../../../src/nupic/algorithms/monitor_mixin/temporal_memory_monitor_mixin.py:327: in compute
    self._mmTraces["predictedCells"].data.append(set(self.getPredictiveCells()))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nupic.support.unittesthelpers.abstract_temporal_memory_test.MonitoredTemporalMemory;  >

    def getPredictiveCells(self):
        """getPredictiveCells(self) -> PyObject *"""
>       return _algorithms.TemporalMemory_getPredictiveCells(self)
E       TypeError: in method 'TemporalMemory_getPredictiveCells', argument 1 of type 'nupic::algorithms::temporal_memory::TemporalMemory *'

/Users/mtaylor/Library/Python/2.7/lib/python/site-packages/nupic/bindings/algorithms.py:3723: TypeError
F
rhyolight commented 7 years ago

Giving up on this.