-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
a3e00b5
commit a626318
Showing
6 changed files
with
777 additions
and
394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from analysis.helpers.helper import plot_batch, read_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file was deleted.
Oops, something went wrong.
File renamed without changes