def write_sim_tsc_metrics(self): #get data dict of all tsc in sim #where each tsc has dict of all metrics tsc_metrics = self.sim.get_tsc_metrics() #create file name and path for writing metrics data #now = datetime.datetime.now() #fname = str(self.idx)+'_'+str(now).replace(" ","-") fname = get_time_now() #write all metrics to correct path #path = 'metrics/'+str(self.args.tsc) path = 'metrics/'+str(self.args.tsc) for tsc in tsc_metrics: for m in tsc_metrics[tsc]: mpath = path + '/'+str(m)+'/'+str(tsc)+'/' check_and_make_dir(mpath) save_data(mpath+fname+'_'+str(self.eps)+'_.p', tsc_metrics[tsc][m]) travel_times = self.sim.get_travel_times() path += '/traveltime/' check_and_make_dir(path) save_data(path+fname+'.p', travel_times)
def save_weights(self, nettype, path, fname): check_and_make_dir(path) weights = self.get_weights('online') save_data(path + fname + '.p', weights)
def save_replays(self): check_and_make_dir(self.replay_fp) for _id in self.agent_ids: save_data(self.replay_fp+_id+'.p', [ _ for _ in self.exp_replay[_id]]) print('FINISHED SAVING REPLAY FOR '+str(_id))
def save_hp_performance(data, path, hp_str): check_and_make_dir(path) #name the return the unique hp string save_data(path+hp_str+'.p', data)