7c6e84bbf65bcbade78e78d6120ca0997dff7c28,examples/humanoid_sac.py,,experiment,#Any#Any#Any#Any#Any#,172

Before Change


    for n in range(n_epochs):
        core.learn(n_steps=n_steps, n_steps_per_fit=1)
        dataset = core.evaluate(n_episodes=n_episodes_test, render=True)
        print("Epoch: ", n,
              "  J: ", np.mean(compute_J(dataset, gamma)),
              "  Len_ep: ", int(np.round(np.mean(episodes_length(dataset))))
              )

    print("Press a button to visualize humanoid")
    input()
    core.evaluate(n_episodes=10, render=True)

After Change


def experiment(goal, use_muscles, n_epochs, n_steps, n_episodes_test):
    np.random.seed(1)

    logger = Logger("SAC", results_dir=None)
    logger.strong_line()
    logger.info("Humanoid Experiment, Algorithm: SAC")

    // MDP
    gamma = 0.99
    horizon = 2000
    mdp = create_mdp(gamma, horizon, goal, use_muscles=use_muscles)

    // Agent
    agent = create_SAC_agent(mdp)

    // normalization callback
    normalizer = MinMaxPreprocessor(mdp_info=mdp.info)

    // plotting callback
    plotter = PlotDataset(mdp.info)

    // Algorithm(with normalization and plotting)
    core = Core(agent, mdp, callback_step=plotter, preprocessors=[normalizer])
    dataset = core.evaluate(n_episodes=n_episodes_test, render=True)

    J = np.mean(compute_J(dataset, gamma))
    L = int(np.round(np.mean(episodes_length(dataset))))

    logger.epoch_info(0, J=J, episode_lenght=L)

    // training loop
    for n in trange(n_epochs, leave=False):
        core.learn(n_steps=n_steps, n_steps_per_fit=1)
        dataset = core.evaluate(n_episodes=n_episodes_test, render=True)

        J = np.mean(compute_J(dataset, gamma))
        L = int(np.round(np.mean(episodes_length(dataset))))


        logger.epoch_info(n+1, J=J, episode_lenght=L)

    logger.info("Press a button to visualize humanoid")
    input()
    core.evaluate(n_episodes=10, render=True)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 13

Instances


Project Name: AIRLab-POLIMI/mushroom
Commit Name: 7c6e84bbf65bcbade78e78d6120ca0997dff7c28
Time: 2021-01-11
Author: boris.ilpossente@hotmail.it
File Name: examples/humanoid_sac.py
Class Name:
Method Name: experiment


Project Name: AIRLab-POLIMI/mushroom
Commit Name: 7c6e84bbf65bcbade78e78d6120ca0997dff7c28
Time: 2021-01-11
Author: boris.ilpossente@hotmail.it
File Name: examples/humanoid_sac.py
Class Name:
Method Name: experiment


Project Name: AIRLab-POLIMI/mushroom
Commit Name: 7c6e84bbf65bcbade78e78d6120ca0997dff7c28
Time: 2021-01-11
Author: boris.ilpossente@hotmail.it
File Name: examples/pendulum_ddpg.py
Class Name:
Method Name: experiment


Project Name: AIRLab-POLIMI/mushroom
Commit Name: 7c6e84bbf65bcbade78e78d6120ca0997dff7c28
Time: 2021-01-11
Author: boris.ilpossente@hotmail.it
File Name: examples/pendulum_sac.py
Class Name:
Method Name: experiment