def run_dcrnn(args): with open(args.config_filename) as f: supervisor_config = yaml.load(f) if args.rep: supervisor_config['param']['rep'] = args.rep print('overwrite rep parameter with argument') graph_pkl_filename = supervisor_config['data'].get( 'graph_pkl_filename') sensor_ids, sensor_id_to_ind, adj_mx = load_graph_data( graph_pkl_filename) id_str = search_id(supervisor_config['alg'], supervisor_config['param']) print(id_str) model_dir = supervisor_config['train']['model_dir'] supervisor_config['train']['model_dir'] = os.path.join( model_dir, id_str) dset_dir = supervisor_config['data']['dataset_dir'] supervisor_config['data']['dataset_dir'] = os.path.join( dset_dir, id_str) assert supervisor_config['train']['epoch'] == -1 supervisor = DCRNNSupervisor(adj_mx=adj_mx, **supervisor_config) mean_score, outputs = supervisor.evaluate('val') output_dir = os.path.join(args.output_dir, id_str) os.makedirs(output_dir, exist_ok=True) output_filename = os.path.join(output_dir, 'dcrnn_val_predictions.npz') np.savez_compressed(output_filename, **outputs) print("MAE : {}".format(mean_score)) print('Predictions saved as {}.'.format(output_filename))
def main(args): with open(args.config_filename) as f: supervisor_config = yaml.load(f) graph_pkl_filename = supervisor_config['data'].get( 'graph_pkl_filename') sensor_ids, sensor_id_to_ind, adj_mx = load_graph_data( graph_pkl_filename) supervisor = DCRNNSupervisor(adj_mx=adj_mx, **supervisor_config) supervisor.train()
def run_dcrnn(args): with open(args.config_filename) as f: supervisor_config = yaml.load(f) graph_pkl_filename = supervisor_config['data'].get( 'graph_pkl_filename') sensor_ids, sensor_id_to_ind, adj_mx = load_graph_data( graph_pkl_filename) supervisor = DCRNNSupervisor(adj_mx=adj_mx, **supervisor_config) mean_score, outputs = supervisor.evaluate('test') np.savez_compressed(args.output_filename, **outputs) print("MAE : {}".format(mean_score)) print('Predictions saved as {}.'.format(args.output_filename))
def main(args): with open(args.config_filename) as f: supervisor_config = yaml.safe_load(f) graph_pkl_filename = supervisor_config['data'].get( 'graph_pkl_filename') adjtype = supervisor_config['model'].get('filter_type') # sensor_ids, sensor_id_to_ind, adj_mx = load_graph_data(graph_pkl_filename) sensor_ids, sensor_id_to_ind, adj_mx = utils.load_adj( graph_pkl_filename, adjtype) supervisor = DCRNNSupervisor(adj_mx=adj_mx, **supervisor_config) supervisor.train()
def main(args): print('main started with args: {}'.format(args)) with open(args.config_filename) as f: supervisor_config = yaml.load(f) add_prefix(args.train_local,supervisor_config,'base_dir') add_prefix(args.data_local,supervisor_config['data'],'dataset_dir') add_prefix(args.data_local,supervisor_config['data'],'graph_pkl_filename') add_prefix(args.data_local,supervisor_config['train'],'load_model_dir') graph_pkl_filename = supervisor_config['data'].get('graph_pkl_filename') sensor_ids, sensor_id_to_ind, adj_mx = load_graph_data(graph_pkl_filename) supervisor = DCRNNSupervisor(adj_mx=adj_mx, **supervisor_config) mean_score, outputs = supervisor.evaluate('test') np.savez_compressed(args.output_filename, **outputs) print("MAE : {}".format(mean_score)) print('Predictions saved as {}.'.format(args.output_filename))
def main(args): with open(args.config_filename) as f: supervisor_config = yaml.load(f) supervisor_config['train']['epoch'] = args.epoch if args.log_dir: supervisor_config['train']['log_dir'] = args.log_dir supervisor_config['data']['seq_len'] = supervisor_config['model'].get( 'seq_len') supervisor_config['data']['horizon'] = supervisor_config['model'].get( 'horizon') graph_pkl_filename = supervisor_config['data'].get( 'graph_pkl_filename') sensor_ids, sensor_id_to_ind, adj_mx = load_graph_data( graph_pkl_filename) supervisor = DCRNNSupervisor(adj_mx=adj_mx, **supervisor_config) supervisor.test()
def main(args): print('main started with args: {}'.format(args)) with open(args.config_filename) as f: supervisor_config = yaml.load(f) add_prefix(args.train_local, supervisor_config, 'base_dir') add_prefix(args.data_local, supervisor_config['data'], 'dataset_dir') add_prefix(args.data_local, supervisor_config['data'], 'graph_pkl_filename') print('using supervisor_config: {}'.format(supervisor_config)) graph_pkl_filename = supervisor_config['data'].get( 'graph_pkl_filename') sensor_ids, sensor_id_to_ind, adj_mx = load_graph_data( os.path.join(args.data_local, graph_pkl_filename)) supervisor = DCRNNSupervisor(adj_mx=adj_mx, **supervisor_config) supervisor.train()
def main(args): with open(args.config_filename) as f: supervisor_config = yaml.load(f) if args.rep: supervisor_config['param']['rep'] = args.rep print('overwrite rep parameter with argument') graph_pkl_filename = supervisor_config['data'].get('graph_pkl_filename') sensor_ids, sensor_id_to_ind, adj_mx = load_graph_data(graph_pkl_filename) id_str = search_id(supervisor_config['alg'], supervisor_config['param']) model_dir = supervisor_config['train']['model_dir'] supervisor_config['train']['model_dir'] = os.path.join(model_dir, id_str) dset_dir = supervisor_config['data']['dataset_dir'] supervisor_config['data']['dataset_dir'] = os.path.join(dset_dir, id_str) supervisor = DCRNNSupervisor(adj_mx=adj_mx, **supervisor_config) supervisor.train()
def main(args): with open(args.config_filename) as f: supervisor_config = yaml.load(f) graph_pkl_filename = supervisor_config['data'].get( 'graph_pkl_filename') sensor_ids, sensor_id_to_ind, adj_mx = load_graph_data( graph_pkl_filename) data_type = args.config_filename.split('/')[-1].split('.')[0].split( '_')[-1] #'bay' or 'la' supervisor = DCRNNSupervisor(data_type=data_type, LOAD_INITIAL=args.LOAD_INITIAL, adj_mx=adj_mx, **supervisor_config) if args.TEST_ONLY: supervisor.evaluate_test() else: supervisor.train()