Skip to content

Commit 5e7eddd

Browse files
committed
Make push-pages
1 parent fae9cd0 commit 5e7eddd

10 files changed

+143
-130
lines changed

_sources/notebooks/shortclips/merged_for_colab.ipynb

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"metadata": {},
66
"source": [
77
"\n",
8-
"# 00_setup_colab.ipynb\n"
8+
"# 01_setup_colab.ipynb\n"
99
]
1010
},
1111
{
@@ -16,8 +16,12 @@
1616
"# Setup Google Colab\n",
1717
"\n",
1818
"In this script, we setup a Google Colab environment. This script will only work\n",
19-
"when run from [Google Colab](https://colab.research.google.com/)). You can\n",
20-
"skip it if you run the tutorials on your machine.\n"
19+
"when run from [Google Colab](https://colab.research.google.com/). You can\n",
20+
"skip it if you run the tutorials on your machine.\n",
21+
"\n",
22+
"> **Note:** This script will install all the required dependencies and download the data.\n",
23+
"> It will take around 10 minutes to run, but you need to run it only once in your Colab session.\n",
24+
"> If your Colab session is disconnected, you will need to run this script again."
2125
]
2226
},
2327
{
@@ -30,15 +34,15 @@
3034
"In Google Colab you can request access to a GPU by changing the runtime type.\n",
3135
"To do so, click the following menu options in Google Colab:\n",
3236
"\n",
33-
"(Menu) \"Runtime\" -> \"Change runtime type\" -> \"Hardware accelerator\" -> \"GPU\".\n",
37+
"> (Menu) \"Runtime\" -> \"Change runtime type\" -> \"Hardware accelerator\" -> \"GPU\".\n",
3438
"\n"
3539
]
3640
},
3741
{
3842
"cell_type": "markdown",
3943
"metadata": {},
4044
"source": [
41-
"## Download the data and install all required dependencies\n",
45+
"## Install all required dependencies and download the data\n",
4246
"\n",
4347
"Uncomment and run the following cell to download the required packages.\n",
4448
"\n"
@@ -187,7 +191,7 @@
187191
"metadata": {},
188192
"source": [
189193
"\n",
190-
"# 01_plot_explainable_variance.ipynb\n"
194+
"# 03_compute_explainable_variance.ipynb\n"
191195
]
192196
},
193197
{
@@ -652,7 +656,7 @@
652656
"metadata": {},
653657
"source": [
654658
"\n",
655-
"# 02_plot_ridge_regression.ipynb\n"
659+
"# 04_understand_ridge_regression.ipynb\n"
656660
]
657661
},
658662
{
@@ -670,7 +674,7 @@
670674
"Linear regression is a method to model the relation between some input\n",
671675
"variables $X \\in \\mathbb{R}^{(n \\times p)}$ (the features) and an output\n",
672676
"variable $y \\in \\mathbb{R}^{n}$ (the target). Specifically, linear\n",
673-
"regression uses a vector of coefficient $w \\in \\mathbb{R}^{p}$` to\n",
677+
"regression uses a vector of coefficient $w \\in \\mathbb{R}^{p}$ to\n",
674678
"predict the output\n",
675679
"\n",
676680
"\\begin{align}\\hat{y} = Xw\\end{align}\n",
@@ -685,15 +689,6 @@
685689
"least squares* (OLS).\n"
686690
]
687691
},
688-
{
689-
"cell_type": "code",
690-
"execution_count": null,
691-
"metadata": {
692-
"collapsed": false
693-
},
694-
"outputs": [],
695-
"source": []
696-
},
697692
{
698693
"cell_type": "markdown",
699694
"metadata": {},
@@ -1267,7 +1262,7 @@
12671262
"metadata": {},
12681263
"source": [
12691264
"\n",
1270-
"# 03_plot_wordnet_model.ipynb\n"
1265+
"# 05_fit_wordnet_model.ipynb\n"
12711266
]
12721267
},
12731268
{
@@ -2268,7 +2263,7 @@
22682263
"metadata": {},
22692264
"source": [
22702265
"\n",
2271-
"# 04_plot_hemodynamic_response.ipynb\n"
2266+
"# 06_visualize_hemodynamic_response.ipynb\n"
22722267
]
22732268
},
22742269
{
@@ -2855,7 +2850,7 @@
28552850
"metadata": {},
28562851
"source": [
28572852
"\n",
2858-
"# 05_plot_motion_energy_model.ipynb\n"
2853+
"# 08_fit_motion_energy_model.ipynb\n"
28592854
]
28602855
},
28612856
{
@@ -3368,7 +3363,7 @@
33683363
"metadata": {},
33693364
"source": [
33703365
"\n",
3371-
"# 06_plot_banded_ridge_model.ipynb\n"
3366+
"# 09_fit_banded_ridge_model.ipynb\n"
33723367
]
33733368
},
33743369
{

_sources/notebooks/shortclips/merged_for_colab_model_fitting.ipynb

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"metadata": {},
66
"source": [
77
"\n",
8-
"# 00_setup_colab.ipynb\n"
8+
"# 01_setup_colab.ipynb\n"
99
]
1010
},
1111
{
@@ -16,8 +16,12 @@
1616
"# Setup Google Colab\n",
1717
"\n",
1818
"In this script, we setup a Google Colab environment. This script will only work\n",
19-
"when run from [Google Colab](https://colab.research.google.com/)). You can\n",
20-
"skip it if you run the tutorials on your machine.\n"
19+
"when run from [Google Colab](https://colab.research.google.com/). You can\n",
20+
"skip it if you run the tutorials on your machine.\n",
21+
"\n",
22+
"> **Note:** This script will install all the required dependencies and download the data.\n",
23+
"> It will take around 10 minutes to run, but you need to run it only once in your Colab session.\n",
24+
"> If your Colab session is disconnected, you will need to run this script again."
2125
]
2226
},
2327
{
@@ -30,15 +34,15 @@
3034
"In Google Colab you can request access to a GPU by changing the runtime type.\n",
3135
"To do so, click the following menu options in Google Colab:\n",
3236
"\n",
33-
"(Menu) \"Runtime\" -> \"Change runtime type\" -> \"Hardware accelerator\" -> \"GPU\".\n",
37+
"> (Menu) \"Runtime\" -> \"Change runtime type\" -> \"Hardware accelerator\" -> \"GPU\".\n",
3438
"\n"
3539
]
3640
},
3741
{
3842
"cell_type": "markdown",
3943
"metadata": {},
4044
"source": [
41-
"## Download the data and install all required dependencies\n",
45+
"## Install all required dependencies and download the data\n",
4246
"\n",
4347
"Uncomment and run the following cell to download the required packages.\n",
4448
"\n"
@@ -187,7 +191,7 @@
187191
"metadata": {},
188192
"source": [
189193
"\n",
190-
"# 01_plot_explainable_variance.ipynb\n"
194+
"# 03_compute_explainable_variance.ipynb\n"
191195
]
192196
},
193197
{
@@ -652,7 +656,7 @@
652656
"metadata": {},
653657
"source": [
654658
"\n",
655-
"# 03_plot_wordnet_model.ipynb\n"
659+
"# 05_fit_wordnet_model.ipynb\n"
656660
]
657661
},
658662
{
@@ -1653,7 +1657,7 @@
16531657
"metadata": {},
16541658
"source": [
16551659
"\n",
1656-
"# 05_plot_motion_energy_model.ipynb\n"
1660+
"# 08_fit_motion_energy_model.ipynb\n"
16571661
]
16581662
},
16591663
{
@@ -2166,7 +2170,7 @@
21662170
"metadata": {},
21672171
"source": [
21682172
"\n",
2169-
"# 06_plot_banded_ridge_model.ipynb\n"
2173+
"# 09_fit_banded_ridge_model.ipynb\n"
21702174
]
21712175
},
21722176
{

notebooks/shortclips/03_compute_explainable_variance.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ <h1>Compute the explainable variance<a class="headerlink" href="#compute-the-exp
436436
across repetitions. For each repeat, we define the residual timeseries between
437437
brain response and average brain response as <span class="math notranslate nohighlight">\(r_i = y_i - \bar{y}\)</span>. The
438438
explainable variance (EV) is estimated as</p>
439-
<div class="amsmath math notranslate nohighlight" id="equation-7c4b943e-035d-41fd-9084-2bea6fe5d1be">
440-
<span class="eqno">(1)<a class="headerlink" href="#equation-7c4b943e-035d-41fd-9084-2bea6fe5d1be" title="Permalink to this equation">#</a></span>\[\begin{align}\text{EV} = \frac{1}{N}\sum_{i=1}^N\text{Var}(y_i) - \frac{N}{N-1}\sum_{i=1}^N\text{Var}(r_i)\end{align}\]</div>
439+
<div class="amsmath math notranslate nohighlight" id="equation-8571b8dd-458d-4804-9a62-21ea954a14fe">
440+
<span class="eqno">(1)<a class="headerlink" href="#equation-8571b8dd-458d-4804-9a62-21ea954a14fe" title="Permalink to this equation">#</a></span>\[\begin{align}\text{EV} = \frac{1}{N}\sum_{i=1}^N\text{Var}(y_i) - \frac{N}{N-1}\sum_{i=1}^N\text{Var}(r_i)\end{align}\]</div>
441441
<p>In the literature, the explainable variance is also known as the <em>signal
442442
power</em>.</p>
443443
<p>For more information, see <span id="id1">Sahani and Linden [<a class="reference internal" href="merged_for_colab_model_fitting.html#id130" title="M. Sahani and J. Linden. How linear are auditory cortical responses? Adv. Neural Inf. Process. Syst., 2002.">2002</a>]</span>, <span id="id2">Hsu <em>et al.</em> [<a class="reference internal" href="merged_for_colab_model_fitting.html#id131" title="A. Hsu, A. Borst, and F. E. Theunissen. Quantifying variability in neural responses and its application for the validation of model predictions. Network, 2004.">2004</a>]</span>, and <span id="id3">Schoppe <em>et al.</em> [<a class="reference internal" href="merged_for_colab_model_fitting.html#id132" title="O. Schoppe, N. S. Harper, B. Willmore, A. King, and J. Schnupp. Measuring the performance of neural models. Front. Comput. Neurosci., 2016.">2016</a>]</span>.</p>

notebooks/shortclips/04_understand_ridge_regression.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,13 @@ <h1>Understand ridge regression and cross-validation<a class="headerlink" href="
422422
variable <span class="math notranslate nohighlight">\(y \in \mathbb{R}^{n}\)</span> (the target). Specifically, linear
423423
regression uses a vector of coefficient <span class="math notranslate nohighlight">\(w \in \mathbb{R}^{p}\)</span> to
424424
predict the output</p>
425-
<div class="amsmath math notranslate nohighlight" id="equation-253f3f88-d090-4f7f-9115-281a7a2e27fe">
426-
<span class="eqno">(2)<a class="headerlink" href="#equation-253f3f88-d090-4f7f-9115-281a7a2e27fe" title="Permalink to this equation">#</a></span>\[\begin{align}\hat{y} = Xw\end{align}\]</div>
425+
<div class="amsmath math notranslate nohighlight" id="equation-010741a2-76d5-4c9c-9869-185c0d3cb2c4">
426+
<span class="eqno">(2)<a class="headerlink" href="#equation-010741a2-76d5-4c9c-9869-185c0d3cb2c4" title="Permalink to this equation">#</a></span>\[\begin{align}\hat{y} = Xw\end{align}\]</div>
427427
<p>The model is considered accurate if the predictions <span class="math notranslate nohighlight">\(\hat{y}\)</span> are close
428428
to the true output values <span class="math notranslate nohighlight">\(y\)</span>. Therefore, a good linear regression model
429429
is given by the vector <span class="math notranslate nohighlight">\(w\)</span> that minimizes the sum of squared errors:</p>
430-
<div class="amsmath math notranslate nohighlight" id="equation-af5204d4-43c3-4e87-b187-c958e6c90d61">
431-
<span class="eqno">(3)<a class="headerlink" href="#equation-af5204d4-43c3-4e87-b187-c958e6c90d61" title="Permalink to this equation">#</a></span>\[\begin{align}w = \arg\min_w ||Xw - y||^2\end{align}\]</div>
430+
<div class="amsmath math notranslate nohighlight" id="equation-04e7999a-297e-4b03-8416-a103d7ff49bf">
431+
<span class="eqno">(3)<a class="headerlink" href="#equation-04e7999a-297e-4b03-8416-a103d7ff49bf" title="Permalink to this equation">#</a></span>\[\begin{align}w = \arg\min_w ||Xw - y||^2\end{align}\]</div>
432432
<p>This is the simplest model for linear regression, and it is known as <em>ordinary
433433
least squares</em> (OLS).</p>
434434
<section id="ordinary-least-squares-ols">
@@ -480,8 +480,8 @@ <h2>Ordinary least squares (OLS)<a class="headerlink" href="#ordinary-least-squa
480480
</div>
481481
<p>The linear coefficient leading to the minimum squared loss can be found
482482
analytically with the formula:</p>
483-
<div class="amsmath math notranslate nohighlight" id="equation-ca508ccb-fc89-4b5c-8482-e34fff729b99">
484-
<span class="eqno">(4)<a class="headerlink" href="#equation-ca508ccb-fc89-4b5c-8482-e34fff729b99" title="Permalink to this equation">#</a></span>\[\begin{align}w = (X^\top X)^{-1} X^\top y\end{align}\]</div>
483+
<div class="amsmath math notranslate nohighlight" id="equation-08541323-7db5-4c17-bea4-760241648a56">
484+
<span class="eqno">(4)<a class="headerlink" href="#equation-08541323-7db5-4c17-bea4-760241648a56" title="Permalink to this equation">#</a></span>\[\begin{align}w = (X^\top X)^{-1} X^\top y\end{align}\]</div>
485485
<p>This is the OLS solution.</p>
486486
<div class="cell docutils container">
487487
<div class="cell_input docutils container">
@@ -621,8 +621,8 @@ <h2>Ridge regression<a class="headerlink" href="#ridge-regression" title="Link t
621621
<p>To solve the instability and under-determinacy issues of OLS, OLS can be
622622
extended to <em>ridge regression</em>. Ridge regression considers a different
623623
optimization problem:</p>
624-
<div class="amsmath math notranslate nohighlight" id="equation-7ac6f82b-dd61-4d06-89f7-cf9ea8829f67">
625-
<span class="eqno">(5)<a class="headerlink" href="#equation-7ac6f82b-dd61-4d06-89f7-cf9ea8829f67" title="Permalink to this equation">#</a></span>\[\begin{align}w = \arg\min_w ||Xw - y||^2 + \alpha ||w||^2\end{align}\]</div>
624+
<div class="amsmath math notranslate nohighlight" id="equation-152e4fe6-61c3-4b05-b6f4-2b165911ccca">
625+
<span class="eqno">(5)<a class="headerlink" href="#equation-152e4fe6-61c3-4b05-b6f4-2b165911ccca" title="Permalink to this equation">#</a></span>\[\begin{align}w = \arg\min_w ||Xw - y||^2 + \alpha ||w||^2\end{align}\]</div>
626626
<p>This optimization problem contains two terms: (i) a <em>data-fitting term</em>
627627
<span class="math notranslate nohighlight">\(||Xw - y||^2\)</span>, which ensures the regression correctly fits the
628628
training data; and (ii) a regularization term <span class="math notranslate nohighlight">\(\alpha||w||^2\)</span>, which
@@ -654,8 +654,8 @@ <h2>Ridge regression<a class="headerlink" href="#ridge-regression" title="Link t
654654
<p>To understand why the regularization term makes the solution more robust to
655655
noise, let’s consider the ridge solution. The ridge solution can be found
656656
analytically with the formula:</p>
657-
<div class="amsmath math notranslate nohighlight" id="equation-34f11fc4-5e65-4369-9500-5fc9adbf0f32">
658-
<span class="eqno">(6)<a class="headerlink" href="#equation-34f11fc4-5e65-4369-9500-5fc9adbf0f32" title="Permalink to this equation">#</a></span>\[\begin{align}w = (X^\top X + \alpha I)^{-1} X^\top y\end{align}\]</div>
657+
<div class="amsmath math notranslate nohighlight" id="equation-492d00e7-ad9c-4c41-8a51-e718f0553dd4">
658+
<span class="eqno">(6)<a class="headerlink" href="#equation-492d00e7-ad9c-4c41-8a51-e718f0553dd4" title="Permalink to this equation">#</a></span>\[\begin{align}w = (X^\top X + \alpha I)^{-1} X^\top y\end{align}\]</div>
659659
<p>where <code class="docutils literal notranslate"><span class="pre">I</span></code> is the identity matrix. In this formula, we can see that the
660660
inverted matrix is now <span class="math notranslate nohighlight">\((X^\top X + \alpha I)\)</span>. Compared to OLS, the
661661
additional term <span class="math notranslate nohighlight">\(\alpha I\)</span> adds a positive value <code class="docutils literal notranslate"><span class="pre">alpha</span></code> to all

notebooks/shortclips/06_visualize_hemodynamic_response.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,8 +1660,8 @@ <h2>Visualize the HRF<a class="headerlink" href="#visualize-the-hrf" title="Link
16601660
coefficients <span class="math notranslate nohighlight">\(\beta\)</span> obtained with a ridge regression, but the primal
16611661
coefficients can be computed from the dual coefficients using the training
16621662
features <span class="math notranslate nohighlight">\(X\)</span>:</p>
1663-
<div class="amsmath math notranslate nohighlight" id="equation-a3feabde-5706-4bdb-bb4b-47369e82c744">
1664-
<span class="eqno">(7)<a class="headerlink" href="#equation-a3feabde-5706-4bdb-bb4b-47369e82c744" title="Permalink to this equation">#</a></span>\[\begin{align}\beta = X^\top w\end{align}\]</div>
1663+
<div class="amsmath math notranslate nohighlight" id="equation-679d04fd-27f8-45fb-895d-39c2b830da09">
1664+
<span class="eqno">(7)<a class="headerlink" href="#equation-679d04fd-27f8-45fb-895d-39c2b830da09" title="Permalink to this equation">#</a></span>\[\begin{align}\beta = X^\top w\end{align}\]</div>
16651665
<p>To better visualize the HRF, we will refit a model with more delays, but only
16661666
on a selection of voxels to speed up the computations.</p>
16671667
<div class="cell docutils container">

notebooks/shortclips/09_fit_banded_ridge_model.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2827,8 +2827,8 @@ <h2>Plot the banded ridge split<a class="headerlink" href="#plot-the-banded-ridg
28272827
take the kernel weights and the ridge (dual) weights corresponding to each
28282828
feature space, and use them to compute the prediction from each feature space
28292829
separately.</p>
2830-
<div class="amsmath math notranslate nohighlight" id="equation-c0687345-1407-48d0-8dd1-c430d921e59a">
2831-
<span class="eqno">(8)<a class="headerlink" href="#equation-c0687345-1407-48d0-8dd1-c430d921e59a" title="Permalink to this equation">#</a></span>\[\begin{align}\hat{y} = \sum_i^m \hat{y}_i = \sum_i^m \gamma_i K_i \hat{w}\end{align}\]</div>
2830+
<div class="amsmath math notranslate nohighlight" id="equation-7b30bc1c-345f-4f87-b7b1-398ba820b074">
2831+
<span class="eqno">(8)<a class="headerlink" href="#equation-7b30bc1c-345f-4f87-b7b1-398ba820b074" title="Permalink to this equation">#</a></span>\[\begin{align}\hat{y} = \sum_i^m \hat{y}_i = \sum_i^m \gamma_i K_i \hat{w}\end{align}\]</div>
28322832
<p>Then, we use these split predictions to compute split <span class="math notranslate nohighlight">\(\tilde{R}^2_i\)</span>
28332833
scores. These scores are corrected so that their sum is equal to the
28342834
<span class="math notranslate nohighlight">\(R^2\)</span> score of the full prediction <span class="math notranslate nohighlight">\(\hat{y}\)</span>.</p>

0 commit comments

Comments
 (0)