gr-libs 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ import importlib.metadata
2
+ import warnings
3
+
4
+ def is_extra_installed(package: str, extra: str) -> bool:
5
+ """Check if an extra was installed for a given package."""
6
+ try:
7
+ # Get metadata for the installed package
8
+ dist = importlib.metadata.metadata(package)
9
+ requires = dist.get_all("Requires-Dist", []) # Dependencies listed in the package metadata
10
+ return any(extra in req for req in requires)
11
+ except importlib.metadata.PackageNotFoundError:
12
+ return False # The package is not installed
13
+
14
+ # Check if `gr_libs[minigrid]` was installed
15
+ for env in ["minigrid", "panda", "parking", "point_maze"]:
16
+ if is_extra_installed("gr_libs", f"gr_envs[{env}]"):
17
+ try:
18
+ importlib.import_module(f"gr_envs.{env}_scripts.envs")
19
+ except ImportError:
20
+ raise ImportError(f"gr_libs[{env}] was not installed, but gr_libs[{env}] requires it! if you messed with gr_libs installation, you can reinstall gr_libs.")
21
+ else:
22
+ warnings.warn(f"gr_libs[{env}] was not installed, skipping {env} imports.", RuntimeWarning)
@@ -168,8 +168,6 @@ class PandaProperty(GCEnvProperty):
168
168
 
169
169
 
170
170
  class ParkingProperty(GCEnvProperty):
171
- # def str_to_goal(self): # TODO not use it, goal is not a part of the env property anymore.
172
- # return self.name.split("-")[-2]
173
171
 
174
172
  def __init__(self, name):
175
173
  super().__init__(name)
@@ -13,11 +13,6 @@ if __name__ != "__main__":
13
13
  from gr_libs.ml.utils.format import random_subset_with_order
14
14
  from stable_baselines3 import SAC, PPO
15
15
  from stable_baselines3.common.vec_env import DummyVecEnv
16
- from gr_envs.custom_env_wrappers.flat_obs_wrapper import CombineAchievedGoalAndObservationWrapper
17
-
18
- # important for registration of envs! do not remove lad
19
- import gr_envs.maze_scripts.envs.maze
20
- import gr_envs.highway_env_scripts.envs.parking_env
21
16
  from gr_libs.ml.utils import device
22
17
 
23
18
  # built-in python modules
@@ -32,13 +27,15 @@ def create_vec_env(kwargs):
32
27
  return DummyVecEnv([lambda: env])
33
28
 
34
29
  def change_goal_to_specific_desired(obs, desired):
35
- try:
36
- if desired!=None: obs['desired_goal'] = desired
37
- except Exception as e:
38
- try:
39
- if all(desired!=None): obs['desired_goal'] = desired
40
- except Exception as e:
41
- if all([desiredy!=None for desiredish in desired for desiredy in desiredish]): obs['desired_goal'] = desired
30
+ if desired is not None:
31
+ obs['desired_goal'] = desired
32
+ # try:
33
+ # if desired!=None: obs['desired_goal'] = desired
34
+ # except Exception as e:
35
+ # try:
36
+ # if all(desired!=None): obs['desired_goal'] = desired
37
+ # except Exception as e:
38
+ # if all([desiredy!=None for desiredish in desired for desiredy in desiredish]): obs['desired_goal'] = desired
42
39
 
43
40
 
44
41
  NETWORK_SETUP = {
@@ -265,6 +262,7 @@ class DeepRLAgent():
265
262
  assert fig_path == None, "You can't specify a vid path when you don't even save the figure."
266
263
  else:
267
264
  assert fig_path != None, "You need to specify a vid path when you save the figure."
265
+ # The try-except is a bug fix for the env not being reset properly in panda. If someone wants to check why and provide a robust solution they're welcome.
268
266
  try:
269
267
  obs = self.env.reset()
270
268
  change_goal_to_specific_desired(obs, desired)
@@ -103,7 +103,6 @@ class Graml(LearningRecognizer):
103
103
  self.plans_dict[f"{true_goal}_true"] = true_sequence
104
104
 
105
105
  with open(embeddings_path + f'/{true_goal}_{percentage}_plans_dict.pkl', 'wb') as plans_file:
106
- # TODO erase AGENT_BASED macros
107
106
  to_dump = {}
108
107
  for goal, obss in self.plans_dict.items():
109
108
  if goal == f"{true_goal}_true":
@@ -243,7 +242,7 @@ class GCGraml(Graml, GaAdaptingRecognizer):
243
242
  if num_timesteps != None: kwargs["num_timesteps"] = num_timesteps
244
243
  gc_agent = self.rl_agent_type(**kwargs)
245
244
  gc_agent.learn()
246
- self.agents.append(ContextualAgent(problem_name=self.env_prop.name, problem_goal="general", agent=gc_agent)) # TODO change
245
+ self.agents.append(ContextualAgent(problem_name=self.env_prop.name, problem_goal="general", agent=gc_agent))
247
246
 
248
247
  def generate_sequences_library(self, goal: str) -> List[List[Tuple[np.ndarray, np.ndarray]]]:
249
248
  problem_name = self.env_prop.goal_to_problem_str(goal)
@@ -18,7 +18,7 @@ class Recognizer(ABC):
18
18
  def inference_phase(self, inf_sequence, true_goal, percentage) -> str:
19
19
  pass
20
20
 
21
- class LearningRecognizer(Recognizer): # TODO add a class diagram with the inheritance of all calsses
21
+ class LearningRecognizer(Recognizer):
22
22
  def __init__(self, *args, **kwargs):
23
23
  super().__init__(*args, **kwargs)
24
24
 
@@ -26,7 +26,7 @@ class LearningRecognizer(Recognizer): # TODO add a class diagram with the inheri
26
26
  self.original_train_configs = train_configs
27
27
 
28
28
  # a recognizer that needs to train agents for every new goal as part of the goal adaptation phase (that's why it needs dynamic train configs)
29
- class GaAgentTrainerRecognizer(Recognizer): # TODO add a class diagram with the inheritance of all calsses
29
+ class GaAgentTrainerRecognizer(Recognizer):
30
30
  def __init__(self, *args, **kwargs):
31
31
  super().__init__(*args, **kwargs)
32
32
 
@@ -37,7 +37,7 @@ class GaAgentTrainerRecognizer(Recognizer): # TODO add a class diagram with the
37
37
  def domain_learning_phase(self, base_goals: List[str], train_configs: List):
38
38
  super().domain_learning_phase(base_goals, train_configs)
39
39
 
40
- class GaAdaptingRecognizer(Recognizer): # TODO add a class diagram with the inheritance of all calsses
40
+ class GaAdaptingRecognizer(Recognizer):
41
41
  def __init__(self, *args, **kwargs):
42
42
  super().__init__(*args, **kwargs)
43
43
 
@@ -0,0 +1,61 @@
1
+ # Recognizer Module Documentation
2
+
3
+ This document provides an overview of the recognizer module, including its class hierarchy and instructions for adding a new class of recognizer.
4
+
5
+ ## Class Hierarchy
6
+
7
+ The recognizer module consists of an abstract base class `Recognizer` and several derived classes, each implementing specific behaviors. The main classes are:
8
+
9
+ 1. **Recognizer (Abstract Base Class)**
10
+ - `inference_phase()` (abstract method)
11
+
12
+ 2. **LearningRecognizer (Extends Recognizer)**
13
+ - `domain_learning_phase()`
14
+
15
+ 3. **GaAgentTrainerRecognizer (Extends Recognizer)**
16
+ - `goals_adaptation_phase()` (abstract method)
17
+ - `domain_learning_phase()`
18
+
19
+ 4. **GaAdaptingRecognizer (Extends Recognizer)**
20
+ - `goals_adaptation_phase()` (abstract method)
21
+
22
+ 5. **GRAsRL (Extends Recognizer)**
23
+ - Implements `goals_adaptation_phase()`
24
+ - Implements `inference_phase()`
25
+
26
+ 6. **Specific Implementations:**
27
+ - `Graql (Extends GRAsRL, GaAgentTrainerRecognizer)`
28
+ - `Draco (Extends GRAsRL, GaAgentTrainerRecognizer)`
29
+ - `GCDraco (Extends GRAsRL, LearningRecognizer, GaAdaptingRecognizer)`
30
+ - `Graml (Extends LearningRecognizer)`
31
+
32
+ ## How to Add a New Recognizer Class
33
+
34
+ To add a new class of recognizer, follow these steps:
35
+
36
+ 1. **Determine the Type of Recognizer:**
37
+ - Will it require learning? Extend `LearningRecognizer`.
38
+ - Will it adapt goals dynamically? Extend `GaAdaptingRecognizer`.
39
+ - Will it train agents for new goals? Extend `GaAgentTrainerRecognizer`.
40
+ - Will it involve RL-based recognition? Extend `GRAsRL`.
41
+
42
+ 2. **Define the Class:**
43
+ - Create a new class that extends the appropriate base class(es).
44
+ - Implement the required abstract methods (`inference_phase()`, `goals_adaptation_phase()`, etc.).
45
+
46
+ 3. **Initialize the Recognizer:**
47
+ - Ensure proper initialization by calling `super().__init__(*args, **kwargs)`.
48
+ - Set up any necessary agent storage or evaluation functions.
49
+
50
+ 4. **Implement Core Methods:**
51
+ - Define how the recognizer processes inference sequences.
52
+ - Implement learning or goal adaptation logic if applicable.
53
+
54
+ 5. **Register the Recognizer:**
55
+ - Ensure it integrates properly with the existing system by using the correct `domain_to_env_property()`.
56
+
57
+ 6. **Test the New Recognizer:**
58
+ - Run experiments to validate its behavior.
59
+ - Compare results against existing recognizers to ensure correctness.
60
+
61
+ By following these steps, you can seamlessly integrate a new recognizer into the framework while maintaining compatibility with the existing structure.
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: gr_libs
3
+ Version: 0.1.5
4
+ Summary: Package with goal recognition frameworks baselines
5
+ Author: Ben Nageris
6
+ Author-email: Matan Shamir <matan.shamir@live.biu.ac.il>, Osher Elhadad <osher.elhadad@live.biu.ac.il>
7
+ License-Expression: MIT
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: gr_envs
13
+ Requires-Dist: dill
14
+ Requires-Dist: opencv-python
15
+ Requires-Dist: tensorboardX
16
+ Requires-Dist: torchvision
17
+ Requires-Dist: rl_zoo3
18
+ Requires-Dist: stable_baselines3[extra]
19
+ Requires-Dist: sb3_contrib
20
+ Provides-Extra: minigrid
21
+ Requires-Dist: gr_envs[minigrid]; extra == "minigrid"
22
+ Provides-Extra: highway
23
+ Requires-Dist: gr_envs[highway]; extra == "highway"
24
+ Provides-Extra: maze
25
+ Requires-Dist: gr_envs[maze]; extra == "maze"
26
+ Provides-Extra: panda
27
+ Requires-Dist: gr_envs[panda]; extra == "panda"
28
+
29
+ # GRLib
30
+ GRLib is a Python package that implements Goal Recognition (GR) algorithms using Markov Decision Processes (MDPs) to model decision-making processes. These implementations adhere to the Gymnasium API. All agents in these algorithms interact with environments registered to the Gym API as part of the initialization process of the `gr_envs` package, on which GRLib depends. More details on `gr_envs` can be found at: [GR Envs Repository](https://github.com/MatanShamir1/GREnvs).
31
+
32
+ ## Setup
33
+
34
+ **Note:** If you are using Windows, use Git Bash for the following commands. Otherwise, any terminal or shell will work.
35
+
36
+ `gr_libs` depends on `gr_envs`, which registers a set of Gym environments. Ensure your Python environment is set up with Python >= 3.11.
37
+
38
+ ### Setting Up a Python Environment (if needed)
39
+ #### Using Pip
40
+ 1. **Find Your Python Installation:**
41
+ To locate your Python 3.12 executable, run:
42
+ ```sh
43
+ py -3.12 -c "import sys; print(sys.executable)"
44
+ ```
45
+ 2. **Create a New Virtual Environment:**
46
+ Using the path found above, create a new empty venv:
47
+ ```sh
48
+ C:/Users/path/to/Programs/Python/Python312/python.exe -m venv test_env
49
+ ```
50
+ 3. **Activate the Virtual Environment:**
51
+ ```sh
52
+ source test_env/Scripts/activate
53
+ ```
54
+ 4. **Verify the Active Environment:**
55
+ Since there is no direct equivalent to `conda env list`, you can check your active environment via:
56
+ ```sh
57
+ echo $VIRTUAL_ENV
58
+ ```
59
+
60
+ #### Using Conda
61
+ If you prefer using Conda, follow these steps:
62
+
63
+ 1. **Create a New Conda Environment:**
64
+ Replace `3.12` with your desired Python version if necessary.
65
+ ```sh
66
+ conda create -n new_env python=3.12
67
+ ```
68
+ 2. **Activate the Environment:**
69
+ ```sh
70
+ conda activate new_env
71
+ ```
72
+
73
+
74
+ ### Upgrade Basic Package Management Modules:
75
+ Run the following command (replace `/path/to/python.exe` with the actual path):
76
+ ```sh
77
+ /path/to/python.exe -m pip install --upgrade pip setuptools wheel versioneer
78
+ ```
79
+ ### Install the `GoalRecognitionLibs` Package:
80
+ The extras install the custom environments defined in `gr_envs`.
81
+ (For editable installation, add the `-e` flag by cloning the repo and cd'ing to it https://github.com/MatanShamir1/GRLib.git)
82
+ - **Minigrid Environment:**
83
+ ```sh
84
+ pip install gr_libs[minigrid]
85
+ ```
86
+ - **Highway Environment (Parking):**
87
+ ```sh
88
+ pip install gr_libs[highway]
89
+ ```
90
+ - **Maze Environment (Point-Maze):**
91
+ ```sh
92
+ pip install gr_libs[maze]
93
+ ```
94
+ - **Panda Environment:**
95
+ ```sh
96
+ pip install gr_libs[panda]
97
+ ```
98
+ (For editable installation, add the `-e` flag.)
99
+ ```sh
100
+ cd /path/to/clone/of/GoalRecognitionLibs
101
+ pip install -e .
102
+ ```
103
+
104
+ ## Issues & Troubleshooting
105
+
106
+ For any issues or troubleshooting, please refer to the repository's issue tracker.
107
+
108
+ ## Usage Guide
109
+
110
+ After installing GRLib, you will have access to custom Gym environments, allowing you to set up and execute an Online Dynamic Goal Recognition (ODGR) scenario with the algorithm of your choice.
111
+
112
+ Tutorials demonstrating basic ODGR scenarios is available in the sub-package `tutorials`. These tutorials walk through the initialization and deployment process, showcasing how different GR algorithms adapt to emerging goals in various Gym environments.
113
+
114
+ ### Method 1: Writing a Custom Script
115
+
116
+ 1. **Create a recognizer**
117
+
118
+ Specify the domain name and specific environment for the recognizer, effectively telling it the domain theory - the collection of states and actions in the environment.
119
+
120
+ ```python
121
+ recognizer = Graql(
122
+ domain_name="minigrid",
123
+ env_name="MiniGrid-SimpleCrossingS13N4"
124
+ )
125
+ ```
126
+
127
+ 2. **Domain Learning Phase** (For GRAQL)
128
+
129
+ GRAQL does not accumulate information about the domain or engage in learning activities during this phase.
130
+ Other algorithms don't require any data for the phase and simply use what's provided in their intialization: the domain and environment specifics, excluding the possible goals.
131
+
132
+ 3. **Goal Adaptation Phase**
133
+
134
+ The recognizer receives new goals and corresponding training configurations. GRAQL trains goal-directed agents and stores their policies for inference.
135
+
136
+ ```python
137
+ recognizer.goals_adaptation_phase(
138
+ dynamic_goals=[(11,1), (11,11), (1,11)],
139
+ dynamic_train_configs=[(QLEARNING, 100000) for _ in range(3)] # For expert sequence generation
140
+ )
141
+ ```
142
+
143
+ 4. **Inference Phase**
144
+
145
+ This phase generates a partial sequence from a trained agent, simulating suboptimal behavior with Gaussian noise.
146
+
147
+ ```python
148
+ actor = TabularQLearner(
149
+ domain_name="minigrid",
150
+ problem_name="MiniGrid-SimpleCrossingS13N4-DynamicGoal-11x1-v0",
151
+ algorithm=QLEARNING,
152
+ num_timesteps=100000
153
+ )
154
+ actor.learn()
155
+ full_sequence = actor.generate_observation(
156
+ action_selection_method=stochastic_amplified_selection,
157
+ random_optimalism=True # Adds noise to action values
158
+ )
159
+ partial_sequence = random_subset_with_order(full_sequence, int(0.5 * len(full_sequence)), is_consecutive=False)
160
+ closest_goal = recognizer.inference_phase(partial_sequence, (11,1), 0.5)
161
+ ```
162
+
163
+ 5. **Evaluate the result**
164
+
165
+ ```python
166
+ print(f"Closest goal returned by Graql: {closest_goal}\nActual goal actor aimed towards: (11, 1)")
167
+ ```
168
+
169
+ ### Method 2: Using a Configuration File
170
+
171
+ The `consts.py` file contains predefined ODGR problem configurations. You can use existing configurations or define new ones.
172
+
173
+ To execute a single task using the configuration file:
174
+ ```sh
175
+ python odgr_executor.py --recognizer MCTSBasedGraml --domain minigrid --task L1 --minigrid_env MinigridSimple
176
+ ```
177
+
178
+ ## Supported Algorithms
179
+
180
+ Successors of algorithms that don't differ in their specifics are added in parentheses after the algorithm name. For example, since GC-DRACO and DRACO share the same column values, they're written on one line as DRACO (GC).
181
+
182
+ | **Algorithm** | **Supervised** | **Reinforcement Learning** | **Discrete States** | **Continuous States** | **Discrete Actions** | **Continuous Actions** | **Model-Based** | **Model-Free** | **Action-Only** |
183
+ |--------------|--------------|------------------------|------------------|------------------|--------------|--------------|--------------|--------------|--------------|
184
+ | GRAQL | ❌ | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | ❌ |
185
+ | DRACO (GC) | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ |
186
+ | GRAML (GC, BG) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
187
+
188
+ ## Supported Domains
189
+
190
+ | **Domain** | **Action Space** | **State Space** |
191
+ |------------|----------------|----------------|
192
+ | Minigrid | Discrete | Discrete |
193
+ | PointMaze | Continuous | Continuous |
194
+ | Parking | Continuous | Continuous |
195
+ | Panda | Continuous | Continuous |
196
+
197
+ ## Running Experiments
198
+
199
+ The repository provides benchmark domains and scripts for analyzing experimental results. The `scripts` directory contains tools for processing and visualizing results.
200
+
201
+ 1. **`analyze_results_cross_alg_cross_domain.py`**
202
+ - Runs without arguments.
203
+ - Reads data from `get_experiment_results_path` (e.g., `dataset/graml/minigrid/continuing/.../experiment_results.pkl`).
204
+ - Generates plots comparing algorithm performance across domains.
205
+
206
+ 2. **`generate_task_specific_statistics_plots.py`**
207
+ - Produces task-specific accuracy and confidence plots.
208
+ - Generates a confusion matrix displaying confidence levels.
209
+ - Example output paths:
210
+ - `figures/point_maze/obstacles/graql_point_maze_obstacles_fragmented_stats.png`
211
+ - `figures/point_maze/obstacles/graml_point_maze_obstacles_conf_mat.png`
@@ -8,8 +8,8 @@ evaluation/generate_task_specific_statistics_plots.py,sha256=rBsqaMe2irP_Cfo-icw
8
8
  evaluation/get_plans_images.py,sha256=BT-bGWuOPUAYpZVDwk7YMRBLdgKaDbNOBjMrtcl1Vjk,2346
9
9
  evaluation/increasing_and_decreasing_.py,sha256=fu1hkEjhOQC3jEsjiS7emW_UPRpVFCaae0d0E2MGZqI,2991
10
10
  gr_libs/__init__.py,sha256=-uKsQiHIL7yojbDwlTR-I8sj1WX9XT52PoFbPjtUTKo,145
11
- gr_libs/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- gr_libs/environment/environment.py,sha256=0-3kZJCmLMF9o0NignZaMEwQb94NZQ2gmsOyfjPXKDI,6919
11
+ gr_libs/environment/__init__.py,sha256=oxEKmdvzQLKbbMxedqEf3bGsSJvp2XL9Bxr5JEO6a5o,1038
12
+ gr_libs/environment/environment.py,sha256=Ca9m6W8KEt4le0HFSAUvSHW5lSHg_wwJaBqFSq1KlUg,6781
13
13
  gr_libs/environment/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  gr_libs/environment/utils/utils.py,sha256=4yM3s30KjyuEmWR8UuICE5rR03zsLi3tzqNDvBkdPcU,537
15
15
  gr_libs/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -20,7 +20,7 @@ gr_libs/ml/consts.py,sha256=mrbZk8n6QoGzLGaKmaxq4QlAsBbk4fhkCgXLuO9jXKw,365
20
20
  gr_libs/ml/base/__init__.py,sha256=MfIYhl_UqH8H7YoTCih8wBFA_gpTOUFq8Ph0_Nq0XQk,68
21
21
  gr_libs/ml/base/rl_agent.py,sha256=u9rnb-ma9iDM5b_BlwjcTJGSFezIGrxXINw6b-Dbl8s,1598
22
22
  gr_libs/ml/neural/__init__.py,sha256=g-0D5oFX8W52To4OR8vO8kDoBLSxAupVqwcQw8XjT5E,180
23
- gr_libs/ml/neural/deep_rl_learner.py,sha256=_d6LdbMPqN4qJlOI_UqSD7o0yzIa7EjRONdFSVYO_Ag,20677
23
+ gr_libs/ml/neural/deep_rl_learner.py,sha256=b41_b4GVlYqxhjrr1_YMcGdU9iwcMXsf3zH8D2kEucs,20659
24
24
  gr_libs/ml/neural/utils/__init__.py,sha256=bJgPfRnmfDQxdnb0OyRGwzgebEc1PnlO7-GpqszPBcc,106
25
25
  gr_libs/ml/neural/utils/dictlist.py,sha256=WpHfdWpVZ_T3PcSnOQUC--ro_tsS0dvam2WG3LcsHDw,1039
26
26
  gr_libs/ml/neural/utils/penv.py,sha256=R1uW8sePQqvTlJjpAuMx16eDU6TuGAjQF3hTR1QasMo,1862
@@ -43,20 +43,21 @@ gr_libs/ml/utils/math.py,sha256=n62zssVOLHnUb4dPofAoFhoLOKl5n_xBzaKQOUQBoNc,440
43
43
  gr_libs/ml/utils/other.py,sha256=HKUfeLBbd4DgJxSTs3ya9KQ85Acx4TjycRrtGD9WQ3s,505
44
44
  gr_libs/ml/utils/storage.py,sha256=oCdvL_ypCglnSJsyyXzNyV_UJASTfioa3yJhFlFso64,4277
45
45
  gr_libs/recognizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
- gr_libs/recognizer/recognizer.py,sha256=ysJYOGe5OlERMAeMwclKpwqw2tQvbSvGnLZrq4qP0xk,1895
46
+ gr_libs/recognizer/recognizer.py,sha256=2lMlJNE7X13Y3FMpNfql-WAYw23NImIiomnVmCI75bM,1706
47
+ gr_libs/recognizer/recognizer_doc.md,sha256=RnTvbZhl2opvU7-QT4pULCV5HCdJTw2dsu8WQOOiR3E,2521
47
48
  gr_libs/recognizer/gr_as_rl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
49
  gr_libs/recognizer/gr_as_rl/gr_as_rl_recognizer.py,sha256=84GdfohC2dZoNH_QEo7GpSt8nZWdfqSRKCTY99X_iME,5215
49
50
  gr_libs/recognizer/graml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
51
  gr_libs/recognizer/graml/gr_dataset.py,sha256=lG6m3ulxFELpH1oURnlcmNDWOrxyuzvlAR28ZTqB7L8,7224
51
- gr_libs/recognizer/graml/graml_recognizer.py,sha256=OblODjvWSi8KZ5ByvGyL5Mm1GY3IZb8yspfk81Dbebg,15721
52
+ gr_libs/recognizer/graml/graml_recognizer.py,sha256=SGs7rtkA73lbCv9HISa6dfjVUJUhlH54QriVsoGVRss,15672
52
53
  gr_libs/recognizer/utils/__init__.py,sha256=ewSroxL7aATvvm-Xzc1_-61mP2LU2U28YaOEqvVVDB0,41
53
54
  gr_libs/recognizer/utils/format.py,sha256=e0AnqtPeYoJsV9Z7cEBpgbzTM0hLNxFIjn07fQ3YbQw,492
54
- tutorials/graml_minigrid_tutorial.py,sha256=iLs7mOYNAZ5wtxtSwiE8tvbLMIueQ5VmVmDnBBjWG_4,1589
55
- tutorials/graml_panda_tutorial.py,sha256=DuHVDLe49qwgWouLxwalqdT1P4dlNOOMdgDc3ocNX5Y,1820
56
- tutorials/graml_parking_tutorial.py,sha256=sQ496DNuAo9GZ_0iUZ_6Hqe5zFxIYZ_pBIHQscQvR4o,2501
57
- tutorials/graml_point_maze_tutorial.py,sha256=TnLT9FdDj6AF8lm0lDIZum4ouPE5rye4RBH8z4Exj2Y,2713
55
+ tutorials/graml_minigrid_tutorial.py,sha256=0jSlsKd0H3DXA7rPSnw09y56pTSXvtXCFOKSuUvfDjs,1597
56
+ tutorials/graml_panda_tutorial.py,sha256=LwNQPb7Kdg7X8jY7Zk13-8uBfDP8LMNzwgH-u3KOcjw,1861
57
+ tutorials/graml_parking_tutorial.py,sha256=fsLbASIESUGnZe09eEhMcqxpU0NP8k1IQyGgJq_AFVs,1549
58
+ tutorials/graml_point_maze_tutorial.py,sha256=gY8GCHnq32xyY7gSw3i3DL98TlfwgMkhO17csyV2QBA,1631
58
59
  tutorials/graql_minigrid_tutorial.py,sha256=VoXbEgL_hjQLfau6WohXxPK8rrv1VLA874F8PZ7ZtPk,1421
59
- gr_libs-0.1.3.dist-info/METADATA,sha256=Jgcr7b3qVESwqOa_odcgVjqMQK4OF0doW2if37Uwe3g,10484
60
- gr_libs-0.1.3.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
61
- gr_libs-0.1.3.dist-info/top_level.txt,sha256=k7_l789QSJEr9JrtvsRMxNoTIDwNduq8mhIN-YoPJUM,29
62
- gr_libs-0.1.3.dist-info/RECORD,,
60
+ gr_libs-0.1.5.dist-info/METADATA,sha256=h4QUMjuxouD3o1iKg2F3doJbKLbezkV1FaGKm1oBL0o,8905
61
+ gr_libs-0.1.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
62
+ gr_libs-0.1.5.dist-info/top_level.txt,sha256=k7_l789QSJEr9JrtvsRMxNoTIDwNduq8mhIN-YoPJUM,29
63
+ gr_libs-0.1.5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (77.0.3)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,11 +1,11 @@
1
- from gr_libs.environment.environment import QLEARNING
1
+ from gr_libs.environment.environment import MINIGRID, QLEARNING
2
2
  from gr_libs.metrics.metrics import stochastic_amplified_selection
3
3
  from gr_libs.ml.tabular.tabular_q_learner import TabularQLearner
4
4
  from gr_libs.ml.utils.format import random_subset_with_order
5
5
  from gr_libs import ExpertBasedGraml
6
6
 
7
7
  recognizer = ExpertBasedGraml(
8
- domain_name="minigrid",
8
+ domain_name=MINIGRID,
9
9
  env_name="MiniGrid-SimpleCrossingS13N4"
10
10
  )
11
11
 
@@ -1,7 +1,8 @@
1
1
 
2
2
  import numpy as np
3
3
  from stable_baselines3 import PPO, SAC
4
- from gr_libs.environment.environment import PANDA, GCEnvProperty, PandaProperty
4
+ import gr_libs.environment.environment
5
+ from gr_libs.environment.environment import PANDA, EnvProperty, GCEnvProperty, PandaProperty
5
6
  from gr_libs.environment.utils.utils import domain_to_env_property
6
7
  from gr_libs.metrics.metrics import stochastic_amplified_selection
7
8
  from gr_libs.ml.neural.deep_rl_learner import DeepRLAgent, GCDeepRLAgent
@@ -12,9 +13,13 @@ recognizer = GCGraml( # TODO make these tutorials into pytests
12
13
  domain_name=PANDA,
13
14
  env_name="PandaMyReachDense"
14
15
  )
15
- recognizer.domain_learning_phase(base_goals=[np.array([PandaProperty.sample_goal()]) for _ in range(1,30)],
16
- train_configs=[(SAC, 800000)])
17
- recognizer.goals_adaptation_phase(dynamic_goals=[np.array([[-0.1, -0.1, 0.1]]), np.array([[-0.1, 0.1, 0.1]]), np.array([[0.2, 0.2, 0.1]])])
16
+ recognizer.domain_learning_phase(
17
+ base_goals=[np.array([PandaProperty.sample_goal()]) for _ in range(1,30)],
18
+ train_configs=[(SAC, 800000)]
19
+ )
20
+ recognizer.goals_adaptation_phase(
21
+ dynamic_goals=[np.array([[-0.1, -0.1, 0.1]]), np.array([[-0.1, 0.1, 0.1]]), np.array([[0.2, 0.2, 0.1]])]
22
+ )
18
23
  # TD3 is different from recognizer and expert algorithms, which are SAC #
19
24
  property_type = domain_to_env_property(PANDA)
20
25
  env_property = property_type("PandaMyReachDense")
@@ -1,31 +1,27 @@
1
1
 
2
2
  from stable_baselines3 import PPO, SAC, TD3
3
- from gr_libs.environment.environment import EnvProperty, GCEnvProperty, ParkingProperty
3
+ from gr_libs.environment.environment import PARKING, EnvProperty, GCEnvProperty, ParkingProperty
4
4
  from gr_libs.metrics.metrics import stochastic_amplified_selection
5
5
  from gr_libs.ml.neural.deep_rl_learner import DeepRLAgent, GCDeepRLAgent
6
6
  from gr_libs.ml.utils.format import random_subset_with_order
7
7
  from gr_libs.recognizer.graml.graml_recognizer import ExpertBasedGraml, GCGraml
8
8
 
9
- # Consider extracting all these to "default point_maze (or every other domain) variables" module which would simplify things like the problem_list_to_str_tuple function, sizes of inputs, etc.
10
9
  recognizer = GCGraml(
11
- env_name="parking", # TODO change to macros which are importable from some info or env module of enums.
12
- problems=[ParkingProperty("parking-v0")],
13
- train_configs=[(PPO, 400000)],
14
- gc_goal_set=[f"Parking-S-14-PC--GI-{i}-v0" for i in range(1,21)]
10
+ domain_name=PARKING,
11
+ env_name="Parking-S-14-PC-"
12
+ )
13
+
14
+ recognizer.domain_learning_phase(
15
+ [i for i in range(1,21)],
16
+ [(PPO, 200000)]
15
17
  )
16
- recognizer.domain_learning_phase()
17
18
  recognizer.goals_adaptation_phase(
18
- dynamic_goals_problems = [ParkingProperty(p) for p in ["Parking-S-14-PC--GI-1-v0",
19
- "Parking-S-14-PC--GI-4-v0",
20
- "Parking-S-14-PC--GI-8-v0",
21
- "Parking-S-14-PC--GI-11-v0",
22
- "Parking-S-14-PC--GI-14-v0",
23
- "Parking-S-14-PC--GI-18-v0",
24
- "Parking-S-14-PC--GI-21-v0"]] # TODO detach the goal from the environment instance in every gym env, add the ability to alter it from outside.
25
- #dynamic_train_configs=[(SAC, 400000) for _ in range(7)] # for expert sequence generation. TODO change to require this only if sequence generation method is EXPERT.
19
+ dynamic_goals = ["1", "11", "21"]
20
+ # no need for expert sequence generation since GCRL is used
26
21
  )
22
+
27
23
  # TD3 is different from recognizer and expert algorithms, which are SAC #
28
- actor = DeepRLAgent(env_name="parking", problem_name="Parking-S-14-PC--GI-8-v0", algorithm=TD3, num_timesteps=400000)
24
+ actor = DeepRLAgent(domain_name="parking", problem_name="Parking-S-14-PC--GI-11-v0", algorithm=TD3, num_timesteps=400000)
29
25
  actor.learn()
30
26
  # sample is generated stochastically to simulate suboptimal behavior, noise is added to the actions values #
31
27
  full_sequence = actor.generate_observation(
@@ -34,5 +30,5 @@ full_sequence = actor.generate_observation(
34
30
  )
35
31
 
36
32
  partial_sequence = random_subset_with_order(full_sequence, (int)(0.5 * len(full_sequence)), is_consecutive=False)
37
- closest_goal = recognizer.inference_phase(partial_sequence, ParkingProperty("Parking-S-14-PC--GI-8-v0").str_to_goal(), 0.5)
38
- print(f"closest_goal returned by GRAML: {closest_goal}\nactual goal actor aimed towards: 8")
33
+ closest_goal = recognizer.inference_phase(partial_sequence, ParkingProperty("Parking-S-14-PC--GI-11-v0").str_to_goal(), 0.5)
34
+ print(f"closest_goal returned by GRAML: {closest_goal}\nactual goal actor aimed towards: 11")
@@ -1,36 +1,28 @@
1
1
 
2
2
  from stable_baselines3 import SAC, TD3
3
- from gr_libs.environment.utils.format import maze_str_to_goal
3
+ from gr_libs.environment.environment import POINT_MAZE, PointMazeProperty
4
4
  from gr_libs.metrics.metrics import stochastic_amplified_selection
5
5
  from gr_libs.ml.neural.deep_rl_learner import DeepRLAgent
6
6
  from gr_libs.ml.utils.format import random_subset_with_order
7
7
  from gr_libs.recognizer.graml.graml_recognizer import ExpertBasedGraml
8
8
 
9
- # Consider extracting all these to "default point_maze (or every other domain) variables" module which would simplify things like the problem_list_to_str_tuple function, sizes of inputs, etc.
10
9
  recognizer = ExpertBasedGraml(
11
- env_name="point_maze", # TODO change to macros which are importable from some info or env module of enums.
12
- problems=[("PointMaze-FourRoomsEnvDense-11x11-Goal-9x1"),
13
- ("PointMaze-FourRoomsEnv-11x11-Goal-9x9"), # this one doesn't work with dense rewards because of encountering local minima
14
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-1x9"),
15
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-3x3"),
16
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-3x4"),
17
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-8x2"),
18
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-3x7"),
19
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-2x8")],
20
- task_str_to_goal=maze_str_to_goal,
21
- method=DeepRLAgent,
22
- collect_statistics=False,
23
- train_configs=[(SAC, 200000) for _ in range(8)],
10
+ domain_name=POINT_MAZE,
11
+ env_name="PointMaze-FourRoomsEnvDense-11x11"
24
12
  )
25
- recognizer.domain_learning_phase()
13
+
14
+ recognizer.domain_learning_phase(
15
+ [(9,1), (9,9), (1,9), (3,3), (3,4), (8,2), (3,7), (2,8)],
16
+ [(SAC, 200000) for _ in range(8)]
17
+ )
18
+
26
19
  recognizer.goals_adaptation_phase(
27
- dynamic_goals_problems = ["PointMaze-FourRoomsEnvDense-11x11-Goal-4x4",
28
- "PointMaze-FourRoomsEnvDense-11x11-Goal-7x3",
29
- "PointMaze-FourRoomsEnvDense-11x11-Goal-3x7"],
30
- dynamic_train_configs=[(SAC, 200000) for _ in range(3)] # for expert sequence generation. TODO change to require this only if sequence generation method is EXPERT.
20
+ dynamic_goals = [(4,4), (7,3), (3,7)],
21
+ dynamic_train_configs=[(SAC, 200000) for _ in range(3)] # for expert sequence generation.
31
22
  )
23
+
32
24
  # TD3 is different from recognizer and expert algorithms, which are SAC #
33
- actor = DeepRLAgent(env_name="point_maze", problem_name="PointMaze-FourRoomsEnvDense-11x11-Goal-4x4", algorithm=TD3, num_timesteps=200000)
25
+ actor = DeepRLAgent(domain_name="point_maze", problem_name="PointMaze-FourRoomsEnvDense-11x11-Goal-4x4", algorithm=TD3, num_timesteps=200000)
34
26
  actor.learn()
35
27
  # sample is generated stochastically to simulate suboptimal behavior, noise is added to the actions values #
36
28
  full_sequence = actor.generate_observation(
@@ -39,5 +31,5 @@ full_sequence = actor.generate_observation(
39
31
  )
40
32
 
41
33
  partial_sequence = random_subset_with_order(full_sequence, (int)(0.5 * len(full_sequence)))
42
- closest_goal = recognizer.inference_phase(partial_sequence, maze_str_to_goal("PointMaze-FourRoomsEnvDense-11x11-Goal-4x4"), 0.5)
34
+ closest_goal = recognizer.inference_phase(partial_sequence, PointMazeProperty("PointMaze-FourRoomsEnvDense-11x11-Goal-4x4").str_to_goal(), 0.5)
43
35
  print(f"closest_goal returned by GRAML: {closest_goal}\nactual goal actor aimed towards: (4, 4)")
@@ -1,197 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: gr_libs
3
- Version: 0.1.3
4
- Summary: Package with goal recognition frameworks baselines
5
- Author: Osher Elhadad, Ben Nageris
6
- Author-email: Matan Shamir <matan.shamir@live.biu.ac.il>
7
- License-Expression: MIT
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.11
11
- Description-Content-Type: text/markdown
12
- Requires-Dist: gr_envs
13
- Requires-Dist: dill
14
- Requires-Dist: opencv-python
15
-
16
- # GRLib
17
- GRLib is a python package containing implementations of Goal Recognition (GR) algorithms which use MDPs to represent the decision making process. All agents in those algorithms interact with an environment that's registered in gym API.
18
- ## Setup:
19
- If you're on linux, great, If on windows, use git bash for the next commands to work.
20
- 1. Find where your python is installed. If you want to find where's your python3.12, you can run:
21
- ```sh
22
- py -3.12 -c "import sys; print(sys.executable)"
23
- ```
24
- 2. Create a new empty venv from that python venv module:
25
- ```sh
26
- C:/Users/path/to/Programs/Python/Python312/python.exe -m venv test_env
27
- ```
28
- 3. Activate the environment:
29
- ```sh
30
- source test_env/Scripts/activate
31
- ```
32
- 4. There's no equivalent to conda env list to check the global virtual environments status, so you can verify the active one via:
33
- ```sh
34
- echo $VIRTUAL_ENV
35
- ```
36
- 5. Install and upgrade basic package management modules:
37
- ```sh
38
- /path/to/python.exe -m pip install --upgrade pip setuptools wheel versioneer
39
- ```
40
- 6. Install the gr_libss package (can add -e for editable mode):
41
- ```sh
42
- cd /path/to/clone/of/GoalRecognitionLibs
43
- pip install -e .
44
- ```
45
- 7. Install gr_libs package (can add -e for editable mode):
46
- ```sh
47
- cd /path/to/clone/of/Grlib
48
- pip install -e .
49
- ```
50
-
51
-
52
- <!-- 1. Ensure you have python 3.11 installed.
53
- If you have root permissions, simply use:
54
- ```sh
55
- mkdir -p ~/.local/python3.11
56
- dnf install python3.11 --prefix ~/.local/python3.11
57
- echo 'export PATH=$HOME/.local/python3.11/bin:$PATH' >> ~/.bashrc
58
- source ~/.bashrc
59
- ```
60
- Else, use pyenv:
61
- ```sh
62
- pyenv install 3.11.0
63
- ```
64
- 2. Create a new venv or use an existing 3.11 venv, and activate it. To create a new venv:
65
- ```sh
66
- ~/.pyenv/versions/3.11.0/bin/python -m venv graml_env
67
- ./Python-3.11.0/graml_env/bin/activate
68
- ```
69
- If you're not a sudo, and you have problems with building python getting such warnings:
70
- ```sh
71
- WARNING: The Python ctypes extension was not compiled. Missing the libffi lib?
72
- ```
73
- That means you don't have the necesarry libraries for building python, and you probably can't change that since you're not a sudoer.
74
- An alternative solution can be using a conda env:
75
- ```sh
76
- conda create -n graml_env python=3.11
77
- conda activate graml_env
78
- ```
79
- 3. Install GoalRecognitionLibs to get all needed dependencies:
80
- ```sh
81
- git clone [GoalRecognitionLibs address]
82
- cd GoalRecognitionLibs
83
- pip install -e . # using the conda's pip of course
84
- ``` -->
85
-
86
- ### Issues & Problems ###
87
- If you're not a sudo, and you have problems with building python getting such warnings:
88
- ```sh
89
- WARNING: The Python ctypes extension was not compiled. Missing the libffi lib?
90
- ```
91
- That means you don't have the necesarry libraries for building python.
92
-
93
- ### How to use Grlib ###
94
- Now that you've installed the package, you have additional custom gym environments and you can start creating an ODGR scenario with the algorithm you wish to test.
95
- The tutorial at tutorials/tutorial.py follows a simple ODGR scnenario. We guide through the initialization and deployment process following an example where GRAML is expected to adapt to new emerging goals in the point_maze gym environment.
96
-
97
- #### Method 1: write your own script
98
- 1. create the recognizer: we need to state the base problems on which the recognizer train.
99
- we also need the env_name for the sake of storing the trained models.
100
- Other notable parameters include the parameters for the training of the model: For example, Graml's LSTM needs to accept input sizes the size of the concatenation of the state space with the action space.
101
-
102
- ```python
103
- recognizer = Graml(
104
- env_name="point_maze", # TODO change to macros which are importable from some info or env module of enums.
105
- problems=[("PointMaze-FourRoomsEnvDense-11x11-Goal-9x1"),
106
- ("PointMaze-FourRoomsEnv-11x11-Goal-9x9"), # this one doesn't work with dense rewards because of encountering local minima
107
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-1x9"),
108
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-3x3"),
109
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-3x4"),
110
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-8x2"),
111
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-3x7"),
112
- ("PointMaze-FourRoomsEnvDense-11x11-Goal-2x8")],
113
- task_str_to_goal=maze_str_to_goal,
114
- method=DeepRLAgent,
115
- collect_statistics=False,
116
- train_configs=[(SAC, 200000) for i in range(8)],
117
- partial_obs_type="fragmented",
118
- batch_size=32,
119
- input_size=6,
120
- hidden_size=8,
121
- num_samples=20000,
122
- problem_list_to_str_tuple=lambda problems: "_".join([f"[{s.split('-')[-1]}]" for s in problems]),
123
- is_learn_same_length_sequences=False,
124
- goals_adaptation_sequence_generation_method=AGENT_BASED # take expert samples in goals adaptation phase
125
- )
126
- ```
127
-
128
- 2. The domain learning phase: In GRAML's case, the recognizer generates a dataset by training agents towards the base goals and trains an metric model combined of an LSTM on traces generated by those agents.
129
-
130
- ```python
131
- recognizer.domain_learning_phase()
132
- ```
133
- 3. The goals adaptation phase: The recognizer receives new goals, along with configurations to the training of those agents - since the sequence generation method in this case is from an expert.
134
- ```python
135
- recognizer.goals_adaptation_phase(
136
- dynamic_goals_problems = ["PointMaze-FourRoomsEnvDense-11x11-Goal-4x4",
137
- "PointMaze-FourRoomsEnvDense-11x11-Goal-7x3",
138
- "PointMaze-FourRoomsEnvDense-11x11-Goal-3x7"],
139
- dynamic_train_configs=[(SAC, 200000) for i in range(3)] # for expert sequence generation
140
- )
141
- ```
142
- 4. Inference phase - this snippet generates a partial sequence by an agent trained towards one of the goals of the inference phase. Note how the trace is generated using a different agent from the recognizer's inner agents or expert (TD3 rather than SAC), and with noise added to every action to simulate suboptimal behavior.
143
- ```python
144
- actor = DeepRLAgent(env_name="point_maze", problem_name="PointMaze-FourRoomsEnvDense-11x11-Goal-4x4", algorithm=TD3, num_timesteps=200000)
145
- actor.learn()
146
- full_sequence = actor.generate_observation(
147
- action_selection_method=stochastic_amplified_selection,
148
- random_optimalism=True, # the noise that's added to the actions
149
- )
150
- partial_sequence = random_subset_with_order(full_sequence, (int)(0.5 * len(full_sequence)), is_fragmented="fragmented")
151
- closest_goal = recognizer.inference_phase(partial_sequence, maze_str_to_goal("PointMaze-FourRoomsEnvDense-11x11-Goal-4x4"), 0.5)
152
- ```
153
- 5. check the result returned by GRAML and print whether it was right or not.
154
- ```python
155
- print(f"closest_goal returned by GRAML: {closest_goal}\nactual goal actor aimed towards: (4, 4)")
156
- ```
157
-
158
- #### Method 2: use a configuration file
159
- The configuraiton file consts.py holds configurations of ODGR problems.
160
- You can either use existing ones or add new ones.
161
- Note that using the config file, despite being easier on a large scale, some inputs to the ODGR problem are not as flexible as they would be using method 1.
162
- For example, the sequence generation will be performed by trained agents and is non configurable. The sequences will either be completely consecutive or randomly sampled from the trace.
163
- Example for a problem:
164
-
165
- You can use odgr_executor.py to execute a single task:
166
- ```sh
167
- python odgr_executor.py --recognizer MCTSBasedGraml --domain minigrid --task L1 --minigrid_env MinigridSimple
168
- ```
169
-
170
-
171
- ## Supported Algorithms
172
-
173
- | **Name** | **Supervised** | **RL** | **Discrete** | **Continuous** | **Model-Based** | **Model-Free** | **Actions Only** |
174
- | ------------------- | ------------------ | ------------------ | ------------------ | ------------------- | ------------------ | --------------------------------- |
175
- | GRAQL | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: | :heavy_check_mark: | :x: |
176
- | DRACO | :x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | :heavy_check_mark: | :x: |
177
- | GRAML | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | :heavy_check_mark: | :heavy_check_mark: |
178
-
179
- ## Supported Domains
180
-
181
- | **Name** | **Action** | **State** |
182
- | ------------------- | ------------------ | ------------------ |
183
- | Minigrid | Discrete | Discrete |
184
- | PointMaze | Continuous | Continuous |
185
- | Parking | Continuous | Continuous |
186
- | Panda | Continuous | Continuous |
187
-
188
- ### Experiments
189
- Given here is a guide for executing the experiments. There are benchmark domains suggested in the repository, and the 'scripts' directory suggests a series of tools to analyze them. They are defaultly set on the domains used for GRAML and GRAQL analysis during the writing of GRAML paper, but can easily be adjusted for new domains and algorithms.
190
- 1. analyze_results_cross_alg_cross_domain.py: this script runs with no arguments. it injects information from get_experiment_results_path (for example: dataset\graml\minigrid\continuing\inference_same_seq_len\learn_diff_seq_len\experiment_results\obstacles\L111\experiment_results.pkl), and produces a plot with 4 figures showing the accuracy trend of algorithms on the domains checked one against the other. Currently GRAML is checked against GRAQL or DRACO but it can easily be adjusted from within the script.
191
- 2. generate_task_specific_statistics_plots.py - this script produces, for a specific task execution (results of execution of experiments.py), a summary combined of a figure with sticks with the accuracies and confidence levels of an algorithm on the task on the varying percentages. figures\point_maze\obstacles\graql_point_maze_obstacles_fragmented_stats.png is an example of a path at which the output is dumped. Another product of this script is a confusion matrix with the confidence levels - visualizing the same data, and the output file resides in this path: figures\point_maze\obstacles\graml_point_maze_obstacles_fragmented_inference_same_seq_len_learn_diff_seq_len_goals_conf_mat.png.
192
-
193
- ### How to add a new environment
194
- 1. bla
195
- 2. blalba
196
-
197
- ### How to add a new Learner