Exemplo n.º 1
0
param_dict['hyper_params'] = {
    'len_global': len_global,
    'len_local': len_local,
    'neighbor_size': neighbor_size,
    'res': args.res,
    'cnn': args.cnn,
    'lr': args.lr,
    'BN': True if args.BN == 1 else False
}

if __name__ == '__main__':
    # ===============================================================
    # load data
    ts = time.time()
    data, mmn = utils.get_data(param_dict['dataset'], param_dict['len_global'],
                               param_dict['len_local'],
                               param_dict['neighbor_size'],
                               param_dict['data_choice'])

    if param_dict['dataset'] == 'bj_taxi':
        param_dict['train_data'] = [
            data[name] for name in [
                'g_vacation_train', 'g_hour_train', 'g_dayOfWeek_train',
                'g_weather_train', 'g_continuous_external_train',
                't_vacation_train', 't_hour_train', 't_dayOfWeek_train',
                't_weather_train', 't_continuous_external_train',
                'current_local_flow_train', 'stack_local_flow_train',
                'global_flow_train'
            ]
        ]
        param_dict['test_data'] = [
            data[name] for name in [
Exemplo n.º 2
0
                xgboost_outflow_ground_truth.append(outflow_ground + 1)

    xgboost_inflow_data = np.asarray(xgboost_inflow_data)
    xgboost_outflow_data = np.asarray(xgboost_outflow_data)
    xgboost_inflow_ground_truth = np.asarray(xgboost_inflow_ground_truth)
    xgboost_outflow_ground_truth = np.asarray(xgboost_outflow_ground_truth)

    return xgboost_inflow_data, xgboost_outflow_data, xgboost_inflow_ground_truth, xgboost_outflow_ground_truth

if __name__ == '__main__':

    # ===============================================================
    # load data
    ts = time.time()

    data, mmn = utils.get_data(dataset, len_global, len_local, neighbor_size, data_choice)

    print('\n Load data elapsed time : %.3f seconds\n' % (time.time() - ts))
    print('=' * 30)

    # ===============================================================
    # evaluate model
    ts = time.time()

    xgboost_inflow_data, xgboost_outflow_data, xgboost_inflow_ground_truth, xgboost_outflow_ground_truth = \
        get_data(data['predict_time_test'], neighbor_size, data['index_cut_test'])

    # special, add one model parameter for different external size, due to different dataset
    if dataset == 'bj_taxi':
        error_low = 1e-3
    else: