MCPcopy Create free account
hub / github.com/Mattdl/ContinualPrototypeEvolution / ResultTracker

Class ResultTracker

main.py:297–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295
296
297class ResultTracker(object):
298
299 def __init__(self):
300 self.task_idxs = [] # Track for every log which task it belongs to
301 self.tot_res_seqs = [] # per task accuracy up until the last task, Dim0= log_idx, Dim1= acc seq
302 self.tot_avg_accs = [] # avg performance on all test samples
303 self.task_res_seqs = [] # per task accuracy up until the current task
304 self.task_avg_accs = [] # avg accuracy on task seen so far
305 self.loss_history = {}
306
307 def update(self, current_task, tot_res_seq, tot_avg_acc, task_res_seq, task_avg_acc):
308 # Task-stamp
309 self.task_idxs.append(current_task)
310 # Total
311 self.tot_res_seqs.append(tot_res_seq)
312 self.tot_avg_accs.append(tot_avg_acc)
313 # Task
314 self.task_res_seqs.append(task_res_seq)
315 self.task_avg_accs.append(task_avg_acc)
316
317 def to_tensor(self):
318 self.task_idxs = torch.Tensor(self.task_idxs)
319 self.tot_res_seqs = torch.Tensor(self.tot_res_seqs)
320 self.tot_avg_accs = torch.Tensor(self.tot_avg_accs)
321
322 def get_all(self):
323 return [self.task_idxs,
324 self.tot_res_seqs,
325 self.tot_avg_accs,
326 self.task_res_seqs,
327 self.task_avg_accs]
328
329
330def life_experience(model, continuum, x_te, args):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected