diff --git a/tutorials/README.md b/tutorials/README.md index d22cc88bb..e06965bd6 100644 --- a/tutorials/README.md +++ b/tutorials/README.md @@ -50,7 +50,7 @@ Slides: [Intro](https://mfr.ca-1.osf.io/render?url=https://osf.io/gsuhq/?direct% [YouTube Playlist](https://www.youtube.com/playlist?list=PLkBQOLLbi18O2wSDMRLrZNyKBuRwvoE6K) -Slides: [Intro](https://mfr.ca-1.osf.io/render?url=https://osf.io/g8jzu/?direct%26mode=render%26action=download%26mode=render) | [Tutorials](https://mfr.ca-1.osf.io/render?url=https://osf.io/uwn2g/?direct%26mode=render%26action=download%26mode=render) +Slides: [Intro](https://mfr.ca-1.osf.io/render?url=https://osf.io/g8jzu/?direct%26mode=render%26action=download%26mode=render) | [Tutorials](https://mfr.ca-1.osf.io/render?url=https://osf.io/uwn2g/?direct%26mode=render%26action=download%26mode=render) | [Bonus](https://mfr.ca-1.osf.io/render?url=https://osf.io/8fx23/?direct%26mode=render%26action=download%26mode=render) | | Run | Run | View | | - | --- | --- | ---- | @@ -59,6 +59,7 @@ Slides: [Intro](https://mfr.ca-1.osf.io/render?url=https://osf.io/g8jzu/?direct% | Tutorial 2 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.ipynb?flush_cache=true) | | Tutorial 3 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial3.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial3.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial3.ipynb?flush_cache=true) | | Tutorial 4 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial4.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial4.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial4.ipynb?flush_cache=true) | +| Tutorial 5 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial5.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial5.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial5.ipynb?flush_cache=true) | | Outro | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Outro.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Outro.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Outro.ipynb?flush_cache=true) | diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/README.md b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/README.md index 05688a490..d81374d89 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/README.md +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/README.md @@ -9,6 +9,7 @@ | Tutorial 2 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial2.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial2.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial2.ipynb?flush_cache=true) | | Tutorial 3 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial3.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial3.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial3.ipynb?flush_cache=true) | | Tutorial 4 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial4.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial4.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial4.ipynb?flush_cache=true) | +| Tutorial 5 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial5.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial5.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial5.ipynb?flush_cache=true) | | Outro | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Outro.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Outro.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Outro.ipynb?flush_cache=true) | @@ -21,5 +22,6 @@ | Tutorial 2 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.ipynb?flush_cache=true) | | Tutorial 3 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial3.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial3.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial3.ipynb?flush_cache=true) | | Tutorial 4 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial4.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial4.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial4.ipynb?flush_cache=true) | +| Tutorial 5 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial5.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial5.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial5.ipynb?flush_cache=true) | | Outro | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Outro.ipynb) | [![Open In kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://raw.githubusercontent.com/neuromatch/NeuroAI_Course/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Outro.ipynb) | [![View the notebook](https://img.shields.io/badge/render-nbviewer-orange.svg)](https://nbviewer.jupyter.org/github/neuromatch/NeuroAI_Course/blob/main/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Outro.ipynb?flush_cache=true) | diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial1.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial1.ipynb index e23fbfddc..d7fe7aa44 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial1.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial1.ipynb @@ -110,7 +110,6 @@ "outputs": [], "source": [ "# @title Install dependencies\n", - "# @markdown Notice that you need to uncomment some of the lines below\n", "\n", "!pip install -q ipympl ipywidgets mpl_interactions[\"jupyter\"] rsatoolbox torchlens\n", "!pip install -q graphviz\n", @@ -1196,17 +1195,8 @@ "# @title Extract model features with torchlens\n", "\n", "return_layers = ['input_1', 'conv1', 'conv2', 'fc1', 'fc2']\n", - "features_model_imgs = extract_features(model, imgs, return_layers, plot = 'rolled') #comment this line if Graphviz installation was unsuccessful for you" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "execution": {} - }, - "outputs": [], - "source": [ + "features_model_imgs = extract_features(model, imgs, return_layers, plot = 'rolled') #comment this line if Graphviz installation was unsuccessful for you\n", + "\n", "features_model_advimgs = extract_features(model, adv_imgs, return_layers)\n", "features_advmodel_imgs = extract_features(model_robust, imgs, return_layers)\n", "features_advmodel_advimgs = extract_features(model_robust, adv_imgs_advmodel, return_layers)" diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial2.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial2.ipynb index d9a97060d..a0a826dbc 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial2.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial2.ipynb @@ -90,7 +90,7 @@ "source": [ "# @title Install and import feedback gadget\n", "\n", - "!pip install torch torchvision matplotlib numpy scikit-learn rsatoolbox scipy --quiet\n", + "!pip install torch torchvision matplotlib numpy scikit-learn rsatoolbox scipy vibecheck --quiet\n", "\n", "from vibecheck import DatatopsContentReviewContainer\n", "def content_review(notebook_section: str):\n", @@ -117,6 +117,8 @@ }, "outputs": [], "source": [ + "# @title Import dependencies\n", + "\n", "# Standard library imports\n", "from collections import OrderedDict\n", "import logging\n", diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial3.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial3.ipynb index cb6bf7e9c..aaecdc1a5 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial3.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial3.ipynb @@ -102,7 +102,7 @@ "source": [ "# @title Install and import feedback gadget\n", "\n", - "!pip install numpy pandas torch torchvision matplotlib ipython Pillow rsatoolbox plotly networkx requests --quiet\n", + "!pip install numpy pandas torch torchvision matplotlib ipython Pillow rsatoolbox plotly networkx requests vibecheck --quiet\n", "\n", "from vibecheck import DatatopsContentReviewContainer\n", "def content_review(notebook_section: str):\n", @@ -1674,7 +1674,7 @@ "execution": {} }, "source": [ - "## Coding Exercise 1: RDMS of AlexNet\n", + "## Coding Exercise 1: RDMs of AlexNet\n", "\n", "Use the RSA toolbox to compute the RDMs for the layers of AlexNet." ] diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial4.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial4.ipynb index c0697717a..271ac74ff 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial4.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial4.ipynb @@ -582,7 +582,7 @@ " ax[i].set_xlabel(\"dimensionality\", fontsize=7)\n", " ax[i].tick_params(axis='both', which='major', labelsize=5)\n", " ax[i].axhline(y=true_dist[n_neurons], linestyle=\"dashed\", color=\"gray\")\n", - " ax[i].text(n_dims_list[-1], true_dist[n_neurons], 'true euclidean distance', color='gray', ha='right', va='top', fontsize=8)\n", + " ax[i].text(n_dims_list[-1], true_dist[n_neurons], 'true euclidean distance', color='gray', ha='right', va='top', fontsize=4)\n", " title = \"two neurons\" if n_neurons == 2 else \"100 neurons\"\n", " ax[i].set_title(title, fontsize=7)\n", " plt.tight_layout()" diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial5.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial5.ipynb new file mode 100644 index 000000000..a708fa967 --- /dev/null +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/W1D3_Tutorial5.ipynb @@ -0,0 +1,199 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "4e3d2b26-a059-4683-8bfd-2499a50eb346", + "metadata": { + "execution": {} + }, + "source": [ + "\"Open   \"Open" + ] + }, + { + "cell_type": "markdown", + "id": "22d5410f-0745-4a99-a40f-cd591c3b4d45", + "metadata": { + "execution": {} + }, + "source": [ + "# Bonus Material: Dynamical similarity analysis (DSA)\n", + "\n", + "**Week 1, Day 3: Comparing Artificial And Biological Networks**\n", + "\n", + "**By Neuromatch Academy**\n", + "\n", + "__Content creators:__ Mitchell Ostrow\n", + "\n", + "__Content reviewers:__ Xaq Pitkow, Hlib Solodzhuk\n", + "\n", + "__Production editors:__ Konstantine Tsafatinos, Ella Batty, Spiros Chavlis, Samuele Bolotta, Hlib Solodzhuk, Patrick Mineault\n" + ] + }, + { + "cell_type": "markdown", + "id": "bb3777bf-2134-47c9-9768-aec75a57a6c7", + "metadata": { + "execution": {} + }, + "source": [ + "This short notebook expands the toolset of network comparison by taking a look at another important dimension for analysis - time. In particular, it would be beneficial to understand how the systems evolve over time and whether their dynamics are similar. The presented materials are the most similar to the ones introduced in [Tutorial 2](https://neuroai.neuromatch.io/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.html) for this day, and one of the projects on [Comparing Networks](https://neuroai.neuromatch.io/projects/project-notebooks/ComparingNetworks.html) is exactly about DSA." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a08f673e-3657-47aa-aeb0-08c55904bd6d", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Install and import feedback gadget\n", + "\n", + "!pip install vibecheck --quiet\n", + "\n", + "from vibecheck import DatatopsContentReviewContainer\n", + "def content_review(notebook_section: str):\n", + " return DatatopsContentReviewContainer(\n", + " \"\", # No text prompt\n", + " notebook_section,\n", + " {\n", + " \"url\": \"https://pmyvdlilci.execute-api.us-east-1.amazonaws.com/klab\",\n", + " \"name\": \"neuromatch_neuroai\",\n", + " \"user_key\": \"wb2cxze8\",\n", + " },\n", + " ).render()\n", + "\n", + "\n", + "feedback_prefix = \"W1D3_Bonus\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c28a92e7-e76c-48de-b574-15a1272717cf", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Bonus material slides\n", + "\n", + "from IPython.display import IFrame\n", + "from ipywidgets import widgets\n", + "out = widgets.Output()\n", + "\n", + "link_id = \"8fx23\"\n", + "\n", + "with out:\n", + " print(f\"If you want to download the slides: https://osf.io/download/{link_id}/\")\n", + " display(IFrame(src=f\"https://mfr.ca-1.osf.io/render?url=https://osf.io/{link_id}/?direct%26mode=render%26action=download%26mode=render\", width=730, height=410))\n", + "display(out)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b5d6178f-ddf5-41ae-b676-15e452dc8b78", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Video 1: Dynamical Similarity Analysis\n", + "\n", + "from ipywidgets import widgets\n", + "from IPython.display import YouTubeVideo\n", + "from IPython.display import IFrame\n", + "from IPython.display import display\n", + "\n", + "class PlayVideo(IFrame):\n", + " def __init__(self, id, source, page=1, width=400, height=300, **kwargs):\n", + " self.id = id\n", + " if source == 'Bilibili':\n", + " src = f'https://player.bilibili.com/player.html?bvid={id}&page={page}'\n", + " elif source == 'Osf':\n", + " src = f'https://mfr.ca-1.osf.io/render?url=https://osf.io/download/{id}/?direct%26mode=render'\n", + " super(PlayVideo, self).__init__(src, width, height, **kwargs)\n", + "\n", + "def display_videos(video_ids, W=400, H=300, fs=1):\n", + " tab_contents = []\n", + " for i, video_id in enumerate(video_ids):\n", + " out = widgets.Output()\n", + " with out:\n", + " if video_ids[i][0] == 'Youtube':\n", + " video = YouTubeVideo(id=video_ids[i][1], width=W,\n", + " height=H, fs=fs, rel=0)\n", + " print(f'Video available at https://youtube.com/watch?v={video.id}')\n", + " else:\n", + " video = PlayVideo(id=video_ids[i][1], source=video_ids[i][0], width=W,\n", + " height=H, fs=fs, autoplay=False)\n", + " if video_ids[i][0] == 'Bilibili':\n", + " print(f'Video available at https://www.bilibili.com/video/{video.id}')\n", + " elif video_ids[i][0] == 'Osf':\n", + " print(f'Video available at https://osf.io/{video.id}')\n", + " display(video)\n", + " tab_contents.append(out)\n", + " return tab_contents\n", + "\n", + "video_ids = [('Youtube', 'ppW9BmOr790'), ('Bilibili', '')]\n", + "tab_contents = display_videos(video_ids, W=854, H=480)\n", + "tabs = widgets.Tab()\n", + "tabs.children = tab_contents\n", + "for i in range(len(tab_contents)):\n", + " tabs.set_title(i, video_ids[i][0])\n", + "display(tabs)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d2ce83bc-7e86-44d3-a40a-4ad46fd5a6df", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Submit your feedback\n", + "content_review(f\"{feedback_prefix}_DSA_video\")" + ] + } + ], + "metadata": { + "colab": { + "collapsed_sections": [], + "include_colab_link": true, + "name": "W1D3_Tutorial5", + "toc_visible": true + }, + "kernel": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.9.19" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial1.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial1.ipynb index e23fbfddc..d7fe7aa44 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial1.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial1.ipynb @@ -110,7 +110,6 @@ "outputs": [], "source": [ "# @title Install dependencies\n", - "# @markdown Notice that you need to uncomment some of the lines below\n", "\n", "!pip install -q ipympl ipywidgets mpl_interactions[\"jupyter\"] rsatoolbox torchlens\n", "!pip install -q graphviz\n", @@ -1196,17 +1195,8 @@ "# @title Extract model features with torchlens\n", "\n", "return_layers = ['input_1', 'conv1', 'conv2', 'fc1', 'fc2']\n", - "features_model_imgs = extract_features(model, imgs, return_layers, plot = 'rolled') #comment this line if Graphviz installation was unsuccessful for you" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "execution": {} - }, - "outputs": [], - "source": [ + "features_model_imgs = extract_features(model, imgs, return_layers, plot = 'rolled') #comment this line if Graphviz installation was unsuccessful for you\n", + "\n", "features_model_advimgs = extract_features(model, adv_imgs, return_layers)\n", "features_advmodel_imgs = extract_features(model_robust, imgs, return_layers)\n", "features_advmodel_advimgs = extract_features(model_robust, adv_imgs_advmodel, return_layers)" diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial2.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial2.ipynb index bdac1b1bb..2075f3813 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial2.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial2.ipynb @@ -90,7 +90,7 @@ "source": [ "# @title Install and import feedback gadget\n", "\n", - "!pip install torch torchvision matplotlib numpy scikit-learn rsatoolbox scipy --quiet\n", + "!pip install torch torchvision matplotlib numpy scikit-learn rsatoolbox scipy vibecheck --quiet\n", "\n", "from vibecheck import DatatopsContentReviewContainer\n", "def content_review(notebook_section: str):\n", @@ -117,6 +117,8 @@ }, "outputs": [], "source": [ + "# @title Import dependencies\n", + "\n", "# Standard library imports\n", "from collections import OrderedDict\n", "import logging\n", diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial3.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial3.ipynb index a31ccd020..923596528 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial3.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial3.ipynb @@ -102,7 +102,7 @@ "source": [ "# @title Install and import feedback gadget\n", "\n", - "!pip install numpy pandas torch torchvision matplotlib ipython Pillow rsatoolbox plotly networkx requests --quiet\n", + "!pip install numpy pandas torch torchvision matplotlib ipython Pillow rsatoolbox plotly networkx requests vibecheck --quiet\n", "\n", "from vibecheck import DatatopsContentReviewContainer\n", "def content_review(notebook_section: str):\n", @@ -1674,7 +1674,7 @@ "execution": {} }, "source": [ - "## Coding Exercise 1: RDMS of AlexNet\n", + "## Coding Exercise 1: RDMs of AlexNet\n", "\n", "Use the RSA toolbox to compute the RDMs for the layers of AlexNet." ] diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial4.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial4.ipynb index 15635ca10..174b01f71 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial4.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial4.ipynb @@ -582,7 +582,7 @@ " ax[i].set_xlabel(\"dimensionality\", fontsize=7)\n", " ax[i].tick_params(axis='both', which='major', labelsize=5)\n", " ax[i].axhline(y=true_dist[n_neurons], linestyle=\"dashed\", color=\"gray\")\n", - " ax[i].text(n_dims_list[-1], true_dist[n_neurons], 'true euclidean distance', color='gray', ha='right', va='top', fontsize=8)\n", + " ax[i].text(n_dims_list[-1], true_dist[n_neurons], 'true euclidean distance', color='gray', ha='right', va='top', fontsize=4)\n", " title = \"two neurons\" if n_neurons == 2 else \"100 neurons\"\n", " ax[i].set_title(title, fontsize=7)\n", " plt.tight_layout()" diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial5.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial5.ipynb new file mode 100644 index 000000000..a708fa967 --- /dev/null +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/instructor/W1D3_Tutorial5.ipynb @@ -0,0 +1,199 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "4e3d2b26-a059-4683-8bfd-2499a50eb346", + "metadata": { + "execution": {} + }, + "source": [ + "\"Open   \"Open" + ] + }, + { + "cell_type": "markdown", + "id": "22d5410f-0745-4a99-a40f-cd591c3b4d45", + "metadata": { + "execution": {} + }, + "source": [ + "# Bonus Material: Dynamical similarity analysis (DSA)\n", + "\n", + "**Week 1, Day 3: Comparing Artificial And Biological Networks**\n", + "\n", + "**By Neuromatch Academy**\n", + "\n", + "__Content creators:__ Mitchell Ostrow\n", + "\n", + "__Content reviewers:__ Xaq Pitkow, Hlib Solodzhuk\n", + "\n", + "__Production editors:__ Konstantine Tsafatinos, Ella Batty, Spiros Chavlis, Samuele Bolotta, Hlib Solodzhuk, Patrick Mineault\n" + ] + }, + { + "cell_type": "markdown", + "id": "bb3777bf-2134-47c9-9768-aec75a57a6c7", + "metadata": { + "execution": {} + }, + "source": [ + "This short notebook expands the toolset of network comparison by taking a look at another important dimension for analysis - time. In particular, it would be beneficial to understand how the systems evolve over time and whether their dynamics are similar. The presented materials are the most similar to the ones introduced in [Tutorial 2](https://neuroai.neuromatch.io/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.html) for this day, and one of the projects on [Comparing Networks](https://neuroai.neuromatch.io/projects/project-notebooks/ComparingNetworks.html) is exactly about DSA." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a08f673e-3657-47aa-aeb0-08c55904bd6d", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Install and import feedback gadget\n", + "\n", + "!pip install vibecheck --quiet\n", + "\n", + "from vibecheck import DatatopsContentReviewContainer\n", + "def content_review(notebook_section: str):\n", + " return DatatopsContentReviewContainer(\n", + " \"\", # No text prompt\n", + " notebook_section,\n", + " {\n", + " \"url\": \"https://pmyvdlilci.execute-api.us-east-1.amazonaws.com/klab\",\n", + " \"name\": \"neuromatch_neuroai\",\n", + " \"user_key\": \"wb2cxze8\",\n", + " },\n", + " ).render()\n", + "\n", + "\n", + "feedback_prefix = \"W1D3_Bonus\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c28a92e7-e76c-48de-b574-15a1272717cf", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Bonus material slides\n", + "\n", + "from IPython.display import IFrame\n", + "from ipywidgets import widgets\n", + "out = widgets.Output()\n", + "\n", + "link_id = \"8fx23\"\n", + "\n", + "with out:\n", + " print(f\"If you want to download the slides: https://osf.io/download/{link_id}/\")\n", + " display(IFrame(src=f\"https://mfr.ca-1.osf.io/render?url=https://osf.io/{link_id}/?direct%26mode=render%26action=download%26mode=render\", width=730, height=410))\n", + "display(out)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b5d6178f-ddf5-41ae-b676-15e452dc8b78", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Video 1: Dynamical Similarity Analysis\n", + "\n", + "from ipywidgets import widgets\n", + "from IPython.display import YouTubeVideo\n", + "from IPython.display import IFrame\n", + "from IPython.display import display\n", + "\n", + "class PlayVideo(IFrame):\n", + " def __init__(self, id, source, page=1, width=400, height=300, **kwargs):\n", + " self.id = id\n", + " if source == 'Bilibili':\n", + " src = f'https://player.bilibili.com/player.html?bvid={id}&page={page}'\n", + " elif source == 'Osf':\n", + " src = f'https://mfr.ca-1.osf.io/render?url=https://osf.io/download/{id}/?direct%26mode=render'\n", + " super(PlayVideo, self).__init__(src, width, height, **kwargs)\n", + "\n", + "def display_videos(video_ids, W=400, H=300, fs=1):\n", + " tab_contents = []\n", + " for i, video_id in enumerate(video_ids):\n", + " out = widgets.Output()\n", + " with out:\n", + " if video_ids[i][0] == 'Youtube':\n", + " video = YouTubeVideo(id=video_ids[i][1], width=W,\n", + " height=H, fs=fs, rel=0)\n", + " print(f'Video available at https://youtube.com/watch?v={video.id}')\n", + " else:\n", + " video = PlayVideo(id=video_ids[i][1], source=video_ids[i][0], width=W,\n", + " height=H, fs=fs, autoplay=False)\n", + " if video_ids[i][0] == 'Bilibili':\n", + " print(f'Video available at https://www.bilibili.com/video/{video.id}')\n", + " elif video_ids[i][0] == 'Osf':\n", + " print(f'Video available at https://osf.io/{video.id}')\n", + " display(video)\n", + " tab_contents.append(out)\n", + " return tab_contents\n", + "\n", + "video_ids = [('Youtube', 'ppW9BmOr790'), ('Bilibili', '')]\n", + "tab_contents = display_videos(video_ids, W=854, H=480)\n", + "tabs = widgets.Tab()\n", + "tabs.children = tab_contents\n", + "for i in range(len(tab_contents)):\n", + " tabs.set_title(i, video_ids[i][0])\n", + "display(tabs)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d2ce83bc-7e86-44d3-a40a-4ad46fd5a6df", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Submit your feedback\n", + "content_review(f\"{feedback_prefix}_DSA_video\")" + ] + } + ], + "metadata": { + "colab": { + "collapsed_sections": [], + "include_colab_link": true, + "name": "W1D3_Tutorial5", + "toc_visible": true + }, + "kernel": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.9.19" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/static/W1D3_Tutorial4_Solution_1ac2083f_0.png b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/static/W1D3_Tutorial4_Solution_1ac2083f_0.png index 0049c6705..76096fe12 100644 Binary files a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/static/W1D3_Tutorial4_Solution_1ac2083f_0.png and b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/static/W1D3_Tutorial4_Solution_1ac2083f_0.png differ diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial1.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial1.ipynb index 792fc35ed..0f9972f6c 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial1.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial1.ipynb @@ -110,7 +110,6 @@ "outputs": [], "source": [ "# @title Install dependencies\n", - "# @markdown Notice that you need to uncomment some of the lines below\n", "\n", "!pip install -q ipympl ipywidgets mpl_interactions[\"jupyter\"] rsatoolbox torchlens\n", "!pip install -q graphviz\n", @@ -1196,17 +1195,8 @@ "# @title Extract model features with torchlens\n", "\n", "return_layers = ['input_1', 'conv1', 'conv2', 'fc1', 'fc2']\n", - "features_model_imgs = extract_features(model, imgs, return_layers, plot = 'rolled') #comment this line if Graphviz installation was unsuccessful for you" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "execution": {} - }, - "outputs": [], - "source": [ + "features_model_imgs = extract_features(model, imgs, return_layers, plot = 'rolled') #comment this line if Graphviz installation was unsuccessful for you\n", + "\n", "features_model_advimgs = extract_features(model, adv_imgs, return_layers)\n", "features_advmodel_imgs = extract_features(model_robust, imgs, return_layers)\n", "features_advmodel_advimgs = extract_features(model_robust, adv_imgs_advmodel, return_layers)" diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.ipynb index 1eb6a3c0f..3c0c0da43 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.ipynb @@ -90,7 +90,7 @@ "source": [ "# @title Install and import feedback gadget\n", "\n", - "!pip install torch torchvision matplotlib numpy scikit-learn rsatoolbox scipy --quiet\n", + "!pip install torch torchvision matplotlib numpy scikit-learn rsatoolbox scipy vibecheck --quiet\n", "\n", "from vibecheck import DatatopsContentReviewContainer\n", "def content_review(notebook_section: str):\n", @@ -117,6 +117,8 @@ }, "outputs": [], "source": [ + "# @title Import dependencies\n", + "\n", "# Standard library imports\n", "from collections import OrderedDict\n", "import logging\n", diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial3.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial3.ipynb index bcc386c33..42188c4e4 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial3.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial3.ipynb @@ -102,7 +102,7 @@ "source": [ "# @title Install and import feedback gadget\n", "\n", - "!pip install numpy pandas torch torchvision matplotlib ipython Pillow rsatoolbox plotly networkx requests --quiet\n", + "!pip install numpy pandas torch torchvision matplotlib ipython Pillow rsatoolbox plotly networkx requests vibecheck --quiet\n", "\n", "from vibecheck import DatatopsContentReviewContainer\n", "def content_review(notebook_section: str):\n", @@ -1674,7 +1674,7 @@ "execution": {} }, "source": [ - "## Coding Exercise 1: RDMS of AlexNet\n", + "## Coding Exercise 1: RDMs of AlexNet\n", "\n", "Use the RSA toolbox to compute the RDMs for the layers of AlexNet." ] diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial4.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial4.ipynb index 91ca93b24..6aaeda484 100644 --- a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial4.ipynb +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial4.ipynb @@ -582,7 +582,7 @@ " ax[i].set_xlabel(\"dimensionality\", fontsize=7)\n", " ax[i].tick_params(axis='both', which='major', labelsize=5)\n", " ax[i].axhline(y=true_dist[n_neurons], linestyle=\"dashed\", color=\"gray\")\n", - " ax[i].text(n_dims_list[-1], true_dist[n_neurons], 'true euclidean distance', color='gray', ha='right', va='top', fontsize=8)\n", + " ax[i].text(n_dims_list[-1], true_dist[n_neurons], 'true euclidean distance', color='gray', ha='right', va='top', fontsize=4)\n", " title = \"two neurons\" if n_neurons == 2 else \"100 neurons\"\n", " ax[i].set_title(title, fontsize=7)\n", " plt.tight_layout()" diff --git a/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial5.ipynb b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial5.ipynb new file mode 100644 index 000000000..a708fa967 --- /dev/null +++ b/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial5.ipynb @@ -0,0 +1,199 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "4e3d2b26-a059-4683-8bfd-2499a50eb346", + "metadata": { + "execution": {} + }, + "source": [ + "\"Open   \"Open" + ] + }, + { + "cell_type": "markdown", + "id": "22d5410f-0745-4a99-a40f-cd591c3b4d45", + "metadata": { + "execution": {} + }, + "source": [ + "# Bonus Material: Dynamical similarity analysis (DSA)\n", + "\n", + "**Week 1, Day 3: Comparing Artificial And Biological Networks**\n", + "\n", + "**By Neuromatch Academy**\n", + "\n", + "__Content creators:__ Mitchell Ostrow\n", + "\n", + "__Content reviewers:__ Xaq Pitkow, Hlib Solodzhuk\n", + "\n", + "__Production editors:__ Konstantine Tsafatinos, Ella Batty, Spiros Chavlis, Samuele Bolotta, Hlib Solodzhuk, Patrick Mineault\n" + ] + }, + { + "cell_type": "markdown", + "id": "bb3777bf-2134-47c9-9768-aec75a57a6c7", + "metadata": { + "execution": {} + }, + "source": [ + "This short notebook expands the toolset of network comparison by taking a look at another important dimension for analysis - time. In particular, it would be beneficial to understand how the systems evolve over time and whether their dynamics are similar. The presented materials are the most similar to the ones introduced in [Tutorial 2](https://neuroai.neuromatch.io/tutorials/W1D3_ComparingArtificialAndBiologicalNetworks/student/W1D3_Tutorial2.html) for this day, and one of the projects on [Comparing Networks](https://neuroai.neuromatch.io/projects/project-notebooks/ComparingNetworks.html) is exactly about DSA." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a08f673e-3657-47aa-aeb0-08c55904bd6d", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Install and import feedback gadget\n", + "\n", + "!pip install vibecheck --quiet\n", + "\n", + "from vibecheck import DatatopsContentReviewContainer\n", + "def content_review(notebook_section: str):\n", + " return DatatopsContentReviewContainer(\n", + " \"\", # No text prompt\n", + " notebook_section,\n", + " {\n", + " \"url\": \"https://pmyvdlilci.execute-api.us-east-1.amazonaws.com/klab\",\n", + " \"name\": \"neuromatch_neuroai\",\n", + " \"user_key\": \"wb2cxze8\",\n", + " },\n", + " ).render()\n", + "\n", + "\n", + "feedback_prefix = \"W1D3_Bonus\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c28a92e7-e76c-48de-b574-15a1272717cf", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Bonus material slides\n", + "\n", + "from IPython.display import IFrame\n", + "from ipywidgets import widgets\n", + "out = widgets.Output()\n", + "\n", + "link_id = \"8fx23\"\n", + "\n", + "with out:\n", + " print(f\"If you want to download the slides: https://osf.io/download/{link_id}/\")\n", + " display(IFrame(src=f\"https://mfr.ca-1.osf.io/render?url=https://osf.io/{link_id}/?direct%26mode=render%26action=download%26mode=render\", width=730, height=410))\n", + "display(out)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b5d6178f-ddf5-41ae-b676-15e452dc8b78", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Video 1: Dynamical Similarity Analysis\n", + "\n", + "from ipywidgets import widgets\n", + "from IPython.display import YouTubeVideo\n", + "from IPython.display import IFrame\n", + "from IPython.display import display\n", + "\n", + "class PlayVideo(IFrame):\n", + " def __init__(self, id, source, page=1, width=400, height=300, **kwargs):\n", + " self.id = id\n", + " if source == 'Bilibili':\n", + " src = f'https://player.bilibili.com/player.html?bvid={id}&page={page}'\n", + " elif source == 'Osf':\n", + " src = f'https://mfr.ca-1.osf.io/render?url=https://osf.io/download/{id}/?direct%26mode=render'\n", + " super(PlayVideo, self).__init__(src, width, height, **kwargs)\n", + "\n", + "def display_videos(video_ids, W=400, H=300, fs=1):\n", + " tab_contents = []\n", + " for i, video_id in enumerate(video_ids):\n", + " out = widgets.Output()\n", + " with out:\n", + " if video_ids[i][0] == 'Youtube':\n", + " video = YouTubeVideo(id=video_ids[i][1], width=W,\n", + " height=H, fs=fs, rel=0)\n", + " print(f'Video available at https://youtube.com/watch?v={video.id}')\n", + " else:\n", + " video = PlayVideo(id=video_ids[i][1], source=video_ids[i][0], width=W,\n", + " height=H, fs=fs, autoplay=False)\n", + " if video_ids[i][0] == 'Bilibili':\n", + " print(f'Video available at https://www.bilibili.com/video/{video.id}')\n", + " elif video_ids[i][0] == 'Osf':\n", + " print(f'Video available at https://osf.io/{video.id}')\n", + " display(video)\n", + " tab_contents.append(out)\n", + " return tab_contents\n", + "\n", + "video_ids = [('Youtube', 'ppW9BmOr790'), ('Bilibili', '')]\n", + "tab_contents = display_videos(video_ids, W=854, H=480)\n", + "tabs = widgets.Tab()\n", + "tabs.children = tab_contents\n", + "for i in range(len(tab_contents)):\n", + " tabs.set_title(i, video_ids[i][0])\n", + "display(tabs)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d2ce83bc-7e86-44d3-a40a-4ad46fd5a6df", + "metadata": { + "cellView": "form", + "execution": {} + }, + "outputs": [], + "source": [ + "# @title Submit your feedback\n", + "content_review(f\"{feedback_prefix}_DSA_video\")" + ] + } + ], + "metadata": { + "colab": { + "collapsed_sections": [], + "include_colab_link": true, + "name": "W1D3_Tutorial5", + "toc_visible": true + }, + "kernel": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.9.19" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tutorials/materials.yml b/tutorials/materials.yml index 639978873..ed495e462 100644 --- a/tutorials/materials.yml +++ b/tutorials/materials.yml @@ -37,7 +37,9 @@ title: Intro - link: https://mfr.ca-1.osf.io/render?url=https://osf.io/uwn2g/?direct%26mode=render%26action=download%26mode=render title: Tutorials - tutorials: 4 + - link: https://mfr.ca-1.osf.io/render?url=https://osf.io/8fx23/?direct%26mode=render%26action=download%26mode=render + title: Bonus + tutorials: 5 - day: W1D5 category: Architectures