示例#1
0
                                        args.num_bits_per_vector + 1))
    eval_outputs = tf.placeholder(tf.float32,
                                  shape=(args.batch_size, None,
                                         args.num_bits_per_vector))
    eval_model = BuildEvalModel(eval_max_seq_len, eval_inputs, eval_outputs)

# training

convergence_on_target_task = None
convergence_on_multi_task = None
performance_on_target_task = None
performance_on_multi_task = None
generalization_from_target_task = None
generalization_from_multi_task = None
if args.task == 'copy':
    data_generator = CopyTaskData()
    target_point = args.max_seq_len
    curriculum_point = 1 if args.curriculum not in ('prediction_gain',
                                                    'none') else target_point
    progress_error = 1.0
    convergence_error = 0.1

    if args.curriculum == 'prediction_gain':
        exp3s = Exp3S(args.max_seq_len, 0.001, 0, 0.05)
elif args.task == 'associative_recall':
    data_generator = AssociativeRecallData()
    target_point = args.max_seq_len
    curriculum_point = 2 if args.curriculum not in ('prediction_gain',
                                                    'none') else target_point
    progress_error = 1.0
    convergence_error = 0.1
示例#2
0
    print "# parameters", np.sum([
        np.product([xi.value for xi in x.get_shape()])
        for x in tf.all_variables()
    ])

# training

convergence_on_target_task = None
convergence_on_multi_task = None
performance_on_target_task = None
performance_on_multi_task = None
generalization_from_target_task = None
generalization_from_multi_task = None
if args.task == 'copy':
    data_generator = CopyTaskData()
    target_point = args.max_seq_len
    curriculum_point = 1 if args.curriculum not in ('prediction_gain_bandit',
                                                    'prediction_gain_teacher',
                                                    'none') else target_point
    progress_error = 2.0
    convergence_error = 0.4

    if args.curriculum == 'prediction_gain_bandit':
        exp3s = Exp3S(args.max_seq_len, 0.001, 0, 0.05)
    if args.curriculum == 'prediction_gain_teacher':
        teacher = Teacher([i + 1 for i in range(args.max_seq_len)], 1, 2, 10)
elif args.task == 'repeat_copy':
    data_generator = RepeatCopyTaskData(args.max_seq_len, args.max_repeats)
    target_point = (args.max_seq_len, args.max_repeats)
    curriculum_point = (1, 1) if args.curriculum not in (
    performance_on_target_task = None
    performance_on_multi_task = None
    generalization_from_target_task = None
    generalization_from_multi_task = None
    multi_task_error = None
    target_task_error = None
    progress_error = None
    convergence_error = None
    target_point = None
    exp3s = None
    data_generator = None
    curriculum_point = None
    task = None

    if args.task == CopyTask.name:
        data_generator = CopyTaskData()
        target_point = args.max_seq_len
        curriculum_point = 1 if args.curriculum not in (
            'prediction_gain', 'none') else target_point
        progress_error = 1.0
        convergence_error = 0.1

        if args.curriculum == 'prediction_gain':
            exp3s = Exp3S(args.max_seq_len, 0.001, 0, 0.05)
    elif args.task == AssociativeRecallTask.name:
        data_generator = AssociativeRecallData()
        target_point = args.max_seq_len
        curriculum_point = 2 if args.curriculum not in (
            'prediction_gain', 'none') else target_point
        progress_error = 1.0
        convergence_error = 0.1