Skip to content

Commit

Permalink
deploy: 3dcd46b
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanTodoran committed Oct 30, 2023
1 parent ed5860f commit 38c94c9
Show file tree
Hide file tree
Showing 22 changed files with 742 additions and 292 deletions.
33 changes: 11 additions & 22 deletions Chapter2-DataManipulation/2.10_dimensionality_reduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ <h2>2.10.1 Feature selection via parameter exploration<a class="headerlink" href
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f5a372da3e0&gt;
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f60f04a8fa0&gt;
</pre></div>
</div>
<img alt="../_images/2.10_dimensionality_reduction_4_1.png" src="../_images/2.10_dimensionality_reduction_4_1.png" />
Expand Down Expand Up @@ -989,8 +989,16 @@ <h3><em>Step one: subtract the mean</em><a class="headerlink" href="#step-one-su
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1">## Remove the mean of the data</span>
<span class="n">Xavg</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">X</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># Compute mean</span>
<span class="n">B</span> <span class="o">=</span> <span class="n">X</span> <span class="o">-</span> <span class="n">np</span><span class="o">.</span><span class="n">tile</span><span class="p">(</span><span class="n">Xavg</span><span class="p">,(</span><span class="n">nPoints</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span><span class="o">.</span><span class="n">T</span> <span class="c1"># Mean-subtracted data</span>

<span class="n">plt</span><span class="o">.</span><span class="n">scatter</span><span class="p">(</span><span class="n">B</span><span class="p">[</span><span class="mi">0</span><span class="p">,:],</span><span class="n">B</span><span class="p">[</span><span class="mi">1</span><span class="p">,:],</span> <span class="n">color</span><span class="o">=</span><span class="s1">&#39;k&#39;</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.125</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.collections.PathCollection at 0x7f60ecda71c0&gt;
</pre></div>
</div>
<img alt="../_images/2.10_dimensionality_reduction_12_1.png" src="../_images/2.10_dimensionality_reduction_12_1.png" />
</div>
</div>
</section>
Expand All @@ -1006,21 +1014,6 @@ <h3><em>Step two: Determine the SVD of the covariance matrix</em><a class="heade
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[ 0.42469643 0.747179 0.85328813 ... 0.88246352 -1.884191
-1.32403592]
[-0.18730514 0.80047482 1.11341706 ... -0.09048239 -2.95497644
-0.18146037]]
[[ 0.42469643 -0.18730514]
[ 0.747179 0.80047482]
[ 0.85328813 1.11341706]
...
[ 0.88246352 -0.09048239]
[-1.884191 -2.95497644]
[-1.32403592 -0.18146037]]
</pre></div>
</div>
</div>
</div>
</section>
<section id="step-three-explore-the-outcomes">
Expand Down Expand Up @@ -1198,7 +1191,7 @@ <h2>2.10.3 PCA on 3D data.<a class="headerlink" href="#pca-on-3d-data" title="Pe
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f1890190820&gt;
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f60ec163730&gt;
</pre></div>
</div>
<img alt="../_images/2.10_dimensionality_reduction_25_1.png" src="../_images/2.10_dimensionality_reduction_25_1.png" />
Expand Down Expand Up @@ -1304,7 +1297,7 @@ <h2>2.10.3 PCA on 3D data.<a class="headerlink" href="#pca-on-3d-data" title="Pe
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>minimum dimension size to explain 95% of the variance: 1
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Minimum dimension size to explain 95% of the variance: 1
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -1344,10 +1337,6 @@ <h2>2.10.3 PCA on 3D data.<a class="headerlink" href="#pca-on-3d-data" title="Pe
</pre></div>
</div>
<img alt="../_images/2.10_dimensionality_reduction_38_1.png" src="../_images/2.10_dimensionality_reduction_38_1.png" />
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[ 1.69 -0.668 -6.747]
[ 2.14194643 -1.44586065 -6.42108578]
</pre></div>
</div>
</div>
</div>
<p><em>SVD</em> can be computationally intensive for larger dimensions.</p>
Expand Down
Loading

0 comments on commit 38c94c9

Please sign in to comment.