Skip to content

Commit 5c2ae13

Browse files
committed
Make push-pages
1 parent 318fb00 commit 5c2ae13

11 files changed

+88
-88
lines changed

_sources/pages/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Welcome to the tutorials on the Voxelwise Encoding Model framework from the
55

66
If you use these tutorials for your work, consider citing the corresponding paper:
77

8-
> T. Dupré La Tour, M. Visconti di Oleggio Castello, and J. L. Gallant. The Voxelwise Encoding Model framework: a tutorial introduction to fitting encoding models to fMRI data. PsyArXiv, 2024. [doi:10.31234/osf.io/t975e.](https://doi.org/10.31234/osf.io/t975e)
8+
> T. Dupré la Tour, M. Visconti di Oleggio Castello, and J. L. Gallant. The Voxelwise Encoding Model framework: a tutorial introduction to fitting encoding models to fMRI data. PsyArXiv, 2024. [doi:10.31234/osf.io/t975e.](https://doi.org/10.31234/osf.io/t975e)
99
1010
You can find a copy of the paper [here](https://github.com/gallantlab/voxelwise_tutorials/blob/main/paper/voxelwise_tutorials_paper.pdf).
1111

notebooks/shortclips/03_compute_explainable_variance.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ <h1>Compute the explainable variance<a class="headerlink" href="#compute-the-exp
437437
across repetitions. For each repeat, we define the residual timeseries between
438438
brain response and average brain response as <span class="math notranslate nohighlight">\(r_i = y_i - \bar{y}\)</span>. The
439439
explainable variance (EV) is estimated as</p>
440-
<div class="amsmath math notranslate nohighlight" id="equation-6b5c66f3-6a1c-4d78-b878-859915a0fd50">
441-
<span class="eqno">(1)<a class="headerlink" href="#equation-6b5c66f3-6a1c-4d78-b878-859915a0fd50" 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>
440+
<div class="amsmath math notranslate nohighlight" id="equation-8e371fe2-e3f6-4e66-94c0-74505eac3a2c">
441+
<span class="eqno">(1)<a class="headerlink" href="#equation-8e371fe2-e3f6-4e66-94c0-74505eac3a2c" 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>
442442
<p>In the literature, the explainable variance is also known as the <em>signal
443443
power</em>.</p>
444444
<p>For more information, see <span id="id1">Sahani and Linden [<a class="reference internal" href="vem_tutorials_merged_for_colab_model_fitting.html#id158" 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="vem_tutorials_merged_for_colab_model_fitting.html#id159" 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="vem_tutorials_merged_for_colab_model_fitting.html#id160" 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 hyperparameter selection<a class="headerlink
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-4d8e7a72-f95e-45b0-8300-c88feaa9beea">
426-
<span class="eqno">(2)<a class="headerlink" href="#equation-4d8e7a72-f95e-45b0-8300-c88feaa9beea" title="Permalink to this equation">#</a></span>\[\begin{align}\hat{y} = Xw\end{align}\]</div>
425+
<div class="amsmath math notranslate nohighlight" id="equation-44016c9a-386e-4c5d-b726-0c593bd1d3d6">
426+
<span class="eqno">(2)<a class="headerlink" href="#equation-44016c9a-386e-4c5d-b726-0c593bd1d3d6" 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-1a0b17c5-4527-49ed-82d6-6178a4173e16">
431-
<span class="eqno">(3)<a class="headerlink" href="#equation-1a0b17c5-4527-49ed-82d6-6178a4173e16" 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-164582e6-d0f8-4ec6-a812-94b6f84c155f">
431+
<span class="eqno">(3)<a class="headerlink" href="#equation-164582e6-d0f8-4ec6-a812-94b6f84c155f" 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-39886a10-bc4c-413a-96a6-a176b7120b6f">
484-
<span class="eqno">(4)<a class="headerlink" href="#equation-39886a10-bc4c-413a-96a6-a176b7120b6f" 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-ec79a861-adc8-488d-b845-bd06194ee484">
484+
<span class="eqno">(4)<a class="headerlink" href="#equation-ec79a861-adc8-488d-b845-bd06194ee484" 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-68b52747-55d0-4018-84bc-cf843e167110">
625-
<span class="eqno">(5)<a class="headerlink" href="#equation-68b52747-55d0-4018-84bc-cf843e167110" 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-f6de4535-4112-4241-8db4-1486e978a489">
625+
<span class="eqno">(5)<a class="headerlink" href="#equation-f6de4535-4112-4241-8db4-1486e978a489" 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-1886f38e-bd35-4129-8cda-03e4abec2868">
658-
<span class="eqno">(6)<a class="headerlink" href="#equation-1886f38e-bd35-4129-8cda-03e4abec2868" 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-ea124788-3420-4a26-b1fa-638985501426">
658+
<span class="eqno">(6)<a class="headerlink" href="#equation-ea124788-3420-4a26-b1fa-638985501426" 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-a4fc0a20-0616-4955-85a5-056abdb2afbb">
1664-
<span class="eqno">(7)<a class="headerlink" href="#equation-a4fc0a20-0616-4955-85a5-056abdb2afbb" 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-647c6f7b-f485-4012-a2fa-40d3832f711b">
1664+
<span class="eqno">(7)<a class="headerlink" href="#equation-647c6f7b-f485-4012-a2fa-40d3832f711b" 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/08_fit_motion_energy_model.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ <h2>Compare with the wordnet model<a class="headerlink" href="#compare-with-the-
11981198
could predict responses in face-responsive areas without encoding any
11991199
semantic information.</p>
12001200
<p>To better disentangle the two feature spaces, we developed a joint model
1201-
called <code class="docutils literal notranslate"><span class="pre">banded</span> <span class="pre">ridge</span> <span class="pre">regression</span></code> <span id="id4">[<a class="reference internal" href="../../pages/voxelwise_modeling.html#id25" title="T. Dupré La Tour, M. Eickenberg, A.O. Nunez-Elizalde, and J. L. Gallant. Feature-space selection with banded ridge regression. NeuroImage, 267:119728, 2022. doi:10.1016/j.neuroimage.2022.119728.">Dupré La Tour <em>et al.</em>, 2022</a>, <a class="reference internal" href="../../pages/voxelwise_modeling.html#id22" title="A. O. Nunez-Elizalde, A. G. Huth, and J. L. Gallant. Voxelwise encoding models with non-spherical multivariate normal priors. Neuroimage, 197:482–492, 2019.">Nunez-Elizalde <em>et al.</em>, 2019</a>]</span>, which fits multiple feature spaces
1201+
called <code class="docutils literal notranslate"><span class="pre">banded</span> <span class="pre">ridge</span> <span class="pre">regression</span></code> <span id="id4">[<a class="reference internal" href="../../pages/voxelwise_modeling.html#id25" title="T. Dupré la Tour, M. Eickenberg, A.O. Nunez-Elizalde, and J. L. Gallant. Feature-space selection with banded ridge regression. NeuroImage, 267:119728, 2022. doi:10.1016/j.neuroimage.2022.119728.">Dupré la Tour <em>et al.</em>, 2022</a>, <a class="reference internal" href="../../pages/voxelwise_modeling.html#id22" title="A. O. Nunez-Elizalde, A. G. Huth, and J. L. Gallant. Voxelwise encoding models with non-spherical multivariate normal priors. Neuroimage, 197:482–492, 2019.">Nunez-Elizalde <em>et al.</em>, 2019</a>]</span>, which fits multiple feature spaces
12021202
simultaneously with optimal regularization for each feature space. This model
12031203
is described in the next example.</p>
12041204
</section>
@@ -1207,8 +1207,8 @@ <h2>References<a class="headerlink" href="#references" title="Link to this headi
12071207
<div class="docutils container" id="id5">
12081208
<div role="list" class="citation-list">
12091209
<div class="citation" id="id20" role="doc-biblioentry">
1210-
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id4">DLTENEG22</a><span class="fn-bracket">]</span></span>
1211-
<p>T. Dupré La Tour, M. Eickenberg, A.O. Nunez-Elizalde, and J. L. Gallant. Feature-space selection with banded ridge regression. <em>NeuroImage</em>, 267:119728, 2022. <a class="reference external" href="https://doi.org/10.1016/j.neuroimage.2022.119728">doi:10.1016/j.neuroimage.2022.119728</a>.</p>
1210+
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id4">DlTENEG22</a><span class="fn-bracket">]</span></span>
1211+
<p>T. Dupré la Tour, M. Eickenberg, A.O. Nunez-Elizalde, and J. L. Gallant. Feature-space selection with banded ridge regression. <em>NeuroImage</em>, 267:119728, 2022. <a class="reference external" href="https://doi.org/10.1016/j.neuroimage.2022.119728">doi:10.1016/j.neuroimage.2022.119728</a>.</p>
12121212
</div>
12131213
<div class="citation" id="id8" role="doc-biblioentry">
12141214
<span class="label"><span class="fn-bracket">[</span>NVN+11<span class="fn-bracket">]</span></span>

notebooks/shortclips/09_fit_banded_ridge_model.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ <h1>Fit a voxelwise encoding model with both WordNet and motion-energy features<
422422
with two different feature spaces: motion energy and wordnet categories.</p>
423423
<p><em>Banded ridge regression:</em> Since the relative scaling of both feature spaces is
424424
unknown, we use two regularization hyperparameters (one per feature space) in a
425-
model called banded ridge regression <span id="id1">[<a class="reference internal" href="../../pages/voxelwise_modeling.html#id25" title="T. Dupré La Tour, M. Eickenberg, A.O. Nunez-Elizalde, and J. L. Gallant. Feature-space selection with banded ridge regression. NeuroImage, 267:119728, 2022. doi:10.1016/j.neuroimage.2022.119728.">Dupré La Tour <em>et al.</em>, 2022</a>, <a class="reference internal" href="../../pages/voxelwise_modeling.html#id22" title="A. O. Nunez-Elizalde, A. G. Huth, and J. L. Gallant. Voxelwise encoding models with non-spherical multivariate normal priors. Neuroimage, 197:482–492, 2019.">Nunez-Elizalde <em>et al.</em>, 2019</a>]</span>.
425+
model called banded ridge regression <span id="id1">[<a class="reference internal" href="../../pages/voxelwise_modeling.html#id25" title="T. Dupré la Tour, M. Eickenberg, A.O. Nunez-Elizalde, and J. L. Gallant. Feature-space selection with banded ridge regression. NeuroImage, 267:119728, 2022. doi:10.1016/j.neuroimage.2022.119728.">Dupré la Tour <em>et al.</em>, 2022</a>, <a class="reference internal" href="../../pages/voxelwise_modeling.html#id22" title="A. O. Nunez-Elizalde, A. G. Huth, and J. L. Gallant. Voxelwise encoding models with non-spherical multivariate normal priors. Neuroimage, 197:482–492, 2019.">Nunez-Elizalde <em>et al.</em>, 2019</a>]</span>.
426426
Just like with ridge regression, we optimize the hyperparameters over cross-validation.
427427
An efficient implementation of this model is available in the
428428
<a class="reference external" href="https://github.com/gallantlab/himalaya">himalaya</a> package.</p>
@@ -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-c515e9be-8919-4434-9ba6-8408cf6ab8bd">
2831-
<span class="eqno">(8)<a class="headerlink" href="#equation-c515e9be-8919-4434-9ba6-8408cf6ab8bd" 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-eab8ce78-6b79-4fd7-ad7d-866dfd1987d3">
2831+
<span class="eqno">(8)<a class="headerlink" href="#equation-eab8ce78-6b79-4fd7-ad7d-866dfd1987d3" 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>
@@ -2887,16 +2887,16 @@ <h2>Plot the banded ridge split<a class="headerlink" href="#plot-the-banded-ridg
28872887
motion-energy features predict brain activity in early visual cortex, while
28882888
wordnet features predict in semantic visual areas. For more discussions about
28892889
these results, we refer the reader to the publications describing the banded ridge
2890-
regression approach <span id="id2">[<a class="reference internal" href="../../pages/voxelwise_modeling.html#id25" title="T. Dupré La Tour, M. Eickenberg, A.O. Nunez-Elizalde, and J. L. Gallant. Feature-space selection with banded ridge regression. NeuroImage, 267:119728, 2022. doi:10.1016/j.neuroimage.2022.119728.">Dupré La Tour <em>et al.</em>, 2022</a>, <a class="reference internal" href="../../pages/voxelwise_modeling.html#id22" title="A. O. Nunez-Elizalde, A. G. Huth, and J. L. Gallant. Voxelwise encoding models with non-spherical multivariate normal priors. Neuroimage, 197:482–492, 2019.">Nunez-Elizalde <em>et al.</em>, 2019</a>]</span>.</p>
2890+
regression approach <span id="id2">[<a class="reference internal" href="../../pages/voxelwise_modeling.html#id25" title="T. Dupré la Tour, M. Eickenberg, A.O. Nunez-Elizalde, and J. L. Gallant. Feature-space selection with banded ridge regression. NeuroImage, 267:119728, 2022. doi:10.1016/j.neuroimage.2022.119728.">Dupré la Tour <em>et al.</em>, 2022</a>, <a class="reference internal" href="../../pages/voxelwise_modeling.html#id22" title="A. O. Nunez-Elizalde, A. G. Huth, and J. L. Gallant. Voxelwise encoding models with non-spherical multivariate normal priors. Neuroimage, 197:482–492, 2019.">Nunez-Elizalde <em>et al.</em>, 2019</a>]</span>.</p>
28912891
</section>
28922892
<section id="references">
28932893
<h2>References<a class="headerlink" href="#references" title="Link to this heading">#</a></h2>
28942894
<div class="docutils container" id="id3">
28952895
<div role="list" class="citation-list">
28962896
<div class="citation" id="id18" role="doc-biblioentry">
2897-
<span class="label"><span class="fn-bracket">[</span>DLTENEG22<span class="fn-bracket">]</span></span>
2897+
<span class="label"><span class="fn-bracket">[</span>DlTENEG22<span class="fn-bracket">]</span></span>
28982898
<span class="backrefs">(<a role="doc-backlink" href="#id1">1</a>,<a role="doc-backlink" href="#id2">2</a>)</span>
2899-
<p>T. Dupré La Tour, M. Eickenberg, A.O. Nunez-Elizalde, and J. L. Gallant. Feature-space selection with banded ridge regression. <em>NeuroImage</em>, 267:119728, 2022. <a class="reference external" href="https://doi.org/10.1016/j.neuroimage.2022.119728">doi:10.1016/j.neuroimage.2022.119728</a>.</p>
2899+
<p>T. Dupré la Tour, M. Eickenberg, A.O. Nunez-Elizalde, and J. L. Gallant. Feature-space selection with banded ridge regression. <em>NeuroImage</em>, 267:119728, 2022. <a class="reference external" href="https://doi.org/10.1016/j.neuroimage.2022.119728">doi:10.1016/j.neuroimage.2022.119728</a>.</p>
29002900
</div>
29012901
<div class="citation" id="id15" role="doc-biblioentry">
29022902
<span class="label"><span class="fn-bracket">[</span>NEHG19<span class="fn-bracket">]</span></span>

0 commit comments

Comments
 (0)