Skip to content

Commit

Permalink
Added NAB detector layout; baking parameters as option
Browse files Browse the repository at this point in the history
  • Loading branch information
Zbysekz committed Jun 22, 2020
1 parent 7c8073c commit 5190273
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 18 deletions.
2 changes: 1 addition & 1 deletion HotgymExample/hotgym.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def main(parameters=default_parameters, argv=None, verbose=True):
return -accuracy[5]


#with this method, the structure for visualisation is defined
#with this method, the structure for visualization is defined
def BuildPandaSystem(sp,tm,consumptionBits_size,dateBits_size):

#we have two inputs connected to proximal synapses of Layer1
Expand Down
2 changes: 2 additions & 0 deletions PandaVis/bakeReader/bakeReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def BuildStructure(self):

# figure out how many iterations there are
self.cntIterations = self.LoadMaxIteration("inputs_"+next(iter(self.inputs)))# get first input
if self.cntIterations is None:
raise RuntimeError("Database contains no data!")
Log("Database contains data for "+str(self.cntIterations)+" iterations.")

def LoadDataStreams(self):
Expand Down
43 changes: 43 additions & 0 deletions dashVis/layouts/NAB htmcore detector.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{"plotsPerRow" : 3,
"streams": [{"name" : "rawAnomaly",
"type" : "line",
"yaxis": "anomaly"},
{"name" : "value",
"type" : "line",
"yaxis": "kWh"},
{"name" : "numberOfWinnerCells",
"type" : "line",
"yaxis": "cells"},

{"name" : "numberOfPredictiveCells",
"type" : "line",
"yaxis": "cells"},
{"name" : "valueInput_sparsity",
"type" : "line",
"yaxis": "%"},
{"name" : "dateInput_sparsity",
"type" : "line",
"yaxis": "%"},

{"name" : "Layer1_SP_overlap_metric",
"type" : "line",
"yaxis": "avg cells"},
{"name" : "Layer1_TM_overlap_metric",
"type" : "line",
"yaxis": "avg cells"},
{"name" : "Layer1_SP_activation_frequency",
"type" : "line",
"yaxis": "Hz"},
{"name" : "Layer1_TM_activation_frequency",
"type" : "line",
"yaxis": "Hz"},

{"name" : "Layer1_SP_entropy",
"type" : "line",
"yaxis": "entropy"},
{"name" : "Layer1_TM_entropy",
"type" : "line",
"yaxis": "entropy"}
]
}

File renamed without changes.
13 changes: 0 additions & 13 deletions dashVis/layouts/myLayout2.txt

This file was deleted.

8 changes: 4 additions & 4 deletions pandaBaker/pandaBaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
CPU_CORES = 4

class PandaBaker(object):
def __init__(self, databaseFilePath):
def __init__(self, databaseFilePath, bakeProximalSynapses = True, bakeDistalSynapses = True):
self.databaseFilePath = databaseFilePath
self.db = None

Expand All @@ -23,8 +23,8 @@ def __init__(self, databaseFilePath):
self.dataStreams = {} # can contain cDataStream instances

#flags what to bake
self.bakeProximalSynapses = True
self.bakeDistalSynapses = True
self.bakeProximalSynapses = bakeProximalSynapses
self.bakeDistalSynapses = bakeDistalSynapses

# for raw anomaly calculation
self.previousPredictiveCells = {} # dict storing predictive cells for previous timestamp for each layer
Expand Down Expand Up @@ -136,6 +136,6 @@ def Log(s):
print(str(s))
from datetime import datetime
dateStr=datetime.now().strftime('%Y-%m-%d %H:%M:%S')
with open("logs/pandaBaker.log","a") as file:
with open(os.path.join(os.getcwd(), "logs","pandaBaker.log"),"a") as file:
file.write(dateStr+" >> "+str(s)+"\n")

0 comments on commit 5190273

Please sign in to comment.