This commit is contained in:
wty-yy
2025-12-01 18:01:12 +08:00
parent a91ea5b62e
commit ad907089a8
24 changed files with 324 additions and 120 deletions

View File

@@ -0,0 +1,13 @@
class Average:
def __init__(self):
self.avg = 0.0
self.count = 0
def update(self, value: float):
self.avg += (value - self.avg) / (self.count + 1)
self.count += 1
return self.avg
@property
def mean(self):
return self.avg