本文整理汇总了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.")