本文整理匯總了Python中nupic.encoders.adaptivescalar.AdaptiveScalarEncoder.setFieldStats方法的典型用法代碼示例。如果您正苦於以下問題:Python AdaptiveScalarEncoder.setFieldStats方法的具體用法?Python AdaptiveScalarEncoder.setFieldStats怎麽用?Python AdaptiveScalarEncoder.setFieldStats使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nupic.encoders.adaptivescalar.AdaptiveScalarEncoder
的用法示例。
在下文中一共展示了AdaptiveScalarEncoder.setFieldStats方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testSetFieldStats
# 需要導入模塊: from nupic.encoders.adaptivescalar import AdaptiveScalarEncoder [as 別名]
# 或者: from nupic.encoders.adaptivescalar.AdaptiveScalarEncoder import setFieldStats [as 別名]
def testSetFieldStats(self):
"""Test setting the min and max using setFieldStats"""
def _dumpParams(enc):
return (enc.n, enc.w, enc.minval, enc.maxval, enc.resolution,
enc._learningEnabled, enc.recordNum,
enc.radius, enc.rangeInternal, enc.padding, enc.nInternal)
sfs = AdaptiveScalarEncoder(name='scalar', n=14, w=5, minval=1, maxval=10,
periodic=False, forced=True)
reg = AdaptiveScalarEncoder(name='scalar', n=14, w=5, minval=1, maxval=100,
periodic=False, forced=True)
self.assertTrue(_dumpParams(sfs) != _dumpParams(reg), "Params should not be equal, "\
"since the two encoders were instantiated with different values.")
# set the min and the max using sFS to 1,100 respectively.
sfs.setFieldStats('this',{"this":{"min":1,"max":100}})
#Now the parameters for both should be the same
self.assertEqual(_dumpParams(sfs), _dumpParams(reg), "Params should now be equal, "\
"but they are not. sFS should be equivalent to initialization.")