-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstats.py
31 lines (27 loc) · 1.38 KB
/
stats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class Statistics():
def __init__(self):
self.accuracies = {'train' : [], 'val' : []}
self.losses = {'train' : [], 'val' : []}
self.epochs = {'train' : [], 'val' : []}
self.times = {'train' : [], 'val' : []}
self.time_elapsed = -1
self.best_acc = -1
def __repr__(self):
accuraciesRepr = "Accuracy train = {}\n".format(self.accuracies['train'])
accuraciesRepr += "Accuracy val = {}\n".format(self.accuracies['val'])
lossesRepr = "Losses train = {}\n".format(self.losses['train'])
lossesRepr += "Losses val = {}\n".format(self.losses['val'])
epochsRepr = "Epochs train = {}\n".format(self.epochs['train'])
epochsRepr += "Epochs val = {}\n".format(self.epochs['val'])
timesRepr = "Times train = {}\n".format(self.times['train'])
timesRepr += "Times val = {}\n".format(self.times['val'])
timeElapsedRepr = "Time elapsed = {}\n".format(self.time_elapsed)
bestAccRepr = "Best acc = {}\n".format(self.best_acc)
return accuraciesRepr + lossesRepr + epochsRepr + timesRepr + timeElapsedRepr + bestAccRepr
class CNNParameters():
def __init__(self, resnet, batch_size, trained_layers, n_outputs, lr=0):
self.resnet = resnet
self.batch_size = batch_size
self.trained_layers = trained_layers
self.n_outputs = n_outputs
self.lr = lr