Farama-Foundation / D4RL

A collection of reference environments for offline reinforcement learning
Apache License 2.0
1.29k stars 279 forks source link

Data Coverage in UMaze Env #7

Closed kpertsch closed 4 years ago

kpertsch commented 4 years ago

I visualized the state coverage of the provided data in the 2D maze environments. For the small UMaze environment the downloadable dataset seems to have a skewed data distribution where the agent never fully explores one of the sides: image The right shows a scatter plot of all positions in the downloaded dataset. Was there a bug in data generation or is this intended? (the data that is used to generate the GIF on the website does not seem to have this issue)

The other two maze environments seem to have full coverage of the maze: image

I slightly modified the visualized_dataset.py script for these plots:

import argparse
import d4rl
import gym

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument('--env_name', type=str, default='maze2d-umaze-v0')
    args = parser.parse_args()

    env = gym.make(args.env_name)

    dataset = env.get_dataset()
    if 'infos/qpos' not in dataset:
        raise ValueError('Only MuJoCo-based environments can be visualized')
    qpos = dataset['infos/qpos']
    qvel = dataset['infos/qvel']
    rewards = dataset['rewards']
    actions = dataset['actions']

    import matplotlib.pyplot as plt
    plt.scatter(qpos[:, 0], qpos[:, 1])
    plt.axis('equal')
    plt.show()
justinjfu commented 4 years ago

Looks like the wrong dataset got uploaded - this should be fixed! Delete the cached copy in ~/.d4rl/datasets and you can download a fresh copy.