{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {},
"id": "view-in-github"
},
"source": [
"
"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {},
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"# Intro"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {},
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"## Overview\n",
"\n",
"The first two days of NMA are all about the process of modeling and what models are. It’s important to learn about these meta-modeling aspects before diving into different kinds of modeling tools during the remainder of NMA. So today will be about the diversity of models and what different models can do for us. Typically everyone has an intuition about how different analysis tools can extract different kinds of information from experimental data; you choose a different analysis depending on your question. However, this is less appreciated for models. But it’s the same for them; you want to build a different kind of model to answer different kinds of questions. It all depends on your goals. So today, we will examine three kinds of models that we can classify as (according to Dayan and Abbott, 2001): **what**, **how**, and **why** models.\n",
"\n",
"Each tutorial will guide you through one of those models to describe the exact same data: the time interval between neuronal action potentials, aka inter-spike interval (ISI). In tutorial 1, we will ask what function best describes the shape of the ISI distribution (it’s an exponential distribution). Such a “what” model can compactly describe the ISI distribution and allows, for example, to quantify ISI properties across datasets, task conditions, brain areas etc. In tutorial 2, we ask which mechanism could generate the observed ISI distribution. Such a “how” model proposes a specific way that a system produces the observed behavior. Here, you will see that it’s a balance between excitation and inhibition that generates exponentially distributed ISIs. Finally we will ask “why” the exponential distribution is the most optimal way to code information in neurons. “Why” models thus ask about the underlying principles of a phenomenon.\n",
"\n",
"In any research, we typically start with descriptive (“what”) models; you will see examples of those during the model fitting, GLM, dimensionality reduction, and deep learning days. Next, we often ask about the mechanisms and build “how” models to generate or test hypotheses of underlying mechanisms; examples of those will be in linear systems, real neurons, dynamic networks, and decision making days. Ultimately, we are usually interested in the underlying reason of why the phenomenon exists in the first place; examples of those are in Bayes, optimal Control, and reinforcement learning days. “Why” models are often the hardest to achieve; “what” models are usually the easiest. But more importantly, they allow answering different questions, provide different insights and have different utilities. Thinking about the question I want to answer, why I want to answer this question (i.e. my goal) and the hypotheses I want to evaluate determines my own modeling choices every day. The resulting diversity in models is great because all models address different facets of a problem (like in today's 3 tutorials) and are thus complementary in our quest for knowledge. Today’s materials will hopefully allow you to better appreciate the opportunities and limitations offered by all the modeling tools you will learn during NMA."
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"## Prerequisite knowledge\n",
"\n",
"In the content and tutorials today, you will be using derivatives (W0D4 T1), numerical integration (Euler's method) ([W0D4 T3](https://precourse.neuromatch.io/tutorials/W0D4_Calculus/student/W0D4_Tutorial3.html)), and probability distributions ([W0D5 T1](https://precourse.neuromatch.io/tutorials/W0D5_Statistics/student/W0D5_Tutorial1.html)). You will also be using some basic knowledge of neurons ([Neuro Video Series Intro](https://precourse.neuromatch.io/tutorials/W0D0_NeuroVideoSeries/student/W0D0_Tutorial1.html)). Please review these precourse materials if necessary!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {}
},
"outputs": [],
"source": [
"# @title Install and import feedback gadget\n",
"\n",
"!pip3 install vibecheck datatops --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_cn\",\n",
" \"user_key\": \"y1x3mpx5\",\n",
" },\n",
" ).render()\n",
"\n",
"\n",
"feedback_prefix = \"W1D1_Intro\""
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {},
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"## Video"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"# @markdown\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",
"\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",
"\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",
"\n",
"video_ids = [('Youtube', 'W5o_HTsef0I'), ('Bilibili', 'BV1ho4y1C7Eo')]\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": "markdown",
"metadata": {
"execution": {}
},
"source": [
"## Slides"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"# @markdown\n",
"from IPython.display import IFrame\n",
"link_id = \"rbx2a\"\n",
"print(f\"If you want to download the slides: https://osf.io/download/{link_id}/\")\n",
"IFrame(src=f\"https://mfr.ca-1.osf.io/render?url=https://osf.io/{link_id}/?direct%26mode=render%26action=download%26mode=render\", width=854, height=480)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {}
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_Intro_Video\")"
]
}
],
"metadata": {
"colab": {
"collapsed_sections": [],
"include_colab_link": true,
"name": "W1D1_Intro",
"provenance": [],
"toc_visible": true
},
"kernel": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.9.17"
}
},
"nbformat": 4,
"nbformat_minor": 0
}