Skip to content

Commit

Permalink
Experiments (#20)
Browse files Browse the repository at this point in the history
* Added more experiments

* Extra df

* added more analyse

* Added memory delay to experiments

* Dataframe Explored analyse

* Added Graphing function

* Added more analyse

* added Leaftraking policy to the experiments

* Added more text to the notebook for the demo.

* Added helpers functions to analyse data.

* Changed folder name.

* Deleted extra notebook

Co-authored-by: MariaDukmak <mariadukmak@student.hu.nl>
Co-authored-by: Jellestiesri <jellestiesri@gmail.com>
Co-authored-by: RichardDev01 <60653249+RichardDev01@users.noreply.github.com>
  • Loading branch information
4 people authored Sep 29, 2021
1 parent a3e00b5 commit a626318
Show file tree
Hide file tree
Showing 6 changed files with 777 additions and 394 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This git repository houses the challenges for the course *Autonomy By Design*.
The simulation is made out of two parts, the `Environment` and the `Policy`.
The image below illustrates the simulation loop:

![](https://github.com/MariaDukmak/MazeRunner/blob/Readme-uitwerken/images/schets_simulatie.png)
![](https://github.com/MariaDukmak/MazeRunner/blob/Readme-uitwerken/readme_assets/schets_simulatie.png)


### Installation
Expand Down
743 changes: 743 additions & 0 deletions analysis/analyse_biologische_inspiratie.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions analysis/helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from analysis.helpers.helper import plot_batch, read_data
32 changes: 32 additions & 0 deletions analysis/helpers/helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Helpers function to analyse experiment data."""
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns


def read_data(experiment_name: str) -> pd.DataFrame:
"""Read the batch data from a pickle."""
return pd.read_pickle(f'experiments/{experiment_name}/batch_data.p')


def count_explored_tiles_agents(env_df: pd.DataFrame) -> dict:
"""Count how many tiles a agent has explored per tik."""
dict_agent_info = dict()
for agent in range(env_df['agents_n'].max()):
list_agent_info = []
for i in range(len(env_df)):
list_agent_info.append(env_df.iloc[i]['explored'][agent].sum())
dict_agent_info[agent] = list_agent_info
return dict_agent_info


def plot_batch(env_df: pd.DataFrame) -> None:
"""Plot result per batch."""
for batch in range(len(env_df)):
sub_df = pd.DataFrame.from_dict(env_df[batch]).set_index('time')
fig, axes = plt.subplots(1, 1, figsize=(5, 5))
fig.suptitle('Explored maze by agents')
plt.xlabel("time step")
plt.ylabel("explored tiles")
sns.lineplot(axes=axes, data=count_explored_tiles_agents(sub_df))
plt.show()
393 changes: 0 additions & 393 deletions notebook/analyse_biologische_inspiratie.ipynb

This file was deleted.

File renamed without changes

0 comments on commit a626318

Please sign in to comment.