Skip to content

Commit

Permalink
Merge pull request #1348 from ywcui1990/FixSDRClassifier
Browse files Browse the repository at this point in the history
fix missing actValue bug in SDR classifier
  • Loading branch information
scottpurdy authored Jun 13, 2017
2 parents d261cc6 + f2c5e58 commit cfea548
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/nupic/bindings/algorithms.i
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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

Expand Down

0 comments on commit cfea548

Please sign in to comment.