Please help me

Hi

  1. I work with htm.core and run hotgym code several times, but my problem is that the SDR generated by the SP is different from the last time. Does anyone know what should I do?

  2. Is there a code for the NYC-taxi database in htm.core?

Hi Shiva,

  1. The SP uses a random number generator, so if you want to get exactly the same results every time you will need to set the RNG’s seed to a constant non-zero number (seed == zero is special and is replaced by the system’s time). Also, the TM and some of the encoders also use RNG’s.

  2. The code for the NYC-Taxi dataset is in the Numenta Anomaly Benchmark (NAB).

I wrote a toy program to run the NYC taxi dataset, but alas I have not tuned it to run well. Still, it should demonstrate how to load the dataset.
The file is here: NAB/nyc_taxi.py at master · htm-community/NAB · GitHub

HTH!

1 Like

Does this mean that in SP, the seed is another number (not zero)?
What about TM?

thanks for your quick response. can you please explain more?What exactly should I do, and what changes should I make so that the SP and TM parts are not random and their output is always a constant value?

For the encoder, add the following line:

scalarEncoderParams = RDSE_Parameters()
....
scalarEncoderParams.seed = 1234    # Add this line here
scalarEncoder = RDSE( scalarEncoderParams )

For the SP and TM, add the following keyword argument to the initialization:
seed = 1234,

It should look something like:

sp = SpatialPooler(
    inputDimensions            = (encodingWidth,),
    columnDimensions           = (spParams["columnCount"],),
    ....
    seed = 1234,
)
  tm = TemporalMemory(
    columnDimensions          = (spParams["columnCount"],),
    cellsPerColumn            = tmParams["cellsPerColumn"],
    ....
    seed = 1234,
)
2 Likes

Thanks a lot, I will check it.

Hi Katrin,

I just checked what the random seeds are set to by default using the following commands:
print(htm.encoders.rdse.RDSE_Parameters().seed)
help(htm.algorithms.SpatialPooler)
help(htm.algorithms.TemporalMemory)

Results:

  • The RDSE’s seed is 0
  • The SP’s seed is 1
  • The TM’s seed is 42

So as you can see, by default, the RDSE will use a random seed, while the SP and TM will use fixed & constant random seeds.

3 Likes

Thank you for your good answer
I have another question. How to binary the Hotgym database and then pass it to SP? Can you help me with how to write this code?