MCPcopy Index your code
hub / github.com/Closed11/Unsupervised-Image-Classification / AverageMeter

Class AverageMeter

UIC/util.py:5–20  ·  view source on GitHub ↗

Computes and stores the average and current value

Source from the content-addressed store, hash-verified

3import logging
4
5class AverageMeter(object):
6 """ Computes and stores the average and current value """
7 def __init__(self):
8 self.reset()
9
10 def reset(self):
11 self.val = 0
12 self.avg = 0
13 self.sum = 0
14 self.count = 0
15
16 def update(self, val, n=1):
17 self.val = val
18 self.sum += val * n
19 self.count += n
20 self.avg = self.sum / self.count
21
22class LogFormatter():
23 def __init__(self):

Callers 4

trainFunction · 0.90
validateFunction · 0.90
trainFunction · 0.90
compute_labelsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected