I applied the tip and ran into another error. Since I ended up using Nupic Studio, I got distracted and haven't yet gotten around to resolving the error, though I would like to get to get back to it so that I can compare both tools. I ran the code below and got an error message that says:
.../nupic/nupic.cerebro2.server/py/cerebro2/patcher.py", line 113, in > patchedCompute > self.saveState(args[0], args[2]) > IndexError: tuple index out of range import numpyfrom nupic.encoders import ScalarEncoder On Mon, Oct 27, 2014 at 5:35 PM, Matthew Taylor <[email protected]> wrote: > Mika, did Chetan's tip to patch the SP before running Cerebro fix your > problem? > --------- > Matt Taylor > OS Community Flag-Bearer > Numenta > > > On Mon, Oct 20, 2014 at 9:15 PM, Chetan Surpur <[email protected]> > wrote: > > Ah, so you have to patch the SP > > before > > you run it. > > > > > > > > On Sun, Oct 19, 2014 at 4:12 PM, Mika Schiller <[email protected]> > > wrote: > >> > >> I'm trying to make the sp learn an input 20 times as you can see in the > >> code below. First I go into nupic.cerebro2.server directory and run > python > >> server.py 9090. Then I go into nupic.cerebro2 directory, then /static > and > >> then run python -m SimpleHTTPServer 8000. When I go to > >> http://localhost:8000/ I see the display, but no cells or anything. > I've > >> attached a screenshot of what I'm seeing. Any idea what might be going > on > >> here? Did I patch the sp correctly? Thanks! > >> > >>>> > >>>> from nupic.encoders import ScalarEncoder > >>>> > >>>> from nupic.research.spatial_pooler import SpatialPooler > >>>> > >>>> import numpy > >>>> > >>>> from patcher import Patcher > >>>> > >>>> > >>>> #create an encoder > >>>> > >>>> encoder = ScalarEncoder(n=22, w=3, minval=2.5, maxval=97.5, > >>>> clipInput=True, forced=True) > >>>> > >>>> > >>>> #create a spatial pooler > >>>> > >>>> sp = SpatialPooler(inputDimensions=(22), > >>>> > >>>> columnDimensions=(4,), potentialRadius=22, > numActiveColumnsPerInhArea=1, > >>>> > >>>> globalInhibition=True, synPermActiveInc=0.03, potentialPct=1.0) > >>>> > >>>> > >>>> > >>>> > >>>> #make sp learn input 20 times > >>>> > >>>> output = numpy.zeros((4,), dtype='int') > >>>> > >>>> for _ in xrange(20): > >>>> > >>>> sp.compute(encoder.encode(1), learn=True, activeArray=output) > >> > >> > >>>> > >>>> > >>>> > >>>> if __name__ == "__main__": > >>>> > >>>> > >>>> > >>>> Patcher().patchSP(sp) > >> > >> > >> <Screen Shot 2014-10-19 at 7.08.50 PM.png> > > > > > >
