本文整理汇总了Python中streamhist.StreamHist.mean方法的典型用法代码示例。如果您正苦于以下问题:Python StreamHist.mean方法的具体用法?Python StreamHist.mean怎么用?Python StreamHist.mean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类streamhist.StreamHist
的用法示例。
在下文中一共展示了StreamHist.mean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_iterable
# 需要导入模块: from streamhist import StreamHist [as 别名]
# 或者: from streamhist.StreamHist import mean [as 别名]
def test_iterable():
h = StreamHist().update([p for p in range(4)])
assert h.total == 4
nested = [[1, 2, 3], 4, [5, 6], 7, 8, [9], [10, 11, 12], 13, 14, 15]
h = StreamHist().update(nested)
assert h.total == 15
assert h.mean() == 8
示例2: test_freeze
# 需要导入模块: from streamhist import StreamHist [as 别名]
# 或者: from streamhist.StreamHist import mean [as 别名]
def test_freeze():
points = 100000
h = StreamHist(freeze=500)
for p in make_normal(points):
h.update(p)
assert about(h.sum(0), points/2.0, points/50.0)
assert about(h.median(), 0, 0.05)
assert about(h.mean(), 0, 0.05)
assert about(h.var(), 1, 0.05)
示例3: test_median_mean
# 需要导入模块: from streamhist import StreamHist [as 别名]
# 或者: from streamhist.StreamHist import mean [as 别名]
def test_median_mean():
points = 10000
h = StreamHist()
for p in make_uniform(points):
h.update(p)
assert about(h.median(), 0.5, 0.05)
h = StreamHist()
for p in make_normal(points):
h.update(p)
assert about(h.median(), 0, 0.05)
assert about(h.mean(), 0, 0.05)
示例4: test_mean
# 需要导入模块: from streamhist import StreamHist [as 别名]
# 或者: from streamhist.StreamHist import mean [as 别名]
def test_mean():
points = 1001
h = StreamHist()
for p in range(points):
h.update(p)
assert h.mean() == (points-1)/2.0