Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementineDomine committed Jul 20, 2023
1 parent 9b90af1 commit d82031a
Show file tree
Hide file tree
Showing 3 changed files with 538 additions and 496 deletions.
937 changes: 478 additions & 459 deletions examples/comparisons_examples/Comparision_from_manadger.ipynb

Large diffs are not rendered by default.

95 changes: 59 additions & 36 deletions neuralplayground/backend/default_simulation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np

from neuralplayground.agents import Stachenfeld2018, Weber2018
from neuralplayground.arenas import MergingRoom, Sargolini2006, Simple2D, Wernle2018
from neuralplayground.arenas import Hafting2008, MergingRoom, Sargolini2006, Simple2D, Wernle2018
from neuralplayground.backend import default_training_loop, episode_based_training_loop

from .cross_comparison import SingleSim
Expand Down Expand Up @@ -89,7 +89,13 @@
}

sim4_params = {
"simulation_id": "weber_2018_in_Wernle",
"simulation_id": "weber_2018_in_Sargolini2006",
"env_class": Sargolini2006,
"env_params": {
"use_behavioral_data": True,
"time_step_size": 0.1,
"agent_step_size": None,
},
"agent_class": Weber2018,
"agent_params": {
"exc_eta": 2e-4,
Expand All @@ -108,17 +114,39 @@
"agent_step_size": 0.1,
"resolution": 100,
"ro": 1,
"room_width": 200.0,
"room_depth": 200.0,
"room_width": 100,
"room_depth": 100,
"disable_tqdm": True,
},
"env_class": Wernle2018,
"env_params": {"merge_time": 20, "switch_time": 10, "time_step_size": 0.2, "agent_step_size": 3},
"training_loop": default_training_loop,
"training_loop_params": {"n_steps": 1000},
}


sim5_params = {
"simulation_id": "weber_2018_in_Haftinglike",
"simulation_id": "stachenfeld_2018_in_Hafting2008",
"agent_class": Stachenfeld2018,
"env_class": Hafting2008,
"env_params": {
"use_behavioral_data": True,
"time_step_size": 0.1,
"agent_step_size": None,
},
"agent_params": {
"discount": 0.9,
"threshold": 1e-6,
"lr_td": 1e-2,
"state_density": 1,
"room_width": 20.0,
"room_depth": 2,
"twoD": True,
},
"training_loop": episode_based_training_loop,
"training_loop_params": {"t_episode": 100, "n_episode": 100},
}

sim6_params = {
"simulation_id": "weber_2018_in_Hafting2008",
"agent_class": Weber2018,
"agent_params": {
"exc_eta": 2e-4,
Expand All @@ -141,20 +169,18 @@
"room_depth": 2,
"disable_tqdm": True,
},
"env_class": Simple2D,
"env_class": Hafting2008,
"env_params": {
"arena_x_limits": np.array([-10, 10]),
"arena_y_limits": np.array([-1.0, 1.0]),
"env_name": "hafting_like",
"time_step_size": 1,
"agent_step_size": 0.5,
"use_behavioral_data": True,
"time_step_size": 0.1,
"agent_step_size": None,
},
"training_loop": default_training_loop,
"training_loop_params": {"n_steps": 1000},
}

sim6_params = {
"simulation_id": "weber_2018_in_Merging_Room",
sim7_params = {
"simulation_id": "weber_2018_in_Wernle",
"agent_class": Weber2018,
"agent_params": {
"exc_eta": 2e-4,
Expand All @@ -173,32 +199,19 @@
"agent_step_size": 0.1,
"resolution": 100,
"ro": 1,
"room_width": 20.0,
"room_depth": 20.0,
"room_width": 200.0,
"room_depth": 200.0,
"disable_tqdm": True,
},
"env_class": MergingRoom,
"env_params": {
"arena_x_limits": [-10, 10],
"arena_y_limits": [-10, 10],
"time_step_size": 0.2,
"agent_step_size": 10,
"merge_time": 270.0,
"switch_time": 270.0,
},
"env_class": Wernle2018,
"env_params": {"merge_time": 20, "switch_time": 10, "time_step_size": 0.2, "agent_step_size": 3},
"training_loop": default_training_loop,
"training_loop_params": {"n_steps": 1000},
}


sim7_params = {
"simulation_id": "weber_2018_in_Sargolini2006",
"env_class": Sargolini2006,
"env_params": {
"use_behavioral_data": True,
"time_step_size": 0.1,
"agent_step_size": None,
},
sim8_params = {
"simulation_id": "weber_2018_in_Merging_Room",
"agent_class": Weber2018,
"agent_params": {
"exc_eta": 2e-4,
Expand All @@ -217,10 +230,19 @@
"agent_step_size": 0.1,
"resolution": 100,
"ro": 1,
"room_width": 100,
"room_depth": 100,
"room_width": 20.0,
"room_depth": 20.0,
"disable_tqdm": True,
},
"env_class": MergingRoom,
"env_params": {
"arena_x_limits": [-10, 10],
"arena_y_limits": [-10, 10],
"time_step_size": 0.2,
"agent_step_size": 10,
"merge_time": 270.0,
"switch_time": 270.0,
},
"training_loop": default_training_loop,
"training_loop_params": {"n_steps": 1000},
}
Expand All @@ -234,3 +256,4 @@
sim_object5 = SingleSim(**sim5_params)
sim_object6 = SingleSim(**sim6_params)
sim_object7 = SingleSim(**sim7_params)
sim_object8 = SingleSim(**sim8_params)
2 changes: 1 addition & 1 deletion neuralplayground/plotting/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def make_agent_comparison(envs, parameters, agents, exps=None, recording_index=N
for m, exp in enumerate(exps):
if exp is not None:
ax[0, i + k + m + 2].text(0, 1.1, exp.experiment_name, fontsize=config_vars.FONTSIZE)
render_mpl_table(exp.show_data(), ax=ax[0, i + k + m + 2])
render_mpl_table(exp.recording_list, ax=ax[0, i + k + m + 2])
exp.plot_recording_tetr(recording_index=recording_index, tetrode_id=tetrode_id, ax=ax[1][i + k + m + 2])
r_out_im, x_bin, y_bin = exp.recording_tetr()
GridScorer_SR = GridScorer(x_bin - 1)
Expand Down

0 comments on commit d82031a

Please sign in to comment.