From e754c82b7e5a58c1d6f36c7695a0174679aa2c33 Mon Sep 17 00:00:00 2001 From: Louie Date: Fri, 6 Dec 2024 02:29:51 +0100 Subject: [PATCH] Initial update function added --- .../notebooks/Latent_var_notebook.ipynb | 65 ++++++++++++++++--- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/docs/source/notebooks/Latent_var_notebook.ipynb b/docs/source/notebooks/Latent_var_notebook.ipynb index 659241c10..052752605 100644 --- a/docs/source/notebooks/Latent_var_notebook.ipynb +++ b/docs/source/notebooks/Latent_var_notebook.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -24,7 +24,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -134,7 +134,7 @@ "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 5, @@ -217,7 +217,7 @@ "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 7, @@ -241,7 +241,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -373,7 +373,7 @@ "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 14, @@ -387,13 +387,23 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 28, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{-1: {'time_step': 0.0}, 0: {'mean': 0.0, 'expected_mean': 0.0, 'precision': 10000.0, 'expected_precision': 1.0, 'volatility_coupling_children': None, 'volatility_coupling_parents': (1.0,), 'value_coupling_children': None, 'value_coupling_parents': (1.0,), 'tonic_volatility': 0.0, 'tonic_drift': 0.0, 'autoconnection_strength': 0.0, 'observed': 1, 'temp': {'effective_precision': 0.0, 'value_prediction_error': 0.0, 'volatility_prediction_error': 0.0}}, 1: {'mean': 1.0357, 'expected_mean': 0.0, 'precision': 10000.0, 'expected_precision': 1.0, 'volatility_coupling_children': None, 'volatility_coupling_parents': None, 'value_coupling_children': (1.0,), 'value_coupling_parents': None, 'tonic_volatility': -13.0, 'tonic_drift': 0.0, 'autoconnection_strength': 1.0, 'observed': 1, 'temp': {'effective_precision': 0.0, 'value_prediction_error': 0.0, 'volatility_prediction_error': 0.0}}, 2: {'mean': 0.0, 'expected_mean': 0.0, 'precision': 10.0, 'expected_precision': 1.0, 'volatility_coupling_children': (1.0,), 'volatility_coupling_parents': None, 'value_coupling_children': None, 'value_coupling_parents': None, 'tonic_volatility': -2.0, 'tonic_drift': 0.0, 'autoconnection_strength': 1.0, 'observed': 1, 'temp': {'effective_precision': 0.0, 'value_prediction_error': 0.0, 'volatility_prediction_error': 0.0}}}\n" + ] + } + ], "source": [ "attributes, edges, update_sequence = (\n", " max_latent_hgf.get_network()\n", - ")" + ")\n", + "\n", + "print(attributes)" ] }, { @@ -461,6 +471,43 @@ "responses = jnp.asarray(responses) # vector of responses" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "ename": "IndentationError", + "evalue": "expected an indented block after function definition on line 5 (1391147169.py, line 8)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m Cell \u001b[1;32mIn[26], line 8\u001b[1;36m\u001b[0m\n\u001b[1;33m attributes, edges = (\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mIndentationError\u001b[0m\u001b[1;31m:\u001b[0m expected an indented block after function definition on line 5\n" + ] + } + ], + "source": [ + " # Latent Update function\n", + "\n", + "def Latent_update(\n", + " network: Network,\n", + " attributes: Dict,\n", + " edges: Edges,\n", + " index: int\n", + " ):\n", + "\n", + " attributes, edges = (\n", + " Network.get_network()\n", + " )\n", + "\n", + " #add node to attributes\n", + "\n", + " #Add coupling: Attempted use of \"add_edges\" function\n", + " attributes, edges = add_edges(attributes, edges, 'value', new_node_idx, index)\n", + "\n", + " # ??? Create new network entirely? or alter existing network and return previous network altered\n", + " return network\n" + ] + }, { "cell_type": "code", "execution_count": null,