示例#1
0
 def make_obs_ph(name):
     return U_b.BatchInput((64, 64), name=name)  #64 64
示例#2
0
            print("Average Reward is %s" %
                  (env.portfolio.average_profit_per_trade))

    if final_test:
        env.generate_summary_stats()


with U.make_session(8):
    # csv = "/home/adrian/Escritorio/polinex/EURUSD60.csv"
    csv = "data/EURUSD60.csv"

    env = gym.make('trading-v0')
    env.initialise_simulator(csv, trade_period=50, train_split=0.7)

    act, train, update_target, debug = deepq.build_train(
        make_obs_ph=lambda name: UT.BatchInput(env.observation_space.shape,
                                               name=name),
        q_func=model,
        num_actions=env.action_space.n,
        optimizer=tf.train.AdamOptimizer(learning_rate=5e-4),
    )
    try:
        UT.load_state('./test_model/test_model')
    except:
        print("nodata")

    replay_buffer = ReplayBuffer(50000)
    # Create the schedule for exploration starting from 1 (every action is random) down to
    # 0.02 (98% of actions are selected according to values predicted by the model).
    exploration = LinearSchedule(schedule_timesteps=10000,
                                 initial_p=1.0,
                                 final_p=0.02)
示例#3
0
 def make_obs_ph(name):
     return U_b.BatchInput((32, 32), name=name)
 def make_obs_ph(name):
     # return U.BatchInput((64, 64), name=name)
     return QU.BatchInput((64, 64), name=name)
示例#5
0
 def make_obs_ph(
     name
 ):  # Creates a placeholder for a batch of tensors of a given shape and dtype
     return U_b.BatchInput((16, 16), name=name)
 def make_obs_ph(name):
     return U2.BatchInput((16, 16), name=name)