Skip to main content

The Room environment

Project description

The Room environment

We have released a challenging OpenAI Gym compatible environment. The best strategy for this environment is to have both episodic and semantic memory systems. See the paper for more information.

This env is added to the PyPI server:

pip install room-env

Data collection

Data is collected from querying ConceptNet APIs. For simplicity, we only collect triples whose format is (head, AtLocation, tail). Here head is one of the 80 MS COCO dataset categories. This was kept in mind so that later on we can use images as well.

If you want to collect the data manually, then run below:

python collect_data.py

Otherwise, just use what's already there at room_env/data

How does this environment work?

The OpenAI-Gym-compatible Room environment is one big room with Npeople number of people who can freely move around. Each of them selects one object, among Nobjects, and places it in one of the Nlocations locations. Nagents number of agent(s) are also in this room. They can only observe one human placing an object, one at a time; x(t). At the same time, they are given one question about the location of an object; q(t). x(t) is given as a quadruple, (h(t),r(t),t(t),t), For example, <James’s laptop, AtLocation, James’s desk, 42> accounts for an observation where an agent sees James placing his laptop on his desk at t = 42. q(t) is given as a double, (h,r). For example, <Karen’s cat, AtLocation> is asking where Karen’s cat is located. If the agent answers the question correctly, it gets a reward of  + 1, and if not, it gets 0.

The reason why the observations and questions are given as RDF-triple-like format is two folds. One is that this structured format is easily readable / writable by both humans and machines. Second is that we can use existing knowledge graphs, such as ConceptNet .

To simplify the environment, the agents themselves are not actually moving, but the room is continuously changing. There are several random factors in this environment to be considered:

  1. With the chance of pcommonsense, a human places an object in a commonsense location (e.g., a laptop on a desk). The commonsense knowledge we use is from ConceptNet. With the chance of 1 − pcommonsense, an object is placed at a non-commonsense random location (e.g., a laptop on the tree).

  2. With the chance of pnew_location, a human changes object location.

  3. With the chance of pnew_object, a human changes his/her object to another one.

  4. With the chance of pswitch_person, two people switch their locations. This is done to mimic an agent moving around the room.

All of the four probabilities account for the Bernoulli distributions.

Consider there is only one agent. Then this is a POMDP, where St = (x(t), q(t)), At = (do something with x(t), answer q(t)), and Rt ∈ {0, 1}.

Currently there is no RL trained for this. We only have some heuristics. Take a look at the paper for more details.

Example

Start with default parameters:

env = gym.make("RoomEnv-v0")
env.reset()
env.step("foo")

Start with your own parameters:

env_params = {
    "room_size": "large",
    "weighting_mode": "highest",
    "probs": {
        "commonsense": 0.7,
        "new_location": 0.1,
        "new_object": 0.1,
        "switch_person": 0.5,
    },
    "limits": {
        "heads": None,
        "tails": None,
        "names": None,
        "allow_spaces": False,
    },
    "max_step": 1000,
    "disjoint_entities": True,
    "num_agents": 2,
}
env = gym.make("RoomEnv-v0", **env_params)
env.reset()
env.step("foo")

Take a look at this repo for an actual interaction with this environment.

TODOs

  1. Add unittests.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Run make test && make style && make quality in the root repo directory, to ensure code quality.
  4. Commit your Changes (git commit -m 'Add some AmazingFeature')
  5. Push to the Branch (git push origin feature/AmazingFeature)
  6. Open a Pull Request

Cite our work

DOI

Authors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

room_env-0.1.5.tar.gz (38.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page