{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {},
"id": "view-in-github"
},
"source": [
"
"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"# Tutorial [NUMBER]: Tutorial's name\n",
"\n",
"**Week [WEEK_NUMBER], Day [DAY_NUMBER]: [DAY_TOPIC]**\n",
"\n",
"**By Sciencematch Academy** # update to the correct academy\n",
"\n",
"__Content creators:__ Names & Surnames\n",
"\n",
"__Content reviewers:__ Names & Surnames\n",
"\n",
"__Production editors:__ Names & Surnames\n",
"\n",
"
\n",
"\n",
"Acknowledgments: [ACKNOWLEDGMENT_INFORMATION]\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"___\n",
"\n",
"Use a line (---) separator from title block to objectives. \n",
"\n",
"# Tutorial Objectives\n",
"\n",
"*Estimated timing of tutorial: [insert estimated duration of whole tutorial in minutes]*\n",
"\n",
"In this tutorial, you will learn what a tutorial notebook should look like.\n",
"\n",
"\n",
"\n",
"You should briefly introduce your content here in a few sentences. \n",
"\n",
"Then have a few specific objectives for this tutorial, ideally [SMART goals](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5944406/#:~:text=1%20The%20mnemonic%20SMART%E2%80%94Specific,a%20well%2Dwritten%20learning%20objective.&text=Verbs%20such%20as%20understand%2C%20know,measurable%20and%20should%20be%20avoided.). \n",
"\n",
"An example of the expected structure to follow:\n",
"\n",
"**Tutorial Learning Objectives**\n",
"* Learning objective 1\n",
"* Learning objective 2\n",
"* ...\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"Tutorial Slides \"link_id\"s will be added in below by the curriculum or production team. You do not need to do anything but leave the block of code below here."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"# @markdown\n",
"from IPython.display import IFrame\n",
"from ipywidgets import widgets\n",
"out = widgets.Output()\n",
"with out:\n",
" print(f\"If you want to download the slides: https://osf.io/download//\")\n",
" display(IFrame(src=f\"https://mfr.ca-1.osf.io/render?url=https://osf.io//?direct%26mode=render%26action=download%26mode=render\", width=730, height=410))\n",
"display(out)"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"---\n",
"# Setup\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"In this section, we have (please keep the order):\n",
"\n",
"1. **Gadget (optional)**: install and import feedback gadget - not relevant for cliamtematch\n",
"2. **Import cell (required)**: imports all libraries you use in the tutorial\n",
"3. **Hidden Figure settings cell (optional)**: sets up the plotting style (copy exactly).\n",
"4. **Hidden Plotting functions cell (optional)**: should contain all functions used to create plots throughout the tutorial (so students don't waste time looking at boilerplate matplotlib but can here if they wish to). Please use only matplotlib for plotting for consistency.\n",
"5. **Hidden Data retrieval (optional)**: set up the data retrieval needed for the tutorial.\n",
"6. **Hidden Helper functions cell (optional)**: This should contain functions that students have previously used or that are very simple. Any helper functions that are being used for the first time and are important should be placed directly above the relevant text or exercise (see Section 1.1 for an example).\n",
"7. **set random seed (with/out pytorch) and set GPU/CPU (optional)**: several cells that set the seed for repeatability and set the GPU for computations \n",
"\n",
"**Please see comments in the code for instructions on what you need to change, if anything**"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Install and import feedback gadget\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Install and import feedback gadget\n",
"\n",
"# note this is not relevant for climatematch at the moment\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 - leave this as is\n",
" notebook_section,\n",
" {\n",
" \"url\": \"https://pmyvdlilci.execute-api.us-east-1.amazonaws.com/klab\",\n",
" \"name\": \"sciencematch_sm\", # change the name of the course : neuromatch_dl, climatematch_ct, etc\n",
" \"user_key\": \"y1x3mpx5\",\n",
" },\n",
" ).render()\n",
"\n",
"# Define the feedback prefix: Replace 'weeknumber' and 'daynumber' with appropriate values, underscore followed by T(stands for tutorial) and the number of the tutorial\n",
"# e.g., W1D1_T1\n",
"feedback_prefix = \"W*weeknumber*D*daynumber*_T*tutorialNumber*\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {}
},
"outputs": [],
"source": [
"# Imports\n",
"\n",
"# Import only the libraries/objects that you use in this tutorial.\n",
"\n",
"# If any external library has to be installed contact the tech and curriculum chairs so it can be add to the base enviroment\n",
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import logging\n",
"import ipywidgets as widgets # interactive display\n",
"import io\n",
"import requests\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Figure settings\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Figure settings\n",
"\n",
"logging.getLogger('matplotlib.font_manager').disabled = True\n",
"\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format = 'retina' # perfrom high definition rendering for images and plots\n",
"plt.style.use(\"https://raw.githubusercontent.com/NeuromatchAcademy/course-content/main/nma.mplstyle\") # update this to match your course"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plotting functions\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Plotting functions\n",
"\n",
"# add your plotting functions here. below is an example for a basic plotting funciton\n",
"\n",
"logging.getLogger('matplotlib.font_manager').disabled = True\n",
"\n",
"# You may have functions that plot results that aren't\n",
"# particularly interesting. You can add these here to hide them.\n",
"\n",
"# example:\n",
"def plotting_z(z):\n",
" \"\"\"This function multiplies every element in an array by a provided value\n",
"\n",
" Args:\n",
" z (ndarray): neural activity over time, shape (T, ) where T is number of timesteps\n",
"\n",
" \"\"\"\n",
"\n",
" fig, ax = plt.subplots()\n",
"\n",
" ax.plot(z)\n",
" ax.set(\n",
" xlabel='Time (s)',\n",
" ylabel='Z',\n",
" title='Neural activity over time'\n",
" )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Data retrieval\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" This cell downloads the example dataset that we will use in this tutorial.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"#@title Data retrieval\n",
"\n",
"#@markdown This cell downloads the example dataset that we will use in this tutorial.\n",
"\n",
"\n",
"## Uncomment the code below to test your function\n",
"\n",
"\n",
"# Only need to put in the OSF url below, or other cloud based retrievals here\n",
"\n",
"#r = requests.get('') #E.g., ('https://osf.io/sy5xt/download')\n",
"#if r.status_code != 200:\n",
" #print('Failed to download data')\n",
"#else:\n",
" #data = np.load(io.BytesIO(r.content), allow_pickle=True)['data']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Helper functions\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Helper functions\n",
"\n",
"# If any helper functions you want to hide for clarity (that has been seen before\n",
"# or is simple/uniformative), add here\n",
"# If helper code depends on libraries that aren't used elsewhere,\n",
"# import those libaries here, rather than in the main import cell"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Set random seed\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" Executing `set_seed(seed=seed)` you are setting the seed\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Set random seed\n",
"\n",
"# @markdown Executing `set_seed(seed=seed)` you are setting the seed\n",
"\n",
"# E.g., for DL its critical to set the random seed so that students can have a\n",
"# baseline to compare their results to expected results.\n",
"# Read more here: https://pytorch.org/docs/stable/notes/randomness.html\n",
"\n",
"# Call `set_seed` function in the exercises to ensure reproducibility.\n",
"import random\n",
"import numpy as np\n",
"\n",
"def set_seed(seed=None):\n",
" if seed is None:\n",
" seed = np.random.choice(2 ** 32)\n",
" random.seed(seed)\n",
" np.random.seed(seed)\n",
" print(f'Random seed {seed} has been set.')\n",
"\n",
"\n",
"set_seed(seed=2023) # change 2023 with any number you like"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Set random seed, when using `pytorch`\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" Executing `set_seed(seed=seed)` you are setting the seed\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Set random seed, when using `pytorch`\n",
"\n",
"# @markdown Executing `set_seed(seed=seed)` you are setting the seed\n",
"\n",
"# for DL its critical to set the random seed so that students can have a\n",
"# baseline to compare their results to expected results.\n",
"# Read more here: https://pytorch.org/docs/stable/notes/randomness.html\n",
"\n",
"# Call `set_seed` function in the exercises to ensure reproducibility.\n",
"import random\n",
"import torch\n",
"import numpy as np\n",
"\n",
"def set_seed(seed=None, seed_torch=True):\n",
" if seed is None:\n",
" seed = np.random.choice(2 ** 32)\n",
" random.seed(seed)\n",
" np.random.seed(seed)\n",
" if seed_torch:\n",
" torch.manual_seed(seed)\n",
" torch.cuda.manual_seed_all(seed)\n",
" torch.cuda.manual_seed(seed)\n",
" torch.backends.cudnn.benchmark = False\n",
" torch.backends.cudnn.deterministic = True\n",
"\n",
" print(f'Random seed {seed} has been set.')\n",
"\n",
"\n",
"# In case that `DataLoader` is used\n",
"def seed_worker(worker_id):\n",
" worker_seed = torch.initial_seed() % 2**32\n",
" np.random.seed(worker_seed)\n",
" random.seed(worker_seed)\n",
"\n",
"\n",
"set_seed(seed=2021, seed_torch=False) # change 2021 with any number you like"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Set device (GPU or CPU). Execute `set_device()`\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Set device (GPU or CPU). Execute `set_device()`\n",
"# especially if torch modules used.\n",
"\n",
"# inform the user if the notebook uses GPU or CPU.\n",
"\n",
"def set_device():\n",
" device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
" if device != \"cuda\":\n",
" print(\"GPU is not enabled in this notebook. \\n\"\n",
" \"If you want to enable it, in the menu under `Runtime` -> \\n\"\n",
" \"`Hardware accelerator.` and select `GPU` from the dropdown menu\")\n",
" else:\n",
" print(\"GPU is enabled in this notebook. \\n\"\n",
" \"If you want to disable it, in the menu under `Runtime` -> \\n\"\n",
" \"`Hardware accelerator.` and select `None` from the dropdown menu\")\n",
"\n",
" return device"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"---\n",
"\n",
"# Section 1: Example of tutorial structure\n",
"\n",
"The above section header should be a description of what the section covers. It should be a level 1 header.\n",
" \n",
"The curriculum or production team will supply the \"video_id\" variable for youtube, billibilli, and OSF needed in the code below to render the videos when the notebook is executed. You do not need to do anything but change the video title name, please leave this code block here."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Video 1: Video 1 Name # put in the title of your video\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"# @title Video 1: Video 1 Name # put in the title of your video\n",
"# note the libraries are imported here on purpose\n",
"\n",
"###@@@ for konstanine. a question, why isn't this above in the list of cells?\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",
"\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",
"# curriculum or production team will provide these ids\n",
"video_ids = [('Youtube', ''), ('Bilibili', ''), ('Osf', '')]\n",
"tab_contents = display_videos(video_ids, W=730, H=410)\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": [
"- one concept per video\n",
"- many small videos preferable to 1 large video\n",
"- Keep distance between idea and interaction small\n",
"\n",
"\n",
"Do not:\n",
"\n",
"- Speak in mathematical notation\n",
" instead of: as we increase alpha, Say : as we increase the learning rate.\n",
"\n",
" \n",
" \n",
" \n",
"Add text that is meant to suppliment the videos and reiterate the key information. \n",
"\n",
"Below students can rate your content with the feedback gadget:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Submit your feedback\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_Video_1_Name\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"## Section 1.1: Different types of activities in the tutorial (subsection header)\n",
"\n",
"You can have students complete coding exercises, play with interactive demos, or have group discussions. This should be a level 2 header."
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"### Coding Exercise 1.1: Helpful exercise name (e.g., fitting a linear regression model)\n",
"This exercise fits in this subsection so is a level 3 header. We name it after the section it is in.\n",
"\n",
"Very briefly summarize the exercise here. The first exercise should not be too difficult, to serve as a warm-up for students. Outputs of the code cell will ideally be a plot (so students can easily check against the correct one). In limited cases, the output may be printing numbers, text, etc. In that case you need to write the solution output manually after the exercise (E.g.: \"You should see [4, 5, 6] when running the cell above\").\n",
"\n",
"Warn them when they will use a helper function. For example: In this exercise, you will also invoke multiply_array which multiplies an array by a scalar (a silly example).\n",
"\n",
"**Note**: In case of randomness and to ensure reproducibility, do not forget to use a random seed before the exercise or within the function.\n",
"\n",
"The following block of code shows how you can first define functions used in the exercises that you want hidden but do not want to put in the Helper functions section defined above. This keeps the notebooks cleaner by hiding functions, but still keeps relevant functions close to where students will encounter them. Make sure to use the markdown tag at the beginning of the cell, and keep the title of the function in the markdown text so students can still search for it in the notebooks."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" *Execute this cell to enable the array multiplication function: `multiply_array`*\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"pycharm": {
"name": "#%%\n"
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @markdown *Execute this cell to enable the array multiplication function: `multiply_array`*\n",
"\n",
"\n",
"def multiply_array(x, c, seed):\n",
" \"\"\"Multiply every element in an array by a provided value\n",
"\n",
" Args:\n",
" x (ndarray): An array of shape (N,)\n",
" c (scalar): multiplicative factor\n",
" seed (integer): random seed\n",
"\n",
" Returns:\n",
" ndarray: output of the multiplication\n",
" \"\"\"\n",
" np.random.seed(seed)\n",
" y = x * c + 4*np.random.randn()\n",
"\n",
" return y"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"Below is an example of a student exercise. Within each student exercise, there should be a `NotImplementedError` call that stops the notebook from executing fully so that students will pause and complete the exercise. Once they have completed the exercise, they may remove this function so that the cell will execute."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {},
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"def generic_function(x, seed):\n",
" \"\"\"Google style doc string. Brief summary of what function does here\n",
"\n",
" Args:\n",
" x (ndarray): An array of shape (N,) that contains blah blah\n",
" seed (integer): random seed for reproducibility\n",
"\n",
" Returns:\n",
" ndarray: The output is blah blah\n",
" \"\"\"\n",
" #################################################\n",
" ## TODO for students: details of what they should do ##\n",
" # Fill remove the following line of code one you have completed the exercise:\n",
" raise NotImplementedError(\"Student exercise: say what they should have done\")\n",
" #################################################\n",
"\n",
" # Have a comment for every line of code they need to write, and when possible have\n",
" # variables written with ellipses where they should fill in or ellipses where they should\n",
" # fill in inputs to functions\n",
" y = multiply_array(..., 5, seed)\n",
"\n",
" # Another comment because they need to add another line of code\n",
" z = ...\n",
"\n",
" return z\n",
"\n",
"\n",
"x = np.array([4, 5, 6])\n",
"\n",
"# We usually define the plotting function in the hidden Helper Functions\n",
"# so students don't have to see a bunch of boilerplate matplotlib code\n",
"\n",
"## Uncomment the code below to test your function\n",
"\n",
"# z = generic_function(x, seed=2021)\n",
"# plotting_z(z)"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"---\n",
"\n",
"Please note, there **must** be a corresponding 'solution' code cell to all student exercises. These solutions are useful to the teaching assistants in our course as well as for those using the material asynchornously.\n",
"\n",
"***Editor guideline for exercise solution formatting:***\n",
"\n",
"1. Must include `# to_remove solution` in the first line of solution code cell\n",
"2. Do not include the fenced (`#####`) block that raises a `NotImplementedError`\n",
"3. Include valid code replacing all ellipses (`...`)\n",
"4. Code that uses or depends on the completed function/lines is uncommented\n",
"6. **All other comments and code should be identical**\n",
" \n",
"---\n",
"\n",
"An example of a solution cell to the exercise posed above:"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {}
},
"source": [
"[*Click for solution*](https://github.com/neuromatch/course-content-template/tree/main/tutorials/W1D2_Template/solutions/W1D2_Tutorial1_Solution_0323bd5e.py)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Submit your feedback\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_name_of_Exercise\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"---\n",
"\n",
"## Interactive Demo 1.1: Name of demo\n",
"\n",
"Here, we will demonstrate how to create a widget if you would like to use a widget to demonstrate something. Make sure the use a @markdown as the first line in the cell to hide the contents by default, because the code to make the widget is often pretty ugly and not important for the students to see.\n",
"\n",
"If the widget makes use of a function that must be completed as part of an exercise, you may want to re-implement the correct version of the function inside the widget cell, so that it is useful for a student who got completely stuck."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" Make sure you execute this cell to enable the widget!\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @markdown Make sure you execute this cell to enable the widget!\n",
"\n",
"x = np.arange(-10, 11, 0.1)\n",
"\n",
"\n",
"def gaussian(x, mu, sigma):\n",
" px = np.exp(-1 / 2 / sigma**2 * (mu - x) ** 2)\n",
" px = px / px.sum()\n",
" return px\n",
"\n",
"\n",
"@widgets.interact\n",
"def plot_gaussian(mean=(-10, 10, .5), std=(.5, 10, .5)):\n",
" plt.plot(x, gaussian(x, mean, std))"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"There shoud be discussion questions posed about the interactive demo (and coding exercises possibly). "
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"### Interactive Demo 1.1 Discussion\n",
"\n",
"1. Discussion question 1\n",
"2. Discussion question 2"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"You must include an explanation for each discussion question using the following cell as a guide:"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {}
},
"source": [
"[*Click for solution*](https://github.com/neuromatch/course-content-template/tree/main/tutorials/W1D2_Template/solutions/W1D2_Tutorial1_Solution_3e7ecf89.py)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {}
},
"source": [
"[*Click for solution*](https://github.com/neuromatch/course-content-template/tree/main/tutorials/W1D2_Template/solutions/W1D2_Tutorial1_Solution_4b6be039.py)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"---\n",
"\n",
"# Section 2: Notation Standards\n",
"\n",
"Estimated timing to here from start of tutorial: ? \n",
"\n",
"For notation standards, please refer to the course specific day lead instructions here: https://docs.neuromatch.io/p/npByLKa5tvx9kY/Course-Specific-Day-Lead-and-Project-Lead-Instructions"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"---\n",
"\n",
"# Section 3: Name of Section 3\n",
"\n",
"Estimated timing to here from start of tutorial: ?\n",
"\n",
"An additional example section\n",
"\n",
"Separate with lines and add more content here! Depending on how the videos were created, you may or may not have a separate video for each section"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"## Coding Exercise 3: Name\n",
"\n",
"This exercise is in this section (not in a subsection) so has a level 2 header."
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"---\n",
"\n",
"## Think: Name of discussion topic\n",
"\n",
"In addition to code exercises and interactive demos, you can have \"discussion exercises\" where students discuss open-ended questions. Each should roughly replace a code exercise so take about 10 minutes.\n",
"\n",
"E.g.: What do you think contributes to a good learning experience? Take 2 minutes to think in silence, then discuss as a group (~10 minutes).\n",
"\n",
"You can then include an airtable form through which students can write down their thoughts. This helps us to see how students are thinking (as we can read the responses). You should also still include the explanation cell with the answer or some discussion to aid students."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {}
},
"outputs": [],
"source": [
"# airtable\n",
"# relevant_variable_name: text"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"Editor guideline: note that to notify us where you'd like an airtable input form, use this special syntax. The first line is \"#\n",
"\n",
"- First line is # airtable\n",
"- Relevant variable name on the second line should be something related to the question you're asking (an identifier). For example it could be \"learning_experience_contribs\" in this example. It should be a valid Python variable (no spaces, don't start with numbers).\n",
"- You can have different types of inputs: text, numerical, or multiple choice.\n",
"\n",
"If you want a text answer, use # relevant_variable_name: text\n",
"If you want a numerical answer, use # relevant_variable_name: number\n",
"If you want a multiple choice answer, use # relevant_variable_name: [option1, option2, option3] where you fill out what the options are."
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {}
},
"source": [
"[*Click for solution*](https://github.com/neuromatch/course-content-template/tree/main/tutorials/W1D2_Template/solutions/W1D2_Tutorial1_Solution_c8e958f9.py)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Submit your feedback\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_Name_of_Discussion_Topic\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"---\n",
"# Summary\n",
"\n",
"*Estimated timing of tutorial: [minutes]* [provide the estimated time for the completing of the entire tutorail]\n",
"\n",
"Have a summary of what they learned with specific points.\n",
"\n",
"1. Specific point A\n",
"\n",
"2. Specific point B"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"## Bonus: Name of Bonus section\n",
"\n",
"Add extra text that you want students to have for reference later but that will make reading times too long during tutorials. You can have multiple Bonus sections if you'd like, just number them as Bonus 1: Name, Bonus 2: Name, etc.\n",
"\n",
"This can also serve as more advanced content for advanced students or those taking the course asyncrhonously.\n",
"\n",
"You should not have bonus content interleaved into the tutorial."
]
}
],
"metadata": {
"colab": {
"collapsed_sections": [],
"include_colab_link": true,
"name": "W1D2_Tutorial1",
"provenance": [],
"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.18"
}
},
"nbformat": 4,
"nbformat_minor": 4
}