Beispiel #1
0
    params['nll_loss_type'] = 'gaussian'
    train_data = SmallSynthData(args.data_path, 'train', params)
    val_data = SmallSynthData(args.data_path, 'val', params)

    model = model_builder.build_model(params)
    if args.mode == 'train':
        with train_utils.build_writers(args.working_dir) as (train_writer,
                                                             val_writer):
            train.train(model, train_data, val_data, params, train_writer,
                        val_writer)

    elif args.mode == 'eval':
        test_data = SmallSynthData(args.data_path, 'test', params)
        forward_pred = 50 - args.test_burn_in_steps
        test_mse = evaluate.eval_forward_prediction(model, test_data,
                                                    args.test_burn_in_steps,
                                                    forward_pred, params)
        path = os.path.join(args.working_dir,
                            args.error_out_name % args.test_burn_in_steps)
        np.save(path, test_mse.cpu().numpy())
        test_mse_1 = test_mse[0].item()
        test_mse_15 = test_mse[14].item()
        test_mse_25 = test_mse[24].item()
        print("FORWARD PRED RESULTS:")
        print("\t1 STEP: ", test_mse_1)
        print("\t15 STEP: ", test_mse_15)
        print("\t25 STEP: ", test_mse_25)

        f1, all_acc, acc_0, acc_1, acc_2, edges = eval_edges(
            model, val_data, params)
        print("Val Edge results:")
Beispiel #2
0
                              args.data_path,
                              'valid',
                              params,
                              num_in_path=False,
                              transpose_data=False,
                              max_len=40)

    model = model_builder.build_model(params)
    if args.mode == 'train':
        with train_utils.build_writers(args.working_dir) as (train_writer,
                                                             val_writer):
            train.train(model, train_data, val_data, params, train_writer,
                        val_writer)
    elif args.mode == 'eval':
        test_data = BasketballData(name,
                                   args.data_path,
                                   'test',
                                   params,
                                   num_in_path=False,
                                   transpose_data=False)
        test_cumulative_mse = evaluate.eval_forward_prediction(
            model, test_data, 40, 9, params)
        path = os.path.join(args.working_dir, args.error_out_name)
        np.save(path, test_cumulative_mse.cpu().numpy())
        test_mse_1 = test_cumulative_mse[0].item()
        test_mse_5 = test_cumulative_mse[4].item()
        test_mse_9 = test_cumulative_mse[8].item()
        print("FORWARD PRED RESULTS:")
        print("\t1 STEP:  ", test_mse_1)
        print("\t5 STEP: ", test_mse_5)
        print("\t9 STEP: ", test_mse_9)