htm-community / NAB

The Numenta Anomaly Benchmark
GNU Affero General Public License v3.0
3 stars 3 forks source link

HTM core detector pandaVis - Bugfix distal synapses #36

Closed Zbysekz closed 4 years ago

Zbysekz commented 4 years ago

Small bugfix, as result clicking on cells was causing exception

Zbysekz commented 4 years ago

Second addition, while this PR is already opened,

I discovered out big problems with order calls, that i have in all scripts (2D object recognition, hotgym example and this)

It spend literally hours to get the execution order right in my head and i must say that it was very hard. :tired_face:

But finally this is the right. I changed here the order of calls. Basically

  1. for first timestep get predictions
  2. calculate activeCells (winners..)
  3. get predictions for next time step
  4. Update panda data and block execution
  5. go to 2.
breznak commented 4 years ago

@Zbysekz can we continue your work here? Either by merging as is, or by revamping the API?

Zbysekz commented 4 years ago

@Zbysekz can we continue your work here? Either by merging as is, or by revamping the API?

I am now working on the new interface, baking data to the database. (already got working partially) This then would be much simplier, i am for cancelling this PR and then i start new one with the revamp when it will be ready.

breznak commented 4 years ago

I am now working on the new interface,

oh, that's great :+1: , I was worried the progress got lost.

Could you post an example (pseudocode) how the new API would be used in 3rd party? As in here?

Zbysekz commented 4 years ago

I think it will be like this: Method to define system structure same as now:

global variable for "pandaBaker" with database file specified pandaBaker = PandaBaker('/home/zz/Desktop/test1.db')

Filling data into dicts

        # fill up values
        pandaBaker.inputs["SL_Consumption"].stringValue = "consumption: {:.2f}".format(consumption)
        pandaBaker.inputs["SL_Consumption"].bits = consumptionBits.sparse

        pandaBaker.inputs["SL_TimeOfDay"].stringValue = record[0]
        pandaBaker.inputs["SL_TimeOfDay"].bits = dateBits.sparse

        pandaBaker.layers["SensoryLayer"].activeColumns = activeColumns.sparse
        pandaBaker.layers["SensoryLayer"].winnerCells = tm.getWinnerCells().sparse
        pandaBaker.layers["SensoryLayer"].predictiveCells = tm.getPredictiveCells().sparse
        pandaBaker.layers["SensoryLayer"].activeCells = tm.getActiveCells().sparse

And custom data for plots user configurable window like:

pandaBaker.customStream["myTagNameOfStream"] = value

I will probably use exactly this universality for raw anomaly: pandaBaker.customStream["SensoryLayer_rawAnomaly"] = rawAnomaly

I will try to make this as simple as possible