本文整理匯總了Python中nupic.research.TP.TP.getPredictedState方法的典型用法代碼示例。如果您正苦於以下問題:Python TP.getPredictedState方法的具體用法?Python TP.getPredictedState怎麽用?Python TP.getPredictedState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nupic.research.TP.TP
的用法示例。
在下文中一共展示了TP.getPredictedState方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: int
# 需要導入模塊: from nupic.research.TP import TP [as 別名]
# 或者: from nupic.research.TP.TP import getPredictedState [as 別名]
rms = audioop.rms(data,2)
decibel = int(20 * math.log10(rms))
# Turn our decibel number into a sparse distributed representation.
encoded = enc.encode(decibel)
# Add our encoded representation to the temporal pooler.
tp.compute(encoded, enableLearn = True, computeInfOutput = True)
# For the curious:
#tp.printCells()
#tp.printStates(printPrevious=False, printLearnState=False)
predictedCells = tp.getPredictedState()
decval = 0
if predictedCells.any():
decval = predictedCells.max(axis=1).nonzero()[0][-1]
# This is more correct, but seems wonky...
#decval = int(enc.decode(predictedCells.max(axis=1).
#nonzero()[0])[0]["[0:100]"][0][0][1])
print "%-48s %48s" % (colored(("*"*(decibel/2))[:38],"green"),
colored(("#"*(decval))[:38],"red"))
if b >= 20:
b = 0