Skip to content

Commit

Permalink
add simple params
Browse files Browse the repository at this point in the history
  • Loading branch information
tae898 committed Apr 4, 2022
1 parent 6900e09 commit a211b04
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 5 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
We have released a challenging [OpenAI Gym](https://gym.openai.com/) 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:

```sh
pip install room-env
```
Expand Down Expand Up @@ -76,6 +77,44 @@ Consider there is only one agent. Then this is a POMDP, where *S*<sub>*t*</sub>

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:

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

Start with your own parameters:

```python
env_params = {
"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](https://github.com/tae898/explicit-memory) for an actual interaction with this environment.

## TODOs

1. Add unittests.
Expand Down
20 changes: 20 additions & 0 deletions room_env/data/top-human-names
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
James
Robert
John
Michael
William
David
Richard
Joseph
Thomas
Charles
Mary
Patricia
Jennifer
Linda
Elizabeth
Barbara
Susan
Jessica
Sarah
Karen
15 changes: 11 additions & 4 deletions room_env/envs/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class RoomEnv(gym.Env):

def __init__(
self,
semantic_knowledge_path: str = "../data/semantic-knowledge-small.json",
names_path: str = "../data/top-human-names-small",
room_size: str = "small",
weighting_mode: str = "highest",
probs: dict = {
"commonsense": 0.7,
Expand All @@ -72,8 +71,7 @@ def __init__(
Args
----
semantic_knowledge_path: path to the ConceptNet semantic knowledge.
names_path: path to the list of human names.
room_size: small or big
weighting_mode: Either "weighted" or "highest"
probs: the probabilities that govern the room environment changes.
limits: Limitation on the triples.
Expand All @@ -84,6 +82,15 @@ def __init__(
"""
super().__init__()
self.room_size = room_size
if self.room_size.lower() == "small":
semantic_knowledge_path = "../data/semantic-knowledge-small.json"
names_path = "../data/top-human-names-small"

elif self.room_size.lower() in ["large", "big"]:
semantic_knowledge_path = "../data/semantic-knowledge.json"
names_path = "../data/top-human-names"

logging.debug("Creating an Observation-Question-Answer generator object ...")
self.limits = limits

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = room_env
version = 0.1.2
version = 0.1.4
author = Taewoon Kim
author_email = [email protected]
description = The Room environment
Expand Down

0 comments on commit a211b04

Please sign in to comment.