From f2c5e5804c0efd64cad5232b70154d759bd0c72d Mon Sep 17 00:00:00 2001 From: Yuwei Date: Tue, 13 Jun 2017 12:01:03 -0700 Subject: [PATCH] fix missing actValue bug in SDR classifier --- src/nupic/bindings/algorithms.i | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nupic/bindings/algorithms.i b/src/nupic/bindings/algorithms.i index a7ebd2b123..bbcc4cda50 100644 --- a/src/nupic/bindings/algorithms.i +++ b/src/nupic/bindings/algorithms.i @@ -1278,11 +1278,13 @@ void forceRetentionOfImageSensorLiteLibrary(void) { if type(classification["actValue"]) in (int, float): actValueList = [classification["actValue"]] bucketIdxList = [classification["bucketIdx"]] + originalValueList = [classification["actValue"]] category = False elif classification["actValue"] is None: # Use the sentinel value so we know if it gets used in actualValues # returned. actValueList = [noneSentinel] + originalValueList = [noneSentinel] # Turn learning off this step. learn = False category = False @@ -1292,9 +1294,11 @@ void forceRetentionOfImageSensorLiteLibrary(void) { elif type(classification["actValue"]) is list: actValueList = classification["actValue"] bucketIdxList = classification["bucketIdx"] + originalValueList = classification["actValue"] category = False else: actValueList = [int(classification["bucketIdx"])] + originalValueList = [classification["actValue"]] bucketIdxList = [classification["bucketIdx"]] category = True @@ -1316,7 +1320,8 @@ void forceRetentionOfImageSensorLiteLibrary(void) { arrayResult["actualValues"][i] = self.valueToCategory.get(int( arrayResult["actualValues"][i]), classification["actValue"]) - self.valueToCategory[actValue] = classification["actValue"] + for i in range(len(actValueList)): + self.valueToCategory[actValueList[i]] = originalValueList[i] return arrayResult