From c16e52689fd0c56d9b10c618e1ebcdd6191f7341 Mon Sep 17 00:00:00 2001 From: Arun Niranjan Date: Mon, 25 May 2026 14:47:34 +0100 Subject: [PATCH 1/7] Add google colab badge and install cell to model construction notebook --- .../api/model_construction_tutorial.ipynb | 82 +++++++++---------- 1 file changed, 37 insertions(+), 45 deletions(-) diff --git a/examples/api/model_construction_tutorial.ipynb b/examples/api/model_construction_tutorial.ipynb index e3d6236e..926a363b 100644 --- a/examples/api/model_construction_tutorial.ipynb +++ b/examples/api/model_construction_tutorial.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/api/model_construction_tutorial.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -29,7 +36,18 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp[gpu]\" -q" + ] + }, + { + "cell_type": "code", + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -44,7 +62,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -83,7 +101,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -122,19 +140,9 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Current belief about position: left\n", - "Goal position: center_left\n", - "Action chosen: move_right\n" - ] - } - ], + "outputs": [], "source": [ "gamma = 10 # deterministic behavior; make gamma smaller for stochastic behavior\n", "\n", @@ -168,25 +176,9 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Agent 0's current belief about position: left\n", - "Agent 1's current belief about position: center_right\n", - "Agent 2's current belief about position: right\n", - "\n", - "Goal position for all agents: center_left\n", - "\n", - "Agent 0's action chosen: move_right\n", - "Agent 1's action chosen: move_left\n", - "Agent 2's action chosen: move_left\n" - ] - } - ], + "outputs": [], "source": [ "batch_size = 3 # running 3 trials or agents in parallel\n", "gamma = 10 # deterministic behavior; make gamma smaller for stochastic behavior\n", @@ -227,7 +219,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -294,7 +286,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -404,7 +396,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -422,7 +414,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -440,7 +432,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -458,7 +450,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -469,7 +461,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -478,7 +470,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -498,7 +490,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -519,7 +511,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -529,7 +521,7 @@ ], "metadata": { "kernelspec": { - "display_name": ".venv311", + "display_name": "inferactively-pymdp", "language": "python", "name": "python3" }, @@ -543,7 +535,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.12" + "version": "3.13.11" } }, "nbformat": 4, From e7cfd15c8f5c396fee614119daba5a270c9e39cc Mon Sep 17 00:00:00 2001 From: Arun Niranjan Date: Mon, 25 May 2026 14:56:16 +0100 Subject: [PATCH 2/7] install vanilla pymdp as colab already ships with JAX --- .../api/model_construction_tutorial.ipynb | 89 +++++++++++++++---- 1 file changed, 70 insertions(+), 19 deletions(-) diff --git a/examples/api/model_construction_tutorial.ipynb b/examples/api/model_construction_tutorial.ipynb index 926a363b..c36b3717 100644 --- a/examples/api/model_construction_tutorial.ipynb +++ b/examples/api/model_construction_tutorial.ipynb @@ -42,12 +42,12 @@ "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", - " %pip install \"inferactively-pymdp[gpu]\" -q" + " %pip install \"inferactively-pymdp\" -q" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ @@ -62,7 +62,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ @@ -101,7 +101,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ @@ -140,9 +140,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Current belief about position: left\n", + "Goal position: center_left\n", + "Action chosen: move_right\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/tmp/ipykernel_1062531/1053406980.py:4: UserWarning: A JAX array is being set as static! This can result in unexpected behavior and is usually a mistake to do.\n", + " agent = Agent(**model, gamma=gamma)\n" + ] + } + ], "source": [ "gamma = 10 # deterministic behavior; make gamma smaller for stochastic behavior\n", "\n", @@ -176,9 +194,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Agent 0's current belief about position: left\n", + "Agent 1's current belief about position: center_right\n", + "Agent 2's current belief about position: right\n", + "\n", + "Goal position for all agents: center_left\n", + "\n", + "Agent 0's action chosen: move_right\n", + "Agent 1's action chosen: move_left\n", + "Agent 2's action chosen: move_left\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/tmp/ipykernel_1062531/1678643109.py:5: UserWarning: A JAX array is being set as static! This can result in unexpected behavior and is usually a mistake to do.\n", + " agent = Agent(**model, batch_size=batch_size, gamma=gamma)\n" + ] + } + ], "source": [ "batch_size = 3 # running 3 trials or agents in parallel\n", "gamma = 10 # deterministic behavior; make gamma smaller for stochastic behavior\n", @@ -219,7 +261,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -286,7 +328,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -396,9 +438,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/tmp/ipykernel_1062531/53738707.py:3: UserWarning: A JAX array is being set as static! This can result in unexpected behavior and is usually a mistake to do.\n", + " agent = Agent(**model, learn_A=False, learn_B=False, gamma=gamma, sampling_mode=\"full\")\n" + ] + } + ], "source": [ "gamma = 1.0\n", "\n", @@ -414,7 +465,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ @@ -432,7 +483,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ @@ -450,7 +501,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": {}, "outputs": [], "source": [ @@ -461,7 +512,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -470,7 +521,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, "outputs": [], "source": [ @@ -490,7 +541,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "metadata": {}, "outputs": [], "source": [ @@ -511,7 +562,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": {}, "outputs": [], "source": [ From 0e342f057de99b6cdea235915002f0381593c939 Mon Sep 17 00:00:00 2001 From: Arun Niranjan Date: Mon, 25 May 2026 15:04:49 +0100 Subject: [PATCH 3/7] Clear outputs --- .../api/model_construction_tutorial.ipynb | 87 ++++--------------- 1 file changed, 18 insertions(+), 69 deletions(-) diff --git a/examples/api/model_construction_tutorial.ipynb b/examples/api/model_construction_tutorial.ipynb index c36b3717..e315ed1c 100644 --- a/examples/api/model_construction_tutorial.ipynb +++ b/examples/api/model_construction_tutorial.ipynb @@ -47,7 +47,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -62,7 +62,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -101,7 +101,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -140,27 +140,9 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Current belief about position: left\n", - "Goal position: center_left\n", - "Action chosen: move_right\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/tmp/ipykernel_1062531/1053406980.py:4: UserWarning: A JAX array is being set as static! This can result in unexpected behavior and is usually a mistake to do.\n", - " agent = Agent(**model, gamma=gamma)\n" - ] - } - ], + "outputs": [], "source": [ "gamma = 10 # deterministic behavior; make gamma smaller for stochastic behavior\n", "\n", @@ -194,33 +176,9 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Agent 0's current belief about position: left\n", - "Agent 1's current belief about position: center_right\n", - "Agent 2's current belief about position: right\n", - "\n", - "Goal position for all agents: center_left\n", - "\n", - "Agent 0's action chosen: move_right\n", - "Agent 1's action chosen: move_left\n", - "Agent 2's action chosen: move_left\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/tmp/ipykernel_1062531/1678643109.py:5: UserWarning: A JAX array is being set as static! This can result in unexpected behavior and is usually a mistake to do.\n", - " agent = Agent(**model, batch_size=batch_size, gamma=gamma)\n" - ] - } - ], + "outputs": [], "source": [ "batch_size = 3 # running 3 trials or agents in parallel\n", "gamma = 10 # deterministic behavior; make gamma smaller for stochastic behavior\n", @@ -261,7 +219,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -328,7 +286,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -438,18 +396,9 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/tmp/ipykernel_1062531/53738707.py:3: UserWarning: A JAX array is being set as static! This can result in unexpected behavior and is usually a mistake to do.\n", - " agent = Agent(**model, learn_A=False, learn_B=False, gamma=gamma, sampling_mode=\"full\")\n" - ] - } - ], + "outputs": [], "source": [ "gamma = 1.0\n", "\n", @@ -465,7 +414,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -483,7 +432,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -501,7 +450,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -512,7 +461,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -521,7 +470,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -541,7 +490,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -562,7 +511,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ From f9b07f4eb2877e677c8473de810b2896582b5956 Mon Sep 17 00:00:00 2001 From: Arun Niranjan Date: Mon, 25 May 2026 15:06:16 +0100 Subject: [PATCH 4/7] Generate outputs --- .../api/model_construction_tutorial.ipynb | 89 +++++++++++++++---- 1 file changed, 70 insertions(+), 19 deletions(-) diff --git a/examples/api/model_construction_tutorial.ipynb b/examples/api/model_construction_tutorial.ipynb index e315ed1c..762cfe19 100644 --- a/examples/api/model_construction_tutorial.ipynb +++ b/examples/api/model_construction_tutorial.ipynb @@ -36,7 +36,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "metadata": {}, "outputs": [], "source": [ @@ -47,7 +47,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": {}, "outputs": [], "source": [ @@ -62,7 +62,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "metadata": {}, "outputs": [], "source": [ @@ -101,7 +101,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "metadata": {}, "outputs": [], "source": [ @@ -140,9 +140,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Current belief about position: left\n", + "Goal position: center_left\n", + "Action chosen: move_right\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/tmp/ipykernel_1062531/1053406980.py:4: UserWarning: A JAX array is being set as static! This can result in unexpected behavior and is usually a mistake to do.\n", + " agent = Agent(**model, gamma=gamma)\n" + ] + } + ], "source": [ "gamma = 10 # deterministic behavior; make gamma smaller for stochastic behavior\n", "\n", @@ -176,9 +194,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 38, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Agent 0's current belief about position: left\n", + "Agent 1's current belief about position: center_right\n", + "Agent 2's current belief about position: right\n", + "\n", + "Goal position for all agents: center_left\n", + "\n", + "Agent 0's action chosen: move_right\n", + "Agent 1's action chosen: move_left\n", + "Agent 2's action chosen: move_left\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/tmp/ipykernel_1062531/1678643109.py:5: UserWarning: A JAX array is being set as static! This can result in unexpected behavior and is usually a mistake to do.\n", + " agent = Agent(**model, batch_size=batch_size, gamma=gamma)\n" + ] + } + ], "source": [ "batch_size = 3 # running 3 trials or agents in parallel\n", "gamma = 10 # deterministic behavior; make gamma smaller for stochastic behavior\n", @@ -219,7 +261,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 39, "metadata": {}, "outputs": [], "source": [ @@ -286,7 +328,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 40, "metadata": {}, "outputs": [], "source": [ @@ -396,9 +438,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 41, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/tmp/ipykernel_1062531/53738707.py:3: UserWarning: A JAX array is being set as static! This can result in unexpected behavior and is usually a mistake to do.\n", + " agent = Agent(**model, learn_A=False, learn_B=False, gamma=gamma, sampling_mode=\"full\")\n" + ] + } + ], "source": [ "gamma = 1.0\n", "\n", @@ -414,7 +465,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 42, "metadata": {}, "outputs": [], "source": [ @@ -432,7 +483,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 43, "metadata": {}, "outputs": [], "source": [ @@ -450,7 +501,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 44, "metadata": {}, "outputs": [], "source": [ @@ -461,7 +512,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 45, "metadata": {}, "outputs": [], "source": [ @@ -470,7 +521,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 46, "metadata": {}, "outputs": [], "source": [ @@ -490,7 +541,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 47, "metadata": {}, "outputs": [], "source": [ @@ -511,7 +562,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 48, "metadata": {}, "outputs": [], "source": [ From ddb078a3c69bb5bbb61c47fbc72679d4070926f1 Mon Sep 17 00:00:00 2001 From: Arun Niranjan Date: Mon, 25 May 2026 15:20:36 +0100 Subject: [PATCH 5/7] docs (notebooks): add colab badge and colab install cell (except for legacy) --- .../advanced/complex_action_dependency.ipynb | 20 +++++++++++++++- .../methods_test.ipynb | 19 +++++++++++++++ .../advanced/pymdp_with_neural_encoder.ipynb | 20 +++++++++++++++- examples/envs/cue_chaining_demo.ipynb | 20 +++++++++++++++- examples/envs/generalized_tmaze_demo.ipynb | 18 ++++++++++++++ examples/envs/graph_worlds_demo.ipynb | 20 +++++++++++++++- examples/envs/knapsack_demo.ipynb | 20 +++++++++++++++- examples/envs/tmaze_demo.ipynb | 18 ++++++++++++++ .../mcts_generalized_tmaze.ipynb | 20 +++++++++++++++- .../mcts_graph_world.ipynb | 20 +++++++++++++++- .../si_generalized_tmaze.ipynb | 20 +++++++++++++++- .../si_graph_world.ipynb | 20 +++++++++++++++- .../si_tmaze_SIvalidation.ipynb | 18 ++++++++++++++ .../inductive_inference_example.ipynb | 20 +++++++++++++++- .../inductive_inference_gridworld.ipynb | 20 +++++++++++++++- .../inference_methods_comparison.ipynb | 24 ++++++++++++++++--- examples/learning/learning_gridworld.ipynb | 20 +++++++++++++++- .../model_fitting/fitting_with_pybefit.ipynb | 24 ++++++++++++++++++- examples/sparse/sparse_benchmark.ipynb | 20 +++++++++++++++- 19 files changed, 364 insertions(+), 17 deletions(-) diff --git a/examples/advanced/complex_action_dependency.ipynb b/examples/advanced/complex_action_dependency.ipynb index d3dfb17d..b5921cd1 100644 --- a/examples/advanced/complex_action_dependency.ipynb +++ b/examples/advanced/complex_action_dependency.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/advanced/complex_action_dependency.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -11,6 +18,17 @@ "The general strategy for dealing with this is to flatten the `prev_action_dims` while initializing the agent so that the new B tensor shapes are `[state_dim, *prev_state_dims, math.prod(prev_action_dims)]`. If a state has no action dependency, the new B tensor will have shape `[state_dim, *prev_state_dims, 1]` where 1 stands for a dummy action. All computations will be done in the flattened B tensors and actions will be sampled in the flattened action dimensions. After a flattened action is sampled, one can convert it back to the original action dimensions by calling `agent.decode_multi_actions`. To flatten multi actions, for example from collected data, one can call `agent.encode_multi_actions`." ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": 7, @@ -295,4 +313,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/advanced/infer_states_optimization/methods_test.ipynb b/examples/advanced/infer_states_optimization/methods_test.ipynb index 8364ff9a..1db0d0d0 100644 --- a/examples/advanced/infer_states_optimization/methods_test.ipynb +++ b/examples/advanced/infer_states_optimization/methods_test.ipynb @@ -1,5 +1,24 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/advanced/infer_states_optimization/methods_test.ipynb)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9443d173", + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ] + }, { "cell_type": "code", "execution_count": 1, diff --git a/examples/advanced/pymdp_with_neural_encoder.ipynb b/examples/advanced/pymdp_with_neural_encoder.ipynb index a6c27823..c0d8fc3e 100644 --- a/examples/advanced/pymdp_with_neural_encoder.ipynb +++ b/examples/advanced/pymdp_with_neural_encoder.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/advanced/pymdp_with_neural_encoder.ipynb)" + ] + }, { "cell_type": "markdown", "id": "0", @@ -26,6 +33,17 @@ "\n" ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": null, @@ -27363,4 +27381,4 @@ "metadata": {}, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file diff --git a/examples/envs/cue_chaining_demo.ipynb b/examples/envs/cue_chaining_demo.ipynb index 1a309350..3f6ecae6 100644 --- a/examples/envs/cue_chaining_demo.ipynb +++ b/examples/envs/cue_chaining_demo.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/envs/cue_chaining_demo.ipynb)" + ] + }, { "cell_type": "markdown", "id": "b803090f", @@ -20,6 +27,17 @@ "3. Exploit by moving to the rewarding location." ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": 1, @@ -515,4 +533,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file diff --git a/examples/envs/generalized_tmaze_demo.ipynb b/examples/envs/generalized_tmaze_demo.ipynb index eaaeeb2a..cf170f6b 100644 --- a/examples/envs/generalized_tmaze_demo.ipynb +++ b/examples/envs/generalized_tmaze_demo.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/envs/generalized_tmaze_demo.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -31,6 +38,17 @@ "```" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp[nb]\" -q" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/examples/envs/graph_worlds_demo.ipynb b/examples/envs/graph_worlds_demo.ipynb index 295edc97..dacd1c25 100644 --- a/examples/envs/graph_worlds_demo.ipynb +++ b/examples/envs/graph_worlds_demo.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/envs/graph_worlds_demo.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -9,6 +16,17 @@ "This environment demonstrates agents that can navigate a graph and find an object. Object is only visible when agent is at the same location as the object." ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": 1, @@ -485,4 +503,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/envs/knapsack_demo.ipynb b/examples/envs/knapsack_demo.ipynb index 03fd8223..c5f12dd0 100644 --- a/examples/envs/knapsack_demo.ipynb +++ b/examples/envs/knapsack_demo.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/envs/knapsack_demo.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -13,6 +20,17 @@ "Let us define our actions `a_i` as whether to include an item or not for each item i. The state `s_i` of the system is defined as whether an item is included or not, i.e., copying the action variables over to the corresponding state variables. We also need another state variable `z` which represents whether the knapsack capacity is exceeded. If an item is included, i.e., `s_i = 1`, we get a reward `r_i`, otherwise, we get a reward of 0 when `s_i = 0`. We can thus define our preference of including valuable items to be proportional to the exponential of reward: `C[s_i] = softmax([0, r_i])`. Our preference on the capacity constraint variable `z` is to never violate it, i.e., `C[z] = [1, 0]`. Since the system is fully observable, we will set all the Categorical/Dirichlet parameters of the emission model (the `A` tensors) to be diagonal." ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": 1, @@ -358,4 +376,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/envs/tmaze_demo.ipynb b/examples/envs/tmaze_demo.ipynb index b1cb4f64..82ed3f4b 100644 --- a/examples/envs/tmaze_demo.ipynb +++ b/examples/envs/tmaze_demo.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/envs/tmaze_demo.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -34,6 +41,17 @@ "#### **3.** A noisy generative model with A and B learning, with correct and incorrect prior structure of those parameters, and a single agent solving the task with standard active inference." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp[nb]\" -q" + ] + }, { "cell_type": "code", "execution_count": 1, diff --git a/examples/experimental/sophisticated_inference/mcts_generalized_tmaze.ipynb b/examples/experimental/sophisticated_inference/mcts_generalized_tmaze.ipynb index ccab8e39..062cc22b 100644 --- a/examples/experimental/sophisticated_inference/mcts_generalized_tmaze.ipynb +++ b/examples/experimental/sophisticated_inference/mcts_generalized_tmaze.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/experimental/sophisticated_inference/mcts_generalized_tmaze.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -99,6 +106,17 @@ "\\end{equation}" ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": null, @@ -1527,4 +1545,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb b/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb index 3c057b3f..73a0fab7 100644 --- a/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb +++ b/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb @@ -1,5 +1,23 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb)" + ] + }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": 1, @@ -1908,4 +1926,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/experimental/sophisticated_inference/si_generalized_tmaze.ipynb b/examples/experimental/sophisticated_inference/si_generalized_tmaze.ipynb index d8bfd968..be6868f1 100644 --- a/examples/experimental/sophisticated_inference/si_generalized_tmaze.ipynb +++ b/examples/experimental/sophisticated_inference/si_generalized_tmaze.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/experimental/sophisticated_inference/si_generalized_tmaze.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -9,6 +16,17 @@ "This notebook demonstrates the effect of sophisticated inference on a generalized T-maze which has multiple cues, out of which only one leads to reward. Sophisticated inference correctly focuses on the cue that yields reward, whereas vanilla AIF will be distracted by the prospect of information gain of the other cues. However, due to the long planning horizon this takes a long time to compute doing the full tree search. See the mcts_generalized_tmaze example to see how to combat this using MCMC sampling." ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": 1, @@ -264,4 +282,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/experimental/sophisticated_inference/si_graph_world.ipynb b/examples/experimental/sophisticated_inference/si_graph_world.ipynb index 539ebbda..fc580eea 100644 --- a/examples/experimental/sophisticated_inference/si_graph_world.ipynb +++ b/examples/experimental/sophisticated_inference/si_graph_world.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/experimental/sophisticated_inference/si_graph_world.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -16,6 +23,17 @@ "We create a `GraphEnv`, where an agent can move between locations on a graph, and see objects at the location it is at." ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": 1, @@ -182,4 +200,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/experimental/sophisticated_inference/si_tmaze_SIvalidation.ipynb b/examples/experimental/sophisticated_inference/si_tmaze_SIvalidation.ipynb index 36142196..92d8406c 100644 --- a/examples/experimental/sophisticated_inference/si_tmaze_SIvalidation.ipynb +++ b/examples/experimental/sophisticated_inference/si_tmaze_SIvalidation.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/experimental/sophisticated_inference/si_tmaze_SIvalidation.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -30,6 +37,17 @@ "4. Results Analysis: Compare actions selected and policy evaluations " ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp[nb]\" -q" + ] + }, { "cell_type": "code", "execution_count": 1, diff --git a/examples/inductive_inference/inductive_inference_example.ipynb b/examples/inductive_inference/inductive_inference_example.ipynb index 6e3c6afc..bd03a67a 100644 --- a/examples/inductive_inference/inductive_inference_example.ipynb +++ b/examples/inductive_inference/inductive_inference_example.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/inductive_inference/inductive_inference_example.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -7,6 +14,17 @@ "### Imports" ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": null, @@ -140,4 +158,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/inductive_inference/inductive_inference_gridworld.ipynb b/examples/inductive_inference/inductive_inference_gridworld.ipynb index 4d45619a..196a2fed 100644 --- a/examples/inductive_inference/inductive_inference_gridworld.ipynb +++ b/examples/inductive_inference/inductive_inference_gridworld.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/inductive_inference/inductive_inference_gridworld.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -7,6 +14,17 @@ "### Imports" ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": 1, @@ -397,4 +415,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/inference_and_learning/inference_methods_comparison.ipynb b/examples/inference_and_learning/inference_methods_comparison.ipynb index fb71c463..343dd367 100644 --- a/examples/inference_and_learning/inference_methods_comparison.ipynb +++ b/examples/inference_and_learning/inference_methods_comparison.ipynb @@ -1,5 +1,23 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/inference_and_learning/inference_methods_comparison.ipynb)" + ] + }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": 1, @@ -195,7 +213,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "24.1 μs ± 2.27 μs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n" + "24.1 \u03bcs \u00b1 2.27 \u03bcs per loop (mean \u00b1 std. dev. of 7 runs, 10,000 loops each)\n" ] } ], @@ -227,7 +245,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "28.4 μs ± 361 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n" + "28.4 \u03bcs \u00b1 361 ns per loop (mean \u00b1 std. dev. of 7 runs, 10,000 loops each)\n" ] } ], @@ -572,4 +590,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/learning/learning_gridworld.ipynb b/examples/learning/learning_gridworld.ipynb index 7f81924f..689f576f 100644 --- a/examples/learning/learning_gridworld.ipynb +++ b/examples/learning/learning_gridworld.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/learning/learning_gridworld.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -7,6 +14,17 @@ "### Imports" ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": 1, @@ -1256,4 +1274,4 @@ "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/model_fitting/fitting_with_pybefit.ipynb b/examples/model_fitting/fitting_with_pybefit.ipynb index 97ddda73..d1b2576c 100644 --- a/examples/model_fitting/fitting_with_pybefit.ipynb +++ b/examples/model_fitting/fitting_with_pybefit.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/model_fitting/fitting_with_pybefit.ipynb)" + ] + }, { "cell_type": "code", "execution_count": 1, @@ -20,6 +27,17 @@ "%autoreload 2\n" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp[modelfit]\" -q" + ] + }, { "cell_type": "code", "execution_count": null, @@ -813,7 +831,11 @@ ] } ], - "metadata": {}, + "metadata": { + "language_info": { + "name": "python" + } + }, "nbformat": 4, "nbformat_minor": 5 } diff --git a/examples/sparse/sparse_benchmark.ipynb b/examples/sparse/sparse_benchmark.ipynb index 6d094d2c..8a2b5c87 100644 --- a/examples/sparse/sparse_benchmark.ipynb +++ b/examples/sparse/sparse_benchmark.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/sparse/sparse_benchmark.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -17,6 +24,17 @@ "%autoreload 2" ] }, + { + "cell_type": "code", + "metadata": {}, + "source": [ + "import sys\n", + "if \"google.colab\" in sys.modules:\n", + " %pip install \"inferactively-pymdp\" -q" + ], + "outputs": [], + "execution_count": null + }, { "cell_type": "code", "execution_count": null, @@ -363,4 +381,4 @@ "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file From 71b2c7c6e76f5ad935ca006f49c4a4332e096e1b Mon Sep 17 00:00:00 2001 From: Arun Niranjan Date: Mon, 25 May 2026 15:22:00 +0100 Subject: [PATCH 6/7] add nb dep to graph world notebook --- .../sophisticated_inference/mcts_graph_world.ipynb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb b/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb index 73a0fab7..5c35ffee 100644 --- a/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb +++ b/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb @@ -9,14 +9,14 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", - " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + " %pip install \"inferactively-pymdp[nb]\" -q" + ] }, { "cell_type": "code", @@ -1926,4 +1926,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} From a25d4532a1d8165fe076912aa0a8577bd9ce7fa0 Mon Sep 17 00:00:00 2001 From: Arun Niranjan Date: Tue, 26 May 2026 11:58:25 +0100 Subject: [PATCH 7/7] Sanitise notebooks --- .../advanced/complex_action_dependency.ipynb | 34 ++----- .../methods_test.ipynb | 71 ++++++--------- .../advanced/pymdp_with_neural_encoder.ipynb | 58 ++++++------ examples/envs/cue_chaining_demo.ipynb | 44 +++------- examples/envs/generalized_tmaze_demo.ipynb | 34 ++----- examples/envs/graph_worlds_demo.ipynb | 45 ++++------ examples/envs/knapsack_demo.ipynb | 44 +++------- examples/envs/tmaze_demo.ipynb | 51 ++++------- .../mcts_generalized_tmaze.ipynb | 46 +++------- .../mcts_graph_world.ipynb | 29 ++---- .../si_generalized_tmaze.ipynb | 44 +++------- .../si_graph_world.ipynb | 40 +++------ .../si_tmaze_SIvalidation.ipynb | 88 ++++++++----------- .../inductive_inference_example.ipynb | 34 ++----- .../inductive_inference_gridworld.ipynb | 49 ++++------- .../inference_methods_comparison.ipynb | 56 ++++-------- examples/learning/learning_gridworld.ipynb | 8 +- .../model_fitting/fitting_with_pybefit.ipynb | 58 ++++++------ examples/sparse/sparse_benchmark.ipynb | 8 +- 19 files changed, 297 insertions(+), 544 deletions(-) diff --git a/examples/advanced/complex_action_dependency.ipynb b/examples/advanced/complex_action_dependency.ipynb index b5921cd1..42e21b24 100644 --- a/examples/advanced/complex_action_dependency.ipynb +++ b/examples/advanced/complex_action_dependency.ipynb @@ -20,18 +20,18 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -55,7 +55,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -179,7 +179,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -292,25 +292,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "pymdp_dev_env", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.3" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} diff --git a/examples/advanced/infer_states_optimization/methods_test.ipynb b/examples/advanced/infer_states_optimization/methods_test.ipynb index 1db0d0d0..36d517b7 100644 --- a/examples/advanced/infer_states_optimization/methods_test.ipynb +++ b/examples/advanced/infer_states_optimization/methods_test.ipynb @@ -2,6 +2,7 @@ "cells": [ { "cell_type": "markdown", + "id": "798edfd3", "metadata": {}, "source": [ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/advanced/infer_states_optimization/methods_test.ipynb)" @@ -21,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "d329903e-0caa-4ad9-8b85-92ed348f1e0f", "metadata": {}, "outputs": [], @@ -53,7 +54,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "87d1c903-5496-4b12-a653-d6a9d8e6337b", "metadata": {}, "outputs": [ @@ -81,7 +82,7 @@ " 'dim_sampling_type': 'uniform'}}" ] }, - "execution_count": 2, + "execution_count": 1, "metadata": {}, "output_type": "execute_result" } @@ -109,7 +110,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "bc5d11ae-0e03-4ebc-9fb2-e31e51f29b63", "metadata": {}, "outputs": [ @@ -151,7 +152,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "ef656d7c-b9da-4d9b-990d-a6b7a99ca725", "metadata": {}, "outputs": [], @@ -170,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 3, "id": "c2b7676f-58a7-41d3-8e66-31d2f58213b0", "metadata": { "scrolled": true @@ -281,7 +282,7 @@ " [[0.24136765, 0.17386995, 0.2222213 , 0.16080104, 0.2017401 ]]], dtype=float32)])" ] }, - "execution_count": 5, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -301,7 +302,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "dd83c3d3", "metadata": {}, "outputs": [], @@ -314,7 +315,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "6c778c1e-e373-4603-a244-6f3455a282d8", "metadata": {}, "outputs": [], @@ -331,7 +332,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 4, "id": "5398c4aa-77bf-438c-8be8-1a5ab72e3d89", "metadata": { "scrolled": true @@ -442,7 +443,7 @@ " [[0.24136765, 0.17386995, 0.2222213 , 0.16080104, 0.2017401 ]]], dtype=float32)])" ] }, - "execution_count": 8, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -454,7 +455,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 5, "id": "14c74aed", "metadata": {}, "outputs": [ @@ -563,7 +564,7 @@ " [[0.24136765, 0.17386995, 0.2222213 , 0.16080104, 0.2017401 ]]], dtype=float32)])" ] }, - "execution_count": 9, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -588,7 +589,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "9485d771", "metadata": {}, "outputs": [], @@ -602,7 +603,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "891743ae", "metadata": {}, "outputs": [], @@ -621,7 +622,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 6, "id": "1d52085c", "metadata": {}, "outputs": [ @@ -730,7 +731,7 @@ " [[0.24136765, 0.17386995, 0.2222213 , 0.16080104, 0.2017401 ]]], dtype=float32)])" ] }, - "execution_count": 12, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -746,7 +747,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 7, "id": "78beb618", "metadata": {}, "outputs": [ @@ -855,7 +856,7 @@ " [[0.24136765, 0.17386995, 0.2222213 , 0.16080104, 0.2017401 ]]], dtype=float32)])" ] }, - "execution_count": 13, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -881,7 +882,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "1e91bf02", "metadata": {}, "outputs": [], @@ -893,7 +894,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "96d162ed-b35e-44d3-9106-1c37158aab4d", "metadata": {}, "outputs": [], @@ -912,7 +913,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 8, "id": "72bc7f44-52e9-4843-aef8-f8255fe785fd", "metadata": { "scrolled": true @@ -1023,7 +1024,7 @@ " [[0.24136762, 0.17386994, 0.22222117, 0.1608011 , 0.20174012]]], dtype=float32)])" ] }, - "execution_count": 16, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -1036,7 +1037,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 9, "id": "5f161096", "metadata": {}, "outputs": [ @@ -1145,7 +1146,7 @@ " [[0.24136762, 0.17386994, 0.22222117, 0.1608011 , 0.20174012]]], dtype=float32)])" ] }, - "execution_count": 17, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -1161,25 +1162,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "venv", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.10.18" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/examples/advanced/pymdp_with_neural_encoder.ipynb b/examples/advanced/pymdp_with_neural_encoder.ipynb index c0d8fc3e..30ccd2a4 100644 --- a/examples/advanced/pymdp_with_neural_encoder.ipynb +++ b/examples/advanced/pymdp_with_neural_encoder.ipynb @@ -2,6 +2,7 @@ "cells": [ { "cell_type": "markdown", + "id": "0", "metadata": {}, "source": [ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/advanced/pymdp_with_neural_encoder.ipynb)" @@ -9,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "0", + "id": "1", "metadata": {}, "source": [ "# Training a neural network to transform continuous into discrete observations for a `pymdp` Agent\n", @@ -24,7 +25,7 @@ }, { "cell_type": "markdown", - "id": "1", + "id": "2", "metadata": {}, "source": [ "## 1. Imports\n", @@ -35,19 +36,20 @@ }, { "cell_type": "code", + "execution_count": null, + "id": "3", "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", "execution_count": null, - "id": "2", + "id": "4", "metadata": {}, "outputs": [], "source": [ @@ -69,7 +71,7 @@ }, { "cell_type": "markdown", - "id": "3", + "id": "5", "metadata": {}, "source": [ "## 2. Setup\n", @@ -80,7 +82,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4", + "id": "6", "metadata": {}, "outputs": [], "source": [ @@ -138,7 +140,7 @@ }, { "cell_type": "markdown", - "id": "5", + "id": "7", "metadata": {}, "source": [ "## 3. Build the Fixed Discrete Agent\n", @@ -157,7 +159,7 @@ { "cell_type": "code", "execution_count": 1, - "id": "6", + "id": "8", "metadata": {}, "outputs": [ { @@ -247,7 +249,7 @@ }, { "cell_type": "markdown", - "id": "7", + "id": "9", "metadata": {}, "source": [ "## 4. Generate Offline Continuous Trajectories\n", @@ -265,7 +267,7 @@ { "cell_type": "code", "execution_count": 2, - "id": "8", + "id": "10", "metadata": {}, "outputs": [ { @@ -364,7 +366,7 @@ }, { "cell_type": "markdown", - "id": "9", + "id": "11", "metadata": {}, "source": [ "## 5. Define the Differentiable Front-End\n", @@ -380,7 +382,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "10", + "id": "12", "metadata": {}, "outputs": [ { @@ -432,7 +434,7 @@ }, { "cell_type": "markdown", - "id": "11", + "id": "13", "metadata": {}, "source": [ "## 6. Define the Training Objective\n", @@ -453,7 +455,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -559,7 +561,7 @@ }, { "cell_type": "markdown", - "id": "13", + "id": "15", "metadata": {}, "source": [ "## 7. Train the Encoder\n", @@ -581,7 +583,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "14", + "id": "16", "metadata": {}, "outputs": [ { @@ -675,7 +677,7 @@ }, { "cell_type": "markdown", - "id": "15", + "id": "17", "metadata": {}, "source": [ "## 8. Evaluate Representation Quality\n", @@ -692,7 +694,7 @@ { "cell_type": "code", "execution_count": 5, - "id": "16", + "id": "18", "metadata": {}, "outputs": [ { @@ -787,7 +789,7 @@ }, { "cell_type": "markdown", - "id": "17", + "id": "19", "metadata": {}, "source": [ "## 9. Plan from Continuous Observations\n", @@ -801,7 +803,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "18", + "id": "20", "metadata": {}, "outputs": [ { @@ -880,7 +882,7 @@ }, { "cell_type": "markdown", - "id": "19", + "id": "21", "metadata": {}, "source": [ "## 10. Animation: Continuous Density + Inference During Control\n", @@ -896,7 +898,7 @@ { "cell_type": "code", "execution_count": 7, - "id": "20", + "id": "22", "metadata": {}, "outputs": [ { @@ -18889,7 +18891,7 @@ }, { "cell_type": "markdown", - "id": "21", + "id": "23", "metadata": {}, "source": [ "## 11. Animation: Encoder Decision Regions + Control Trajectory\n", @@ -18903,7 +18905,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "22", + "id": "24", "metadata": {}, "outputs": [ { @@ -27365,7 +27367,7 @@ }, { "cell_type": "markdown", - "id": "23", + "id": "25", "metadata": {}, "source": [ "## 12. Summary\n", @@ -27381,4 +27383,4 @@ "metadata": {}, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/examples/envs/cue_chaining_demo.ipynb b/examples/envs/cue_chaining_demo.ipynb index 3f6ecae6..65f5d50b 100644 --- a/examples/envs/cue_chaining_demo.ipynb +++ b/examples/envs/cue_chaining_demo.ipynb @@ -2,6 +2,7 @@ "cells": [ { "cell_type": "markdown", + "id": "e6e8061c", "metadata": {}, "source": [ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/envs/cue_chaining_demo.ipynb)" @@ -29,18 +30,19 @@ }, { "cell_type": "code", + "execution_count": null, + "id": "8210db71", "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "b59618c1", "metadata": { "execution": { @@ -74,7 +76,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "21de5c24", "metadata": { "execution": { @@ -128,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "203e2547", "metadata": { "execution": { @@ -198,7 +200,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "ea613d7d", "metadata": { "execution": { @@ -238,7 +240,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "c6a9125f", "metadata": { "execution": { @@ -397,7 +399,7 @@ "10 10 (3, 5) Null Null Cheese STAY" ] }, - "execution_count": 5, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -436,7 +438,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "ee345b31", "metadata": { "execution": { @@ -512,25 +514,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/examples/envs/generalized_tmaze_demo.ipynb b/examples/envs/generalized_tmaze_demo.ipynb index cf170f6b..c27651ae 100644 --- a/examples/envs/generalized_tmaze_demo.ipynb +++ b/examples/envs/generalized_tmaze_demo.ipynb @@ -88,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -144,7 +144,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -186,7 +186,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -276,7 +276,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -287,7 +287,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -309,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -1570,7 +1570,7 @@ "" ] }, - "execution_count": 12, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -1611,25 +1611,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "pymdp_dev_env", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.3" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 } diff --git a/examples/envs/graph_worlds_demo.ipynb b/examples/envs/graph_worlds_demo.ipynb index dacd1c25..a636ca6f 100644 --- a/examples/envs/graph_worlds_demo.ipynb +++ b/examples/envs/graph_worlds_demo.ipynb @@ -18,18 +18,18 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:18.683564Z", @@ -68,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:22.675254Z", @@ -105,7 +105,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:22.728168Z", @@ -133,7 +133,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:23.548655Z", @@ -173,7 +173,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:24.285830Z", @@ -197,7 +197,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:25.188717Z", @@ -220,7 +220,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:25.768119Z", @@ -236,7 +236,7 @@ "dict_keys(['action', 'empirical_prior', 'env_state', 'neg_efe', 'observation', 'qpi', 'qs'])" ] }, - "execution_count": 7, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -254,7 +254,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:25.778621Z", @@ -287,7 +287,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:25.786826Z", @@ -345,7 +345,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:26.032916Z", @@ -487,20 +487,7 @@ ] } ], - "metadata": { - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} diff --git a/examples/envs/knapsack_demo.ipynb b/examples/envs/knapsack_demo.ipynb index c5f12dd0..1916a91f 100644 --- a/examples/envs/knapsack_demo.ipynb +++ b/examples/envs/knapsack_demo.ipynb @@ -22,18 +22,18 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -56,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -116,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -137,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -231,7 +231,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -243,7 +243,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -277,7 +277,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -308,7 +308,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -355,25 +355,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "pymdp_dev_env", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.3" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} diff --git a/examples/envs/tmaze_demo.ipynb b/examples/envs/tmaze_demo.ipynb index 82ed3f4b..ce7c9b70 100644 --- a/examples/envs/tmaze_demo.ipynb +++ b/examples/envs/tmaze_demo.ipynb @@ -54,7 +54,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:30.989078Z", @@ -152,7 +152,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:34.893886Z", @@ -206,7 +206,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:35.263798Z", @@ -293,7 +293,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:36.074529Z", @@ -327,7 +327,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:37.067936Z", @@ -397,7 +397,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:39.107336Z", @@ -507,7 +507,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:57.523036Z", @@ -539,7 +539,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:30:57.553800Z", @@ -607,7 +607,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:00.134138Z", @@ -671,7 +671,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:13.114299Z", @@ -708,7 +708,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:13.167263Z", @@ -780,7 +780,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:13.736663Z", @@ -805,7 +805,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:14.974645Z", @@ -849,7 +849,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 8, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:15.010576Z", @@ -896,7 +896,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 9, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:16.053250Z", @@ -953,7 +953,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 10, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:18.012533Z", @@ -997,7 +997,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 11, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:18.063914Z", @@ -1038,7 +1038,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 12, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:18.195581Z", @@ -1084,20 +1084,7 @@ ] } ], - "metadata": { - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 } diff --git a/examples/experimental/sophisticated_inference/mcts_generalized_tmaze.ipynb b/examples/experimental/sophisticated_inference/mcts_generalized_tmaze.ipynb index 062cc22b..f954eaf9 100644 --- a/examples/experimental/sophisticated_inference/mcts_generalized_tmaze.ipynb +++ b/examples/experimental/sophisticated_inference/mcts_generalized_tmaze.ipynb @@ -108,14 +108,14 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", @@ -148,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -207,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -311,7 +311,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -322,7 +322,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -331,7 +331,7 @@ "dict_keys(['action', 'action_weights', 'empirical_prior', 'env_state', 'observation', 'qpi', 'qs', 'search_tree'])" ] }, - "execution_count": 15, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -342,7 +342,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -368,7 +368,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -390,7 +390,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -1513,7 +1513,7 @@ "" ] }, - "execution_count": 12, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -1524,25 +1524,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": ".venv311", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} diff --git a/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb b/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb index 5c35ffee..47fb6a94 100644 --- a/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb +++ b/examples/experimental/sophisticated_inference/mcts_graph_world.ipynb @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:43.007199Z", @@ -56,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:43.765921Z", @@ -137,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:43.771113Z", @@ -178,7 +178,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:47.658379Z", @@ -222,7 +222,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:48.371274Z", @@ -242,7 +242,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:48.390928Z", @@ -1879,7 +1879,7 @@ "" ] }, - "execution_count": 6, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -1910,20 +1910,7 @@ ] } ], - "metadata": { - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 } diff --git a/examples/experimental/sophisticated_inference/si_generalized_tmaze.ipynb b/examples/experimental/sophisticated_inference/si_generalized_tmaze.ipynb index be6868f1..38b1c8d0 100644 --- a/examples/experimental/sophisticated_inference/si_generalized_tmaze.ipynb +++ b/examples/experimental/sophisticated_inference/si_generalized_tmaze.ipynb @@ -18,18 +18,18 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -85,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -114,7 +114,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -128,7 +128,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -148,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -220,7 +220,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -230,7 +230,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -261,25 +261,7 @@ "source": [] } ], - "metadata": { - "kernelspec": { - "display_name": ".venv", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.11" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} diff --git a/examples/experimental/sophisticated_inference/si_graph_world.ipynb b/examples/experimental/sophisticated_inference/si_graph_world.ipynb index fc580eea..3be1286c 100644 --- a/examples/experimental/sophisticated_inference/si_graph_world.ipynb +++ b/examples/experimental/sophisticated_inference/si_graph_world.ipynb @@ -25,18 +25,18 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -48,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -62,7 +62,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -89,7 +89,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -118,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -138,7 +138,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -179,25 +179,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": ".venv", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.11" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} diff --git a/examples/experimental/sophisticated_inference/si_tmaze_SIvalidation.ipynb b/examples/experimental/sophisticated_inference/si_tmaze_SIvalidation.ipynb index 92d8406c..e995caeb 100644 --- a/examples/experimental/sophisticated_inference/si_tmaze_SIvalidation.ipynb +++ b/examples/experimental/sophisticated_inference/si_tmaze_SIvalidation.ipynb @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:52.929478Z", @@ -151,7 +151,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:56.833504Z", @@ -172,7 +172,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:56.848285Z", @@ -201,7 +201,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:57.168745Z", @@ -225,7 +225,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:57.219677Z", @@ -242,7 +242,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:57.257395Z", @@ -305,7 +305,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:57.879961Z", @@ -322,7 +322,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:57.905455Z", @@ -350,7 +350,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:31:57.915721Z", @@ -367,7 +367,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:00.063840Z", @@ -398,7 +398,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:00.074536Z", @@ -430,7 +430,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:00.799469Z", @@ -469,7 +469,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:01.461295Z", @@ -549,7 +549,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:01.475190Z", @@ -576,7 +576,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:01.514071Z", @@ -614,7 +614,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:01.524335Z", @@ -643,7 +643,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:02.047026Z", @@ -681,7 +681,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:02.258821Z", @@ -775,7 +775,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:02.268359Z", @@ -797,7 +797,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:02.276198Z", @@ -827,7 +827,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:02.470266Z", @@ -852,7 +852,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:02.481139Z", @@ -877,7 +877,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 8, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:02.516898Z", @@ -942,7 +942,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:03.125390Z", @@ -959,7 +959,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:03.135256Z", @@ -987,7 +987,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:03.143984Z", @@ -1004,7 +1004,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:06.215016Z", @@ -1036,7 +1036,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 9, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:06.226122Z", @@ -1068,7 +1068,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 10, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:07.086134Z", @@ -1107,7 +1107,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:07.908846Z", @@ -1203,7 +1203,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 11, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:07.923120Z", @@ -1232,7 +1232,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 12, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:07.953763Z", @@ -1270,7 +1270,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 13, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:07.964611Z", @@ -1300,7 +1300,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 14, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:08.565830Z", @@ -1329,25 +1329,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": ".venv", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 } diff --git a/examples/inductive_inference/inductive_inference_example.ipynb b/examples/inductive_inference/inductive_inference_example.ipynb index bd03a67a..8d31b86d 100644 --- a/examples/inductive_inference/inductive_inference_example.ipynb +++ b/examples/inductive_inference/inductive_inference_example.ipynb @@ -16,14 +16,14 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", @@ -47,7 +47,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -99,7 +99,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -123,7 +123,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -137,25 +137,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "pymdp_dev_env", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.11" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} diff --git a/examples/inductive_inference/inductive_inference_gridworld.ipynb b/examples/inductive_inference/inductive_inference_gridworld.ipynb index 196a2fed..caa04b89 100644 --- a/examples/inductive_inference/inductive_inference_gridworld.ipynb +++ b/examples/inductive_inference/inductive_inference_gridworld.ipynb @@ -16,18 +16,18 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:10.138587Z", @@ -59,7 +59,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:14.054405Z", @@ -95,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:14.380265Z", @@ -126,7 +126,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:14.446460Z", @@ -165,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:15.110855Z", @@ -182,7 +182,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:16.108728Z", @@ -198,7 +198,7 @@ "(5, 8)" ] }, - "execution_count": 6, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -209,7 +209,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:16.112658Z", @@ -249,7 +249,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:16.233977Z", @@ -279,7 +279,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:16.250817Z", @@ -300,7 +300,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:16.254701Z", @@ -338,7 +338,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:16.383442Z", @@ -360,7 +360,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:17.231657Z", @@ -399,20 +399,7 @@ ] } ], - "metadata": { - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} diff --git a/examples/inference_and_learning/inference_methods_comparison.ipynb b/examples/inference_and_learning/inference_methods_comparison.ipynb index 343dd367..b80279ae 100644 --- a/examples/inference_and_learning/inference_methods_comparison.ipynb +++ b/examples/inference_and_learning/inference_methods_comparison.ipynb @@ -9,18 +9,18 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:18.347670Z", @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:19.685687Z", @@ -106,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:19.995016Z", @@ -170,7 +170,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:20.426515Z", @@ -199,7 +199,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:21.659932Z", @@ -213,7 +213,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "24.1 \u03bcs \u00b1 2.27 \u03bcs per loop (mean \u00b1 std. dev. of 7 runs, 10,000 loops each)\n" + "24.1 μs ± 2.27 μs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n" ] } ], @@ -231,7 +231,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:23.748100Z", @@ -245,7 +245,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "28.4 \u03bcs \u00b1 361 ns per loop (mean \u00b1 std. dev. of 7 runs, 10,000 loops each)\n" + "28.4 μs ± 361 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n" ] } ], @@ -265,7 +265,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:27.439187Z", @@ -303,7 +303,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:27.721291Z", @@ -348,7 +348,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:27.822551Z", @@ -417,7 +417,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:28.736227Z", @@ -441,7 +441,7 @@ "Text(0.5, 0.98, 'VMP smoothed beliefs')" ] }, - "execution_count": 10, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" }, @@ -498,7 +498,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 8, "metadata": { "execution": { "iopub.execute_input": "2026-03-06T15:32:28.889131Z", @@ -569,25 +569,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "pymdp_dev_env", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} diff --git a/examples/learning/learning_gridworld.ipynb b/examples/learning/learning_gridworld.ipynb index 689f576f..b3bcd0dd 100644 --- a/examples/learning/learning_gridworld.ipynb +++ b/examples/learning/learning_gridworld.ipynb @@ -16,14 +16,14 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", @@ -1274,4 +1274,4 @@ "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} diff --git a/examples/model_fitting/fitting_with_pybefit.ipynb b/examples/model_fitting/fitting_with_pybefit.ipynb index d1b2576c..b50f503f 100644 --- a/examples/model_fitting/fitting_with_pybefit.ipynb +++ b/examples/model_fitting/fitting_with_pybefit.ipynb @@ -2,6 +2,7 @@ "cells": [ { "cell_type": "markdown", + "id": "0", "metadata": {}, "source": [ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/infer-actively/pymdp/blob/main/examples/model_fitting/fitting_with_pybefit.ipynb)" @@ -10,7 +11,7 @@ { "cell_type": "code", "execution_count": 1, - "id": "0", + "id": "1", "metadata": {}, "outputs": [ { @@ -30,6 +31,7 @@ { "cell_type": "code", "execution_count": null, + "id": "2", "metadata": {}, "outputs": [], "source": [ @@ -41,7 +43,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1", + "id": "3", "metadata": {}, "outputs": [], "source": [ @@ -72,7 +74,7 @@ }, { "cell_type": "markdown", - "id": "2", + "id": "4", "metadata": {}, "source": [ "## Fitting the parameters of active inference agents performing in the `T-Maze` environment\n", @@ -84,7 +86,7 @@ }, { "cell_type": "markdown", - "id": "3", + "id": "5", "metadata": {}, "source": [ "
\n", @@ -102,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4", + "id": "6", "metadata": {}, "outputs": [], "source": [ @@ -135,7 +137,7 @@ { "cell_type": "code", "execution_count": 2, - "id": "5", + "id": "7", "metadata": {}, "outputs": [ { @@ -211,7 +213,7 @@ }, { "cell_type": "markdown", - "id": "6", + "id": "8", "metadata": {}, "source": [ "### Sample from the TMaze environment and visualize the results from one block, showing the expected behavior (visit the cue, then choose an arm)" @@ -220,7 +222,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "7", + "id": "9", "metadata": {}, "outputs": [ { @@ -251,7 +253,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "8", + "id": "10", "metadata": {}, "outputs": [ { @@ -293,7 +295,7 @@ }, { "cell_type": "markdown", - "id": "9", + "id": "11", "metadata": {}, "source": [ "### Inference Method 1: HMC with NUTS\n", @@ -304,7 +306,7 @@ { "cell_type": "code", "execution_count": 5, - "id": "10", + "id": "12", "metadata": {}, "outputs": [ { @@ -344,7 +346,7 @@ }, { "cell_type": "markdown", - "id": "11", + "id": "13", "metadata": {}, "source": [ "### Plot each ground truth parameter alongside their posterior means (mean taken over parallel HMC samples/chains)" @@ -353,7 +355,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "12", + "id": "14", "metadata": {}, "outputs": [ { @@ -391,7 +393,7 @@ }, { "cell_type": "markdown", - "id": "13", + "id": "15", "metadata": {}, "source": [ "### Transform the latent parameter corresponding to the reward probability into probability space and investigate overlap between ground-truth and inferred parameter" @@ -400,7 +402,7 @@ { "cell_type": "code", "execution_count": 7, - "id": "14", + "id": "16", "metadata": {}, "outputs": [ { @@ -455,7 +457,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "15", + "id": "17", "metadata": {}, "outputs": [ { @@ -546,7 +548,7 @@ }, { "cell_type": "markdown", - "id": "16", + "id": "18", "metadata": {}, "source": [ "### Inference Method 2: Black-Box Stochastic Variational Inference\n", @@ -557,7 +559,7 @@ { "cell_type": "code", "execution_count": 9, - "id": "17", + "id": "19", "metadata": {}, "outputs": [ { @@ -597,7 +599,7 @@ }, { "cell_type": "markdown", - "id": "18", + "id": "20", "metadata": {}, "source": [ "### Plot the variational free energy over time (negative ELBO)" @@ -606,7 +608,7 @@ { "cell_type": "code", "execution_count": 10, - "id": "19", + "id": "21", "metadata": {}, "outputs": [ { @@ -636,7 +638,7 @@ }, { "cell_type": "markdown", - "id": "20", + "id": "22", "metadata": {}, "source": [ "### Plot each ground truth parameter alongside their posterior means (mean taken over posterior samples from the guide)" @@ -645,7 +647,7 @@ { "cell_type": "code", "execution_count": 11, - "id": "21", + "id": "23", "metadata": {}, "outputs": [ { @@ -683,7 +685,7 @@ }, { "cell_type": "markdown", - "id": "22", + "id": "24", "metadata": {}, "source": [ "### Transform the latent parameter corresponding to the reward probability into probability space and investigate overlap between ground-truth and inferred parameter" @@ -692,7 +694,7 @@ { "cell_type": "code", "execution_count": 12, - "id": "23", + "id": "25", "metadata": {}, "outputs": [ { @@ -747,7 +749,7 @@ { "cell_type": "code", "execution_count": 13, - "id": "24", + "id": "26", "metadata": {}, "outputs": [ { @@ -831,11 +833,7 @@ ] } ], - "metadata": { - "language_info": { - "name": "python" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/examples/sparse/sparse_benchmark.ipynb b/examples/sparse/sparse_benchmark.ipynb index 8a2b5c87..164f7b7c 100644 --- a/examples/sparse/sparse_benchmark.ipynb +++ b/examples/sparse/sparse_benchmark.ipynb @@ -26,14 +26,14 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import sys\n", "if \"google.colab\" in sys.modules:\n", " %pip install \"inferactively-pymdp\" -q" - ], - "outputs": [], - "execution_count": null + ] }, { "cell_type": "code", @@ -381,4 +381,4 @@ "metadata": {}, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +}