Problem with getFirstOnBit and season enconder

when i run the hierarchy-demo, this issue will occure after some time, at begaining, it can work, but some hours, like 4 hours later, it will cannt work.
uninstall nupic cannt solve this problem, but uninstall annconda and re-install can solve, but will occure again.
what’s the reason, i’m trying to set season enconder’s maxval

runfile('D:/Documents/Desktop/Delta', wdir='D:/Documents/Desktop')
Creating network
Running network
Writing output to: D:/Documents/Desktop\hierarchy-demo-output.csv
Traceback (most recent call last):

  File "<ipython-input-4-c7a7de638576>", line 1, in <module>
    runfile('D:/Documents/Desktop/Delta', wdir='D:/Documents/Desktop')

  File "C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\", line 710, in runfile
    execfile(filename, namespace)

  File "C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\", line 86, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "D:/Documents/Desktop/Delta", line 445, in <module>

  File "D:/Documents/Desktop/Delta", line 439, in runDemo
    runNetwork(network, numRecords, writer)

  File "D:/Documents/Desktop/Delta", line 369, in runNetwork

  File "C:\ProgramData\Anaconda2\lib\site-packages\nupic\engine\", line 667, in run, n)

  File "C:\ProgramData\Anaconda2\lib\site-packages\nupic\bindings\", line 1534, in run
    return _engine_internal.Network_run(self, n)

  File "C:\ProgramData\Anaconda2\lib\site-packages\nupic\bindings\regions\", line 184, in guardedCompute
    return self.compute(inputs, DictReadOnlyWrapper(outputs))

  File "C:\ProgramData\Anaconda2\lib\site-packages\nupic\regions\", line 377, in compute
    self.encoder.encodeIntoArray(data, outputs["dataOut"])

  File "C:\ProgramData\Anaconda2\lib\site-packages\nupic\encoders\", line 100, in encodeIntoArray
    encoder.encodeIntoArray(self._getInputValue(obj, name), output[offset:])

  File "C:\ProgramData\Anaconda2\lib\site-packages\nupic\encoders\", line 382, in encodeIntoArray
    encoder.encodeIntoArray(scalars[i], output[offset:])

  File "C:\ProgramData\Anaconda2\lib\site-packages\nupic\encoders\", line 426, in encodeIntoArray
    bucketIdx = self._getFirstOnBit(input)[0]

  File "C:\ProgramData\Anaconda2\lib\site-packages\nupic\encoders\", line 366, in _getFirstOnBit
    (str(input), str(self.minval), str(self.maxval)))

Exception: input (300) greater than periodic range (0 - 300)
1 Like

What is this “hierarchy-demo”? I don’t see any example source code in our repository with that name. If it is a script that you’ve written, can you describe what you are doing or share the code? Is the computer running out of memory or disk space?

I’m running the, and change the maxval of seasonencoder, my purpuse is to change it more easily.
but after some hours, the mistake will appear

 self.seasonEncoder = None
    if season != 0:
      # Ignore leapyear differences -- assume 366 days in a year
      # Radius = 91.5 days = length of season
      # Value is number of days since beginning of year (0 - 355)
      if hasattr(season, "__getitem__"):
        w = season[0]
        radius = season[1]
        **maxvall = season[2]**
        w = season
        radius = 91.5

      self.seasonEncoder = ScalarEncoder(w = w, minval=0, **maxval=maxvall**,
                                         radius=radius, periodic=True,
                                         name="season", forced=forced)
      self.seasonOffset = self.width
      self.width += self.seasonEncoder.getWidth()
      self.description.append(("season", self.seasonOffset))
      self.encoders.append(("season", self.seasonEncoder, self.seasonOffset))

What did you set maxval to? And what do you mean about your purpose? What are you trying to change more easily? The encoding? If you change the maxval it might not be doing seasonal encoding anymore. You’re changing the functionality of the encoder.

Yes, I want to change the season encoder to a adjustable length season encoder.
and want use more than once with diffrent length at one multiencoder.
Is this possiable?

Yes, it probably is possible, but you probably want to extend DateEncoder. Have your read our docs?

Actually, I don’t think you need to subclass anything, just provide a tuple to the constructor for season to set your own encoding width and bucket radius.

I try to change the maxval of seasonencoder, not the w, what’s the best solution? use scalaencoder directly?