org.deeplearning4j.rl4j.learning.HistoryProcessor Java Examples

The following examples show how to use org.deeplearning4j.rl4j.learning.HistoryProcessor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MalmoExample.java    From Java-Deep-Learning-Cookbook with MIT License 6 votes vote down vote up
public static void loadMalmoCliffWalk() throws MalmoConnectionError, IOException {
    MalmoEnv mdp = createMDP(10000);

    //load the previous agent
    DQNPolicy<MalmoBox> pol = DQNPolicy.load("cliffwalk_pixel.policy");

    //evaluate the agent
    double rewards = 0;
    for (int i = 0; i < 10; i++) {
        double reward = pol.play(mdp, new HistoryProcessor(MALMO_HPROC));
        rewards += reward;
        Logger.getAnonymousLogger().info("Reward: " + reward);
    }

    // Clean up
    mdp.close();

    Logger.getAnonymousLogger().info("average: " + rewards / 10);
}
 
Example #2
Source File: MalmoExample.java    From Java-Deep-Learning-Cookbook with MIT License 6 votes vote down vote up
public static void loadMalmoCliffWalk() throws MalmoConnectionError, IOException {
    MalmoEnv mdp = createMDP(10000);

    //load the previous agent
    DQNPolicy<MalmoBox> pol = DQNPolicy.load("cliffwalk_pixel.policy");

    //evaluate the agent
    double rewards = 0;
    for (int i = 0; i < 10; i++) {
        double reward = pol.play(mdp, new HistoryProcessor(MALMO_HPROC));
        rewards += reward;
        Logger.getAnonymousLogger().info("Reward: " + reward);
    }

    // Clean up
    mdp.close();

    Logger.getAnonymousLogger().info("average: " + rewards / 10);
}
 
Example #3
Source File: A3CDiscreteConv.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Deprecated
public A3CDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, IActorCritic IActorCritic,
                       HistoryProcessor.Configuration hpconf, A3CConfiguration conf) {

    super(mdp, IActorCritic, conf.toLearningConfiguration());
    this.hpconf = hpconf;
    setHistoryProcessor(hpconf);
}
 
Example #4
Source File: Policy.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public <O extends Encodable, AS extends ActionSpace<A>> double play(MDP<O, A, AS> mdp, HistoryProcessor.Configuration conf) {
    return play(mdp, new HistoryProcessor(conf));
}
 
Example #5
Source File: AsyncNStepQLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public AsyncNStepQLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, NetworkConfiguration netConf,
                                       HistoryProcessor.Configuration hpconf, AsyncQLearningConfiguration conf) {
    this(mdp, new DQNFactoryStdConv(netConf), hpconf, conf);
}
 
Example #6
Source File: AsyncNStepQLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public AsyncNStepQLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, NetworkConfiguration netConf,
                                       HistoryProcessor.Configuration hpconf, AsyncQLearningConfiguration conf, IDataManager dataManager) {
    this(mdp, new DQNFactoryStdConv(netConf), hpconf, conf, dataManager);
}
 
Example #7
Source File: AsyncNStepQLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public AsyncNStepQLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, DQNFactory factory,
                                       HistoryProcessor.Configuration hpconf, AsyncQLearningConfiguration conf) {
    this(mdp, factory.buildDQN(hpconf.getShape(), mdp.getActionSpace().getSize()), hpconf, conf);
}
 
Example #8
Source File: AsyncNStepQLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public AsyncNStepQLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, DQNFactory factory,
                                       HistoryProcessor.Configuration hpconf, AsyncQLearningConfiguration conf, IDataManager dataManager) {
    this(mdp, factory.buildDQN(hpconf.getShape(), mdp.getActionSpace().getSize()), hpconf, conf, dataManager);
}
 
Example #9
Source File: AsyncNStepQLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public AsyncNStepQLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, IDQN dqn,
                                       HistoryProcessor.Configuration hpconf, AsyncQLearningConfiguration conf) {
    super(mdp, dqn, conf);
    this.hpconf = hpconf;
    setHistoryProcessor(hpconf);
}
 
Example #10
Source File: AsyncNStepQLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public AsyncNStepQLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, IDQN dqn,
                                       HistoryProcessor.Configuration hpconf, AsyncQLearningConfiguration conf, IDataManager dataManager) {
    this(mdp, dqn, hpconf, conf);
    addListener(new DataManagerTrainingListener(dataManager));
}
 
Example #11
Source File: A3CDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public A3CDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, ActorCriticNetworkConfiguration netConf,
                       HistoryProcessor.Configuration hpconf, A3CLearningConfiguration conf) {
    this(mdp, new ActorCriticFactoryCompGraphStdConv(netConf), hpconf, conf);
}
 
Example #12
Source File: A3CDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public A3CDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, ActorCriticFactoryCompGraphStdConv.Configuration netConf,
                       HistoryProcessor.Configuration hpconf, A3CConfiguration conf) {
    this(mdp, new ActorCriticFactoryCompGraphStdConv(netConf.toNetworkConfiguration()), hpconf, conf);
}
 
Example #13
Source File: A3CDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public A3CDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, ActorCriticFactoryCompGraphStdConv.Configuration netConf,
                       HistoryProcessor.Configuration hpconf, A3CConfiguration conf, IDataManager dataManager) {
    this(mdp, new ActorCriticFactoryCompGraphStdConv(netConf.toNetworkConfiguration()), hpconf, conf, dataManager);
}
 
Example #14
Source File: A3CDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public A3CDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, ActorCriticFactoryCompGraph factory,
                       HistoryProcessor.Configuration hpconf, A3CLearningConfiguration conf) {
    this(mdp, factory.buildActorCritic(hpconf.getShape(), mdp.getActionSpace().getSize()), hpconf, conf);
}
 
Example #15
Source File: A3CDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public A3CDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, ActorCriticFactoryCompGraph factory,
                       HistoryProcessor.Configuration hpconf, A3CConfiguration conf) {
    this(mdp, factory.buildActorCritic(hpconf.getShape(), mdp.getActionSpace().getSize()), hpconf, conf);
}
 
Example #16
Source File: A3CDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public A3CDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, ActorCriticFactoryCompGraph factory,
                       HistoryProcessor.Configuration hpconf, A3CConfiguration conf, IDataManager dataManager) {
    this(mdp, factory.buildActorCritic(hpconf.getShape(), mdp.getActionSpace().getSize()), hpconf, conf, dataManager);
}
 
Example #17
Source File: A3CDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public A3CDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, IActorCritic IActorCritic,
                       HistoryProcessor.Configuration hpconf, A3CLearningConfiguration conf) {
    super(mdp, IActorCritic, conf);
    this.hpconf = hpconf;
    setHistoryProcessor(hpconf);
}
 
Example #18
Source File: A3CDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public A3CDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, IActorCritic actorCritic,
                       HistoryProcessor.Configuration hpconf, A3CConfiguration conf, IDataManager dataManager) {
    this(mdp, actorCritic, hpconf, conf);
    addListener(new DataManagerTrainingListener(dataManager));
}
 
Example #19
Source File: AsyncThread.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public void setHistoryProcessor(IHistoryProcessor.Configuration conf) {
    setHistoryProcessor(new HistoryProcessor(conf));
}
 
Example #20
Source File: QLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public QLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, NetworkConfiguration netConf,
                             HistoryProcessor.Configuration hpconf, QLearningConfiguration conf) {
    this(mdp, new DQNFactoryStdConv(netConf), hpconf, conf);
}
 
Example #21
Source File: QLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public QLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, DQNFactoryStdConv.Configuration netConf,
                             HistoryProcessor.Configuration hpconf, QLConfiguration conf) {
    this(mdp, new DQNFactoryStdConv(netConf.toNetworkConfiguration()), hpconf, conf);
}
 
Example #22
Source File: QLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public QLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, DQNFactoryStdConv.Configuration netConf,
                             HistoryProcessor.Configuration hpconf, QLConfiguration conf, IDataManager dataManager) {
    this(mdp, new DQNFactoryStdConv(netConf.toNetworkConfiguration()), hpconf, conf, dataManager);
}
 
Example #23
Source File: QLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public QLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, DQNFactory factory,
                             HistoryProcessor.Configuration hpconf, QLearningConfiguration conf) {
    this(mdp, factory.buildDQN(hpconf.getShape(), mdp.getActionSpace().getSize()), hpconf, conf);
}
 
Example #24
Source File: QLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public QLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, DQNFactory factory,
                             HistoryProcessor.Configuration hpconf, QLConfiguration conf) {
    this(mdp, factory.buildDQN(hpconf.getShape(), mdp.getActionSpace().getSize()), hpconf, conf);
}
 
Example #25
Source File: QLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public QLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, DQNFactory factory,
                             HistoryProcessor.Configuration hpconf, QLConfiguration conf, IDataManager dataManager) {
    this(mdp, factory.buildDQN(hpconf.getShape(), mdp.getActionSpace().getSize()), hpconf, conf, dataManager);
}
 
Example #26
Source File: QLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public QLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, IDQN dqn, HistoryProcessor.Configuration hpconf,
                             QLearningConfiguration conf) {
    super(mdp, dqn, conf, conf.getEpsilonNbStep() * hpconf.getSkipFrame());
    setHistoryProcessor(hpconf);
}
 
Example #27
Source File: QLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public QLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, IDQN dqn, HistoryProcessor.Configuration hpconf,
                             QLConfiguration conf) {
    super(mdp, dqn, conf.toLearningConfiguration(), conf.getEpsilonNbStep() * hpconf.getSkipFrame());
    setHistoryProcessor(hpconf);
}
 
Example #28
Source File: QLearningDiscreteConv.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Deprecated
public QLearningDiscreteConv(MDP<OBSERVATION, Integer, DiscreteSpace> mdp, IDQN dqn, HistoryProcessor.Configuration hpconf,
                             QLConfiguration conf, IDataManager dataManager) {
    this(mdp, dqn, hpconf, conf);
    addListener(new DataManagerTrainingListener(dataManager));
}