more dim red update
This commit is contained in:
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -199,7 +203,7 @@ MathJax.Hub.Config({
|
||||
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
|
||||
<br>
|
||||
<p>
|
||||
<center><h4>Oct 22, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 24, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
|
||||
@@ -223,7 +227,7 @@ MathJax.Hub.Config({
|
||||
<li><a href="._DimRed-bs008.html">9</a></li>
|
||||
<li><a href="._DimRed-bs009.html">10</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs001.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -223,7 +227,7 @@ data.
|
||||
<li><a href="._DimRed-bs009.html">10</a></li>
|
||||
<li><a href="._DimRed-bs010.html">11</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs002.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -222,7 +226,7 @@ ensures that all features are exactly between \( 0 \) and \( 1 \). The
|
||||
<li><a href="._DimRed-bs010.html">11</a></li>
|
||||
<li><a href="._DimRed-bs011.html">12</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs003.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -225,7 +229,7 @@ techniques.
|
||||
<li><a href="._DimRed-bs011.html">12</a></li>
|
||||
<li><a href="._DimRed-bs012.html">13</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs004.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -300,7 +304,7 @@ svm<span style="color: #666666">.</span>fit(X_train_scaled, y_train)
|
||||
<li><a href="._DimRed-bs012.html">13</a></li>
|
||||
<li><a href="._DimRed-bs013.html">14</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs005.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -250,7 +254,7 @@ svm<span style="color: #666666">.</span>fit(X_train_scaled, y_train)
|
||||
<li><a href="._DimRed-bs013.html">14</a></li>
|
||||
<li><a href="._DimRed-bs014.html">15</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs006.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -229,7 +233,7 @@ logreg<span style="color: #666666">.</span>fit(X_train_scaled, y_train)
|
||||
<li><a href="._DimRed-bs014.html">15</a></li>
|
||||
<li><a href="._DimRed-bs015.html">16</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs007.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -284,7 +288,7 @@ applications.
|
||||
<li><a href="._DimRed-bs015.html">16</a></li>
|
||||
<li><a href="._DimRed-bs016.html">17</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs008.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -214,7 +218,7 @@ We have a data set defined by a design/feature matrix \( \boldsymbol{X} \) (see
|
||||
<li><a href="._DimRed-bs016.html">17</a></li>
|
||||
<li><a href="._DimRed-bs017.html">18</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs009.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -263,7 +267,7 @@ In the above example this is the function we constructed using <b>pandas</b>.
|
||||
<li><a href="._DimRed-bs017.html">18</a></li>
|
||||
<li><a href="._DimRed-bs018.html">19</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs010.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -258,7 +262,7 @@ $$
|
||||
<li><a href="._DimRed-bs018.html">19</a></li>
|
||||
<li><a href="._DimRed-bs019.html">20</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs011.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -246,7 +250,7 @@ C <span style="color: #666666">=</span> np<span style="color: #666666">.</span>c
|
||||
<li><a href="._DimRed-bs019.html">20</a></li>
|
||||
<li><a href="._DimRed-bs020.html">21</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs012.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -248,7 +252,7 @@ The above procedure with <b>numpy</b> can be made more compact if we use <b>pand
|
||||
<li><a href="._DimRed-bs020.html">21</a></li>
|
||||
<li><a href="._DimRed-bs021.html">22</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs013.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -230,7 +234,7 @@ We expand this model to the Franke function discussed above.
|
||||
<li><a href="._DimRed-bs021.html">22</a></li>
|
||||
<li><a href="._DimRed-bs022.html">23</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs014.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -266,7 +270,7 @@ matrix.
|
||||
<li><a href="._DimRed-bs022.html">23</a></li>
|
||||
<li><a href="._DimRed-bs023.html">24</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs015.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -246,7 +250,7 @@ It is easy to generalize this to a matrix \( \boldsymbol{X}\in {\mathbb{R}}^{n\t
|
||||
<li><a href="._DimRed-bs023.html">24</a></li>
|
||||
<li><a href="._DimRed-bs024.html">25</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs016.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -254,7 +258,7 @@ features/predictors.
|
||||
<li><a href="._DimRed-bs024.html">25</a></li>
|
||||
<li><a href="._DimRed-bs025.html">26</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs017.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -237,7 +241,7 @@ After this we ask ourselves how do we prove the link between the maximum varianc
|
||||
<li><a href="._DimRed-bs025.html">26</a></li>
|
||||
<li><a href="._DimRed-bs026.html">27</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs018.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -193,10 +197,10 @@ J(\boldsymbol{W},\boldsymbol{Z}) = \frac{1}{p}\sum_i (\boldsymbol{x}_i - \overli
|
||||
$$
|
||||
|
||||
with \( \overline{\boldsymbol{x}_i} = \boldsymbol{W}\boldsymbol{z}_i \), where \( \boldsymbol{z}_i \) is a row vector with dimension \( {\mathbb{R}}^{n} \) of the matrix
|
||||
\( \boldsymbol{Z}\in {\mathbb{R}}^{p\times n} \).
|
||||
\( \boldsymbol{Z}\in {\mathbb{R}}^{p\times n} \). When doing PCA we want to reduce this dimensionality.
|
||||
|
||||
<p>
|
||||
The PCA theorem states that minimizing the above reconstruction error corresponds to setting \( \boldsymbol{W}=\boldsymbol{S} \), the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors \( l \) $\boldsymbol{z}_i$, with \( l < < p \), defined by the orthogonal projection of the data onto the columns spanned by they eigenvectors of the covariance(correlations matrix).
|
||||
The PCA theorem states that minimizing the above reconstruction error corresponds to setting \( \boldsymbol{W}=\boldsymbol{S} \), the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors \( l \) $\boldsymbol{z}_i$, with \( l < < p \), defined by the orthogonal projection of the data onto the columns spanned by the eigenvectors of the covariance(correlations matrix).
|
||||
|
||||
<p>
|
||||
<p>
|
||||
@@ -224,7 +228,7 @@ The PCA theorem states that minimizing the above reconstruction error correspond
|
||||
<li><a href="._DimRed-bs026.html">27</a></li>
|
||||
<li><a href="._DimRed-bs027.html">28</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs019.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -183,7 +187,7 @@ MathJax.Hub.Config({
|
||||
<h2 id="___sec18" class="anchor">Proof of the PCA Theorem </h2>
|
||||
|
||||
<p>
|
||||
To show the PCA theorem let us start with the assumption that there is a vector \( \boldsymbol{w}_0 \) which corresponds to a solution which minimized the reconstruction error \( J \). This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of \( \boldsymbol{w}_0 \) and \( \boldsymbol{z}_0 \) as
|
||||
To show the PCA theorem let us start with the assumption that there is one vector \( \boldsymbol{w}_0 \) which corresponds to a solution which minimized the reconstruction error \( J \). This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of \( \boldsymbol{w}_0 \) and \( \boldsymbol{z}_0 \) as
|
||||
$$
|
||||
J(\boldsymbol{w}_0,\boldsymbol{z}_0)= \frac{1}{p}\sum_i (\boldsymbol{x}_i - z_{i0}\boldsymbol{w}_0)^2=\frac{1}{p}\sum_i (\boldsymbol{x}_^T\boldsymbol{x}_i - 2z_{i0}\boldsymbol{w}_0^T\boldsymbol{x}_i+z_{i0}^2\boldsymbol{w}_0^T\boldsymbol{w}_0),
|
||||
$$
|
||||
@@ -225,6 +229,8 @@ where the vectors on the rhs are known.
|
||||
<li><a href="._DimRed-bs026.html">27</a></li>
|
||||
<li><a href="._DimRed-bs027.html">28</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs020.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -180,18 +184,41 @@ MathJax.Hub.Config({
|
||||
<a name="part0020"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec19" class="anchor">Getting started with PCA </h2>
|
||||
<h2 id="___sec19" class="anchor">PCA Proof continued </h2>
|
||||
|
||||
<p>
|
||||
We have now found the unknown parameters \( z_{i0} \). These correspond to the project coordinates and we can write
|
||||
$$
|
||||
J(\boldsymbol{w}_0)= \frac{1}{p}\sum_i (\boldsymbol{x}_i^T\boldsymbol{x}_i - z_{i0}^2)=\mathrm{const}-\frac{1}{p}\sum_i z_{i0}^2.
|
||||
$$
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #408080; font-style: italic"># Now add PCA</span>
|
||||
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.decomposition</span> <span style="color: #008000; font-weight: bold">import</span> PCA
|
||||
pca <span style="color: #666666">=</span> PCA(n_components <span style="color: #666666">=</span> <span style="color: #666666">2</span>)
|
||||
pca<span style="color: #666666">.</span>fit(X_train_scaled)
|
||||
<p>
|
||||
We can show that the variance of the project coordinates defined by \( \boldsymbol{w}_0^T\boldsymbol{x}_i \) are given by
|
||||
$$
|
||||
\mathrm{var}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \frac{1}{p}\sum_i z_{i0}^2,
|
||||
$$
|
||||
|
||||
since the expectation value of
|
||||
$$
|
||||
\mathbb{E}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \mathbb{E}[z_{i0}]= \boldsymbol{w}_0^T\mathbb{E}[\boldsymbol{x}_i]=0,
|
||||
$$
|
||||
|
||||
where we have used the fact that our data are centered.
|
||||
|
||||
<p>
|
||||
Recalling our definition of the covariance as
|
||||
$$
|
||||
\boldsymbol{C}[\boldsymbol{x}] = \frac{1}{n}\boldsymbol{X}\boldsymbol{X}^T= \mathbb{E}[\boldsymbol{X}\boldsymbol{X}^T],
|
||||
$$
|
||||
|
||||
we have thus that
|
||||
$$
|
||||
\mathrm{var}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \frac{1}{p}\sum_i z_{i0}^2=\boldsymbol{w}_0^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0.
|
||||
$$
|
||||
|
||||
<p>
|
||||
We are almost there, we have obtained a relation between minimizing the reconstruction error and the variance and the covariance matrix. Minimizing the error is equivalent to maximizing the variance of the projected data.
|
||||
|
||||
X_pca <span style="color: #666666">=</span> pca<span style="color: #666666">.</span>transform(X_train_scaled)
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
@@ -216,6 +243,9 @@ X_pca <span style="color: #666666">=</span> pca<span style="color: #666666">.</s
|
||||
<li><a href="._DimRed-bs026.html">27</a></li>
|
||||
<li><a href="._DimRed-bs027.html">28</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs029.html">30</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs021.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -180,39 +184,38 @@ MathJax.Hub.Config({
|
||||
<a name="part0021"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec20" class="anchor">Principal Component Analysis </h2>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
|
||||
Principal Component Analysis (PCA) is by far the most popular dimensionality reduction algorithm.
|
||||
First it identifies the hyperplane that lies closest to the data, and then it projects the data onto it.
|
||||
<h2 id="___sec20" class="anchor">The final step </h2>
|
||||
|
||||
<p>
|
||||
The following Python code uses NumPy’s <b>svd()</b> function to obtain all the principal components of the
|
||||
training set, then extracts the first two principal components
|
||||
<p>
|
||||
We could trivially maximize the variance of the projection (and
|
||||
thereby minimize the error in the reconstruction function) by letting
|
||||
the norm-2 of \( \boldsymbol{w}_0 \) go to infinity. However, this norm since we
|
||||
want the matrix \( \boldsymbol{W} \) to be an orthogonal matrix, is constrained by
|
||||
\( $\vert\vert \boldsymbol{w}_0 \vert\vert_2^2=1 \). Imposing this condition via a
|
||||
Lagrange multiplier we can then in turn maximize
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>X_centered <span style="color: #666666">=</span> X <span style="color: #666666">-</span> X<span style="color: #666666">.</span>mean(axis<span style="color: #666666">=0</span>)
|
||||
U, s, V <span style="color: #666666">=</span> np<span style="color: #666666">.</span>linalg<span style="color: #666666">.</span>svd(X_centered)
|
||||
c1 <span style="color: #666666">=</span> V<span style="color: #666666">.</span>T[:, <span style="color: #666666">0</span>]
|
||||
c2 <span style="color: #666666">=</span> V<span style="color: #666666">.</span>T[:, <span style="color: #666666">1</span>]
|
||||
</pre></div>
|
||||
<p>
|
||||
PCA assumes that the dataset is centered around the origin. Scikit-Learn’s PCA classes take care of centering
|
||||
the data for you. However, if you implement PCA yourself (as in the preceding example), or if you use other libraries, don’t
|
||||
forget to center the data first.
|
||||
$$
|
||||
J(\boldsymbol{w}_0)= \boldsymbol{w}_0^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0+\lambda_0(1-\boldsymbol{w}_0^T\boldsymbol{w}_0).
|
||||
$$
|
||||
|
||||
<p>
|
||||
Once you have identified all the principal components, you can reduce the dimensionality of the dataset
|
||||
down to \( d \) dimensions by projecting it onto the hyperplane defined by the first \( d \) principal components.
|
||||
Selecting this hyperplane ensures that the projection will preserve as much variance as possible.
|
||||
<p>
|
||||
Taking the derivative with respect to \( \boldsymbol{w}_0 \) we obtain
|
||||
|
||||
$$
|
||||
\frac{\partial J(\boldsymbol{w}_0)}{\partial \boldsymbol{w}_0}= 2\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0-2\lambda_0\boldsymbol{w}_0=0,
|
||||
$$
|
||||
|
||||
meaning that
|
||||
$$
|
||||
\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0=\lambda_0\boldsymbol{w}_0.
|
||||
$$
|
||||
|
||||
<b>The direction that maximizes the variance (or minimizes the construction error) is an eigenvector of the covariance matrix</b>! If we left multiply with \( \boldsymbol{w}_0^T \) we have the variance of the projected data is
|
||||
$$
|
||||
\boldsymbol{w}_^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0=\lambda_0.
|
||||
$$
|
||||
|
||||
If we want to maximize the variance (minimize the construction error) we simply pick the eigenvector of the covariance matrix with the largest eigenvalue. This establishes the link between the minimization of the reconstruction function \( J \) in terms of an orthogonal matrix and the maximization of the variance and thereby the covariance of our observations encoded in the design/feature matrix \( \boldsymbol{X} \). The proof for the other eigenvectors \( \boldsymbol{w}_1,\boldsymbol{w}_2,\dots \) cna be established by applying the above arguments and using the fact that basis of eigenvectors is orthogonal, see <a href="https://mitpress.mit.edu/books/machine-learning-1" target="_self">Murphy chapter 12.2</a>. The discussion in chapter 12.2 of Murphy's text has also a nice link with the Singular Value Decomposition theorem. For categorical data, see chapter 12.4 and discussion therein.
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>W2 <span style="color: #666666">=</span> V<span style="color: #666666">.</span>T[:, :<span style="color: #666666">2</span>]
|
||||
X2D <span style="color: #666666">=</span> X_centered<span style="color: #666666">.</span>dot(W2)
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
@@ -236,6 +239,8 @@ X2D <span style="color: #666666">=</span> X_centered<span style="color: #666666"
|
||||
<li><a href="._DimRed-bs026.html">27</a></li>
|
||||
<li><a href="._DimRed-bs027.html">28</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs029.html">30</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs022.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -178,36 +182,20 @@ MathJax.Hub.Config({
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0022"></a>
|
||||
<!-- !split -->
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec21" class="anchor">PCA and scikit-learn </h2>
|
||||
<h2 id="___sec21" class="anchor">PCA and Scikit-Learn Functionality </h2>
|
||||
|
||||
<p>
|
||||
Scikit-Learn’s PCA class implements PCA using SVD decomposition just like we did before. The
|
||||
following code applies PCA to reduce the dimensionality of the dataset down to two dimensions (note
|
||||
that it automatically takes care of centering the data):
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.decomposition</span> <span style="color: #008000; font-weight: bold">import</span> PCA
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #408080; font-style: italic"># Now add PCA</span>
|
||||
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.decomposition</span> <span style="color: #008000; font-weight: bold">import</span> PCA
|
||||
pca <span style="color: #666666">=</span> PCA(n_components <span style="color: #666666">=</span> <span style="color: #666666">2</span>)
|
||||
X2D <span style="color: #666666">=</span> pca<span style="color: #666666">.</span>fit_transform(X)
|
||||
</pre></div>
|
||||
<p>
|
||||
After fitting the PCA transformer to the dataset, you can access the principal components using the
|
||||
components variable (note that it contains the PCs as horizontal vectors, so, for example, the first
|
||||
principal component is equal to
|
||||
<p>
|
||||
pca<span style="color: #666666">.</span>fit(X_train_scaled)
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>pca<span style="color: #666666">.</span>components_<span style="color: #666666">.</span>T[:, <span style="color: #666666">0</span>])<span style="color: #666666">.</span>
|
||||
X_pca <span style="color: #666666">=</span> pca<span style="color: #666666">.</span>transform(X_train_scaled)
|
||||
</pre></div>
|
||||
<p>
|
||||
Another very useful piece of information is the explained variance ratio of each principal component,
|
||||
available via the \( explained\_variance\_ratio \) variable. It indicates the proportion of the dataset’s
|
||||
variance that lies along the axis of each principal component.
|
||||
More material to come here.
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
@@ -230,6 +218,8 @@ More material to come here.
|
||||
<li><a href="._DimRed-bs026.html">27</a></li>
|
||||
<li><a href="._DimRed-bs027.html">28</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs029.html">30</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs023.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -180,32 +184,38 @@ MathJax.Hub.Config({
|
||||
<a name="part0023"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec22" class="anchor">More on the PCA </h2>
|
||||
<h2 id="___sec22" class="anchor">Principal Component Analysis </h2>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
|
||||
Principal Component Analysis (PCA) is by far the most popular dimensionality reduction algorithm.
|
||||
First it identifies the hyperplane that lies closest to the data, and then it projects the data onto it.
|
||||
|
||||
<p>
|
||||
Instead of arbitrarily choosing the number of dimensions to reduce down to, it is generally preferable to
|
||||
choose the number of dimensions that add up to a sufficiently large portion of the variance (e.g., 95%).
|
||||
Unless, of course, you are reducing dimensionality for data visualization — in that case you will
|
||||
generally want to reduce the dimensionality down to 2 or 3.
|
||||
The following code computes PCA without reducing dimensionality, then computes the minimum number
|
||||
of dimensions required to preserve 95% of the training set’s variance:
|
||||
The following Python code uses NumPy’s <b>svd()</b> function to obtain all the principal components of the
|
||||
training set, then extracts the first two principal components. First we center the data
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>pca <span style="color: #666666">=</span> PCA()
|
||||
pca<span style="color: #666666">.</span>fit(X)
|
||||
cumsum <span style="color: #666666">=</span> np<span style="color: #666666">.</span>cumsum(pca<span style="color: #666666">.</span>explained_variance_ratio_)
|
||||
d <span style="color: #666666">=</span> np<span style="color: #666666">.</span>argmax(cumsum <span style="color: #666666">>=</span> <span style="color: #666666">0.95</span>) <span style="color: #666666">+</span> <span style="color: #666666">1</span>
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>X_centered <span style="color: #666666">=</span> X <span style="color: #666666">-</span> X<span style="color: #666666">.</span>mean(axis<span style="color: #666666">=0</span>)
|
||||
U, s, V <span style="color: #666666">=</span> np<span style="color: #666666">.</span>linalg<span style="color: #666666">.</span>svd(X_centered)
|
||||
c1 <span style="color: #666666">=</span> V<span style="color: #666666">.</span>T[:, <span style="color: #666666">0</span>]
|
||||
c2 <span style="color: #666666">=</span> V<span style="color: #666666">.</span>T[:, <span style="color: #666666">1</span>]
|
||||
</pre></div>
|
||||
<p>
|
||||
You could then set \( n\_components=d \) and run PCA again. However, there is a much better option: instead
|
||||
of specifying the number of principal components you want to preserve, you can set \( n\_components \) to be
|
||||
a float between 0.0 and 1.0, indicating the ratio of variance you wish to preserve:
|
||||
PCA assumes that the dataset is centered around the origin. Scikit-Learn’s PCA classes take care of centering
|
||||
the data for you. However, if you implement PCA yourself (as in the preceding example), or if you use other libraries, don’t
|
||||
forget to center the data first.
|
||||
|
||||
<p>
|
||||
Once you have identified all the principal components, you can reduce the dimensionality of the dataset
|
||||
down to \( d \) dimensions by projecting it onto the hyperplane defined by the first \( d \) principal components.
|
||||
Selecting this hyperplane ensures that the projection will preserve as much variance as possible.
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>pca <span style="color: #666666">=</span> PCA(n_components<span style="color: #666666">=0.95</span>)
|
||||
X_reduced <span style="color: #666666">=</span> pca<span style="color: #666666">.</span>fit_transform(X)
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>W2 <span style="color: #666666">=</span> V<span style="color: #666666">.</span>T[:, :<span style="color: #666666">2</span>]
|
||||
X2D <span style="color: #666666">=</span> X_centered<span style="color: #666666">.</span>dot(W2)
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
@@ -228,6 +238,8 @@ X_reduced <span style="color: #666666">=</span> pca<span style="color: #666666">
|
||||
<li><a href="._DimRed-bs026.html">27</a></li>
|
||||
<li><a href="._DimRed-bs027.html">28</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs029.html">30</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs024.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -178,16 +182,35 @@ MathJax.Hub.Config({
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0024"></a>
|
||||
<!-- !split -->
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec23" class="anchor">Incremental PCA </h2>
|
||||
<h2 id="___sec23" class="anchor">PCA and scikit-learn </h2>
|
||||
|
||||
<p>
|
||||
One problem with the preceding implementation of PCA is that it requires the whole training set to fit in
|
||||
memory in order for the SVD algorithm to run. Fortunately, Incremental PCA (IPCA) algorithms have
|
||||
been developed: you can split the training set into mini-batches and feed an IPCA algorithm one minibatch
|
||||
at a time. This is useful for large training sets, and also to apply PCA online (i.e., on the fly, as new
|
||||
instances arrive).
|
||||
Scikit-Learn’s PCA class implements PCA using SVD decomposition just like we did before. The
|
||||
following code applies PCA to reduce the dimensionality of the dataset down to two dimensions (note
|
||||
that it automatically takes care of centering the data):
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.decomposition</span> <span style="color: #008000; font-weight: bold">import</span> PCA
|
||||
pca <span style="color: #666666">=</span> PCA(n_components <span style="color: #666666">=</span> <span style="color: #666666">2</span>)
|
||||
X2D <span style="color: #666666">=</span> pca<span style="color: #666666">.</span>fit_transform(X)
|
||||
</pre></div>
|
||||
<p>
|
||||
After fitting the PCA transformer to the dataset, you can access the principal components using the
|
||||
components variable (note that it contains the PCs as horizontal vectors, so, for example, the first
|
||||
principal component is equal to
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>pca<span style="color: #666666">.</span>components_<span style="color: #666666">.</span>T[:, <span style="color: #666666">0</span>])<span style="color: #666666">.</span>
|
||||
</pre></div>
|
||||
<p>
|
||||
Another very useful piece of information is the explained variance ratio of each principal component,
|
||||
available via the \( explained\_variance\_ratio \) variable. It indicates the proportion of the dataset’s
|
||||
variance that lies along the axis of each principal component.
|
||||
More material to come here.
|
||||
|
||||
<p>
|
||||
<p>
|
||||
@@ -209,6 +232,8 @@ instances arrive).
|
||||
<li><a href="._DimRed-bs026.html">27</a></li>
|
||||
<li><a href="._DimRed-bs027.html">28</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs029.html">30</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs025.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -180,19 +184,33 @@ MathJax.Hub.Config({
|
||||
<a name="part0025"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec24" class="anchor">Randomized PCA </h2>
|
||||
<h2 id="___sec24" class="anchor">More on the PCA </h2>
|
||||
|
||||
<p>
|
||||
Scikit-Learn offers yet another option to perform PCA, called Randomized PCA. This is a stochastic
|
||||
algorithm that quickly finds an approximation of the first d principal components. Its computational
|
||||
complexity is \( O(m \times d^2)+O(d^3) \), instead of \( O(m \times n^2) + O(n^3) \), so it is dramatically faster than the
|
||||
previous algorithms when \( d \) is much smaller than \( n \).
|
||||
|
||||
Instead of arbitrarily choosing the number of dimensions to reduce down to, it is generally preferable to
|
||||
choose the number of dimensions that add up to a sufficiently large portion of the variance (e.g., 95%).
|
||||
Unless, of course, you are reducing dimensionality for data visualization — in that case you will
|
||||
generally want to reduce the dimensionality down to 2 or 3.
|
||||
The following code computes PCA without reducing dimensionality, then computes the minimum number
|
||||
of dimensions required to preserve 95% of the training set’s variance:
|
||||
<p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>pca <span style="color: #666666">=</span> PCA()
|
||||
pca<span style="color: #666666">.</span>fit(X)
|
||||
cumsum <span style="color: #666666">=</span> np<span style="color: #666666">.</span>cumsum(pca<span style="color: #666666">.</span>explained_variance_ratio_)
|
||||
d <span style="color: #666666">=</span> np<span style="color: #666666">.</span>argmax(cumsum <span style="color: #666666">>=</span> <span style="color: #666666">0.95</span>) <span style="color: #666666">+</span> <span style="color: #666666">1</span>
|
||||
</pre></div>
|
||||
<p>
|
||||
You could then set \( n\_components=d \) and run PCA again. However, there is a much better option: instead
|
||||
of specifying the number of principal components you want to preserve, you can set \( n\_components \) to be
|
||||
a float between 0.0 and 1.0, indicating the ratio of variance you wish to preserve:
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>pca <span style="color: #666666">=</span> PCA(n_components<span style="color: #666666">=0.95</span>)
|
||||
X_reduced <span style="color: #666666">=</span> pca<span style="color: #666666">.</span>fit_transform(X)
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
@@ -212,6 +230,8 @@ previous algorithms when \( d \) is much smaller than \( n \).
|
||||
<li><a href="._DimRed-bs026.html">27</a></li>
|
||||
<li><a href="._DimRed-bs027.html">28</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs029.html">30</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs026.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -180,32 +184,14 @@ MathJax.Hub.Config({
|
||||
<a name="part0026"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec25" class="anchor">Kernel PCA </h2>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
|
||||
<h2 id="___sec25" class="anchor">Incremental PCA </h2>
|
||||
|
||||
<p>
|
||||
The kernel trick is a mathematical technique that implicitly maps instances into a
|
||||
very high-dimensional space (called the feature space), enabling nonlinear classification and regression
|
||||
with Support Vector Machines. Recall that a linear decision boundary in the high-dimensional feature
|
||||
space corresponds to a complex nonlinear decision boundary in the original space.
|
||||
It turns out that the same trick can be applied to PCA, making it possible to perform complex nonlinear
|
||||
projections for dimensionality reduction. This is called Kernel PCA (kPCA). It is often good at
|
||||
preserving clusters of instances after projection, or sometimes even unrolling datasets that lie close to a
|
||||
twisted manifold.
|
||||
For example, the following code uses Scikit-Learn’s KernelPCA class to perform kPCA with an
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.decomposition</span> <span style="color: #008000; font-weight: bold">import</span> KernelPCA
|
||||
rbf_pca <span style="color: #666666">=</span> KernelPCA(n_components <span style="color: #666666">=</span> <span style="color: #666666">2</span>, kernel<span style="color: #666666">=</span><span style="color: #BA2121">"rbf"</span>, gamma<span style="color: #666666">=0.04</span>)
|
||||
X_reduced <span style="color: #666666">=</span> rbf_pca<span style="color: #666666">.</span>fit_transform(X)
|
||||
</pre></div>
|
||||
<p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
One problem with the preceding implementation of PCA is that it requires the whole training set to fit in
|
||||
memory in order for the SVD algorithm to run. Fortunately, Incremental PCA (IPCA) algorithms have
|
||||
been developed: you can split the training set into mini-batches and feed an IPCA algorithm one minibatch
|
||||
at a time. This is useful for large training sets, and also to apply PCA online (i.e., on the fly, as new
|
||||
instances arrive).
|
||||
|
||||
<p>
|
||||
<p>
|
||||
@@ -225,6 +211,8 @@ X_reduced <span style="color: #666666">=</span> rbf_pca<span style="color: #6666
|
||||
<li class="active"><a href="._DimRed-bs026.html">27</a></li>
|
||||
<li><a href="._DimRed-bs027.html">28</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs029.html">30</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs027.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -180,14 +184,18 @@ MathJax.Hub.Config({
|
||||
<a name="part0027"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec26" class="anchor">LLE </h2>
|
||||
<h2 id="___sec26" class="anchor">Randomized PCA </h2>
|
||||
|
||||
<p>
|
||||
Locally Linear Embedding (LLE) is another very powerful nonlinear dimensionality reduction
|
||||
(NLDR) technique. It is a Manifold Learning technique that does not rely on projections like the previous
|
||||
algorithms. In a nutshell, LLE works by first measuring how each training instance linearly relates to its
|
||||
closest neighbors (c.n.), and then looking for a low-dimensional representation of the training set where
|
||||
these local relationships are best preserved (more details shortly).
|
||||
Scikit-Learn offers yet another option to perform PCA, called Randomized PCA. This is a stochastic
|
||||
algorithm that quickly finds an approximation of the first d principal components. Its computational
|
||||
complexity is \( O(m \times d^2)+O(d^3) \), instead of \( O(m \times n^2) + O(n^3) \), so it is dramatically faster than the
|
||||
previous algorithms when \( d \) is much smaller than \( n \).
|
||||
|
||||
<p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p>
|
||||
<p>
|
||||
@@ -206,6 +214,8 @@ these local relationships are best preserved (more details shortly).
|
||||
<li><a href="._DimRed-bs026.html">27</a></li>
|
||||
<li class="active"><a href="._DimRed-bs027.html">28</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs029.html">30</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs028.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -91,15 +91,17 @@ Automatically generated HTML file from DocOnce source
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -156,15 +158,17 @@ MathJax.Hub.Config({
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs017.html#___sec16" style="font-size: 80%;">The Algorithm before the Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs018.html#___sec17" style="font-size: 80%;">Classical PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs019.html#___sec18" style="font-size: 80%;">Proof of the PCA Theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">Getting started with PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Other techniques</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs020.html#___sec19" style="font-size: 80%;">PCA Proof continued</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs021.html#___sec20" style="font-size: 80%;">The final step</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">PCA and Scikit-Learn Functionality</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">PCA and scikit-learn</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">More on the PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Incremental PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Randomized PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs030.html#___sec29" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -199,7 +203,7 @@ MathJax.Hub.Config({
|
||||
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
|
||||
<br>
|
||||
<p>
|
||||
<center><h4>Oct 22, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 24, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
|
||||
@@ -223,7 +227,7 @@ MathJax.Hub.Config({
|
||||
<li><a href="._DimRed-bs008.html">9</a></li>
|
||||
<li><a href="._DimRed-bs009.html">10</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._DimRed-bs028.html">29</a></li>
|
||||
<li><a href="._DimRed-bs030.html">31</a></li>
|
||||
<li><a href="._DimRed-bs001.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
@@ -148,7 +148,7 @@ MathJax.Hub.Config({
|
||||
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
|
||||
<br>
|
||||
<p> <br>
|
||||
<center><h4>Oct 22, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 24, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
|
||||
@@ -1004,10 +1004,10 @@ $$
|
||||
<p> <br>
|
||||
|
||||
with \( \overline{\boldsymbol{x}_i} = \boldsymbol{W}\boldsymbol{z}_i \), where \( \boldsymbol{z}_i \) is a row vector with dimension \( {\mathbb{R}}^{n} \) of the matrix
|
||||
\( \boldsymbol{Z}\in {\mathbb{R}}^{p\times n} \).
|
||||
\( \boldsymbol{Z}\in {\mathbb{R}}^{p\times n} \). When doing PCA we want to reduce this dimensionality.
|
||||
|
||||
<p>
|
||||
The PCA theorem states that minimizing the above reconstruction error corresponds to setting \( \boldsymbol{W}=\boldsymbol{S} \), the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors \( l \) $\boldsymbol{z}_i$, with \( l < < p \), defined by the orthogonal projection of the data onto the columns spanned by they eigenvectors of the covariance(correlations matrix).
|
||||
The PCA theorem states that minimizing the above reconstruction error corresponds to setting \( \boldsymbol{W}=\boldsymbol{S} \), the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors \( l \) $\boldsymbol{z}_i$, with \( l < < p \), defined by the orthogonal projection of the data onto the columns spanned by the eigenvectors of the covariance(correlations matrix).
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1015,7 +1015,7 @@ The PCA theorem states that minimizing the above reconstruction error correspond
|
||||
<h2 id="___sec18">Proof of the PCA Theorem </h2>
|
||||
|
||||
<p>
|
||||
To show the PCA theorem let us start with the assumption that there is a vector \( \boldsymbol{w}_0 \) which corresponds to a solution which minimized the reconstruction error \( J \). This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of \( \boldsymbol{w}_0 \) and \( \boldsymbol{z}_0 \) as
|
||||
To show the PCA theorem let us start with the assumption that there is one vector \( \boldsymbol{w}_0 \) which corresponds to a solution which minimized the reconstruction error \( J \). This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of \( \boldsymbol{w}_0 \) and \( \boldsymbol{z}_0 \) as
|
||||
<p> <br>
|
||||
$$
|
||||
J(\boldsymbol{w}_0,\boldsymbol{z}_0)= \frac{1}{p}\sum_i (\boldsymbol{x}_i - z_{i0}\boldsymbol{w}_0)^2=\frac{1}{p}\sum_i (\boldsymbol{x}_^T\boldsymbol{x}_i - 2z_{i0}\boldsymbol{w}_0^T\boldsymbol{x}_i+z_{i0}^2\boldsymbol{w}_0^T\boldsymbol{w}_0),
|
||||
@@ -1041,7 +1041,98 @@ where the vectors on the rhs are known.
|
||||
|
||||
|
||||
<section>
|
||||
<h2 id="___sec19">Getting started with PCA </h2>
|
||||
<h2 id="___sec19">PCA Proof continued </h2>
|
||||
|
||||
<p>
|
||||
We have now found the unknown parameters \( z_{i0} \). These correspond to the project coordinates and we can write
|
||||
<p> <br>
|
||||
$$
|
||||
J(\boldsymbol{w}_0)= \frac{1}{p}\sum_i (\boldsymbol{x}_i^T\boldsymbol{x}_i - z_{i0}^2)=\mathrm{const}-\frac{1}{p}\sum_i z_{i0}^2.
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
<p>
|
||||
We can show that the variance of the project coordinates defined by \( \boldsymbol{w}_0^T\boldsymbol{x}_i \) are given by
|
||||
<p> <br>
|
||||
$$
|
||||
\mathrm{var}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \frac{1}{p}\sum_i z_{i0}^2,
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
since the expectation value of
|
||||
<p> <br>
|
||||
$$
|
||||
\mathbb{E}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \mathbb{E}[z_{i0}]= \boldsymbol{w}_0^T\mathbb{E}[\boldsymbol{x}_i]=0,
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
where we have used the fact that our data are centered.
|
||||
|
||||
<p>
|
||||
Recalling our definition of the covariance as
|
||||
<p> <br>
|
||||
$$
|
||||
\boldsymbol{C}[\boldsymbol{x}] = \frac{1}{n}\boldsymbol{X}\boldsymbol{X}^T= \mathbb{E}[\boldsymbol{X}\boldsymbol{X}^T],
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
we have thus that
|
||||
<p> <br>
|
||||
$$
|
||||
\mathrm{var}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \frac{1}{p}\sum_i z_{i0}^2=\boldsymbol{w}_0^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0.
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
<p>
|
||||
We are almost there, we have obtained a relation between minimizing the reconstruction error and the variance and the covariance matrix. Minimizing the error is equivalent to maximizing the variance of the projected data.
|
||||
</section>
|
||||
|
||||
|
||||
<section>
|
||||
<h2 id="___sec20">The final step </h2>
|
||||
|
||||
<p>
|
||||
We could trivially maximize the variance of the projection (and
|
||||
thereby minimize the error in the reconstruction function) by letting
|
||||
the norm-2 of \( \boldsymbol{w}_0 \) go to infinity. However, this norm since we
|
||||
want the matrix \( \boldsymbol{W} \) to be an orthogonal matrix, is constrained by
|
||||
\( $\vert\vert \boldsymbol{w}_0 \vert\vert_2^2=1 \). Imposing this condition via a
|
||||
Lagrange multiplier we can then in turn maximize
|
||||
|
||||
<p> <br>
|
||||
$$
|
||||
J(\boldsymbol{w}_0)= \boldsymbol{w}_0^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0+\lambda_0(1-\boldsymbol{w}_0^T\boldsymbol{w}_0).
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
Taking the derivative with respect to \( \boldsymbol{w}_0 \) we obtain
|
||||
|
||||
<p> <br>
|
||||
$$
|
||||
\frac{\partial J(\boldsymbol{w}_0)}{\partial \boldsymbol{w}_0}= 2\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0-2\lambda_0\boldsymbol{w}_0=0,
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
meaning that
|
||||
<p> <br>
|
||||
$$
|
||||
\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0=\lambda_0\boldsymbol{w}_0.
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
<b>The direction that maximizes the variance (or minimizes the construction error) is an eigenvector of the covariance matrix</b>! If we left multiply with \( \boldsymbol{w}_0^T \) we have the variance of the projected data is
|
||||
<p> <br>
|
||||
$$
|
||||
\boldsymbol{w}_^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0=\lambda_0.
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
If we want to maximize the variance (minimize the construction error) we simply pick the eigenvector of the covariance matrix with the largest eigenvalue. This establishes the link between the minimization of the reconstruction function \( J \) in terms of an orthogonal matrix and the maximization of the variance and thereby the covariance of our observations encoded in the design/feature matrix \( \boldsymbol{X} \). The proof for the other eigenvectors \( \boldsymbol{w}_1,\boldsymbol{w}_2,\dots \) cna be established by applying the above arguments and using the fact that basis of eigenvectors is orthogonal, see <a href="https://mitpress.mit.edu/books/machine-learning-1" target="_blank">Murphy chapter 12.2</a>. The discussion in chapter 12.2 of Murphy's text has also a nice link with the Singular Value Decomposition theorem. For categorical data, see chapter 12.4 and discussion therein.
|
||||
</section>
|
||||
|
||||
|
||||
<section>
|
||||
<h2 id="___sec21">PCA and Scikit-Learn Functionality </h2>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -1057,7 +1148,7 @@ X_pca = pca.transform(X_train_scaled)
|
||||
|
||||
|
||||
<section>
|
||||
<h2 id="___sec20">Principal Component Analysis </h2>
|
||||
<h2 id="___sec22">Principal Component Analysis </h2>
|
||||
<div class="alert alert-block alert-block alert-text-normal">
|
||||
<b></b>
|
||||
<p>
|
||||
@@ -1066,7 +1157,7 @@ First it identifies the hyperplane that lies closest to the data, and then it pr
|
||||
|
||||
<p>
|
||||
The following Python code uses NumPy’s <b>svd()</b> function to obtain all the principal components of the
|
||||
training set, then extracts the first two principal components
|
||||
training set, then extracts the first two principal components. First we center the data
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
|
||||
@@ -1094,7 +1185,7 @@ X2D = X_centered.dot(W2)
|
||||
|
||||
|
||||
<section>
|
||||
<h2 id="___sec21">PCA and scikit-learn </h2>
|
||||
<h2 id="___sec23">PCA and scikit-learn </h2>
|
||||
|
||||
<p>
|
||||
Scikit-Learn’s PCA class implements PCA using SVD decomposition just like we did before. The
|
||||
@@ -1125,7 +1216,7 @@ More material to come here.
|
||||
|
||||
|
||||
<section>
|
||||
<h2 id="___sec22">More on the PCA </h2>
|
||||
<h2 id="___sec24">More on the PCA </h2>
|
||||
|
||||
<p>
|
||||
Instead of arbitrarily choosing the number of dimensions to reduce down to, it is generally preferable to
|
||||
@@ -1156,7 +1247,7 @@ X_reduced = pca.fit_transform(X)
|
||||
|
||||
|
||||
<section>
|
||||
<h2 id="___sec23">Incremental PCA </h2>
|
||||
<h2 id="___sec25">Incremental PCA </h2>
|
||||
|
||||
<p>
|
||||
One problem with the preceding implementation of PCA is that it requires the whole training set to fit in
|
||||
@@ -1168,7 +1259,7 @@ instances arrive).
|
||||
|
||||
|
||||
<section>
|
||||
<h2 id="___sec24">Randomized PCA </h2>
|
||||
<h2 id="___sec26">Randomized PCA </h2>
|
||||
|
||||
<p>
|
||||
Scikit-Learn offers yet another option to perform PCA, called Randomized PCA. This is a stochastic
|
||||
@@ -1182,7 +1273,7 @@ previous algorithms when \( d \) is much smaller than \( n \).
|
||||
|
||||
|
||||
<section>
|
||||
<h2 id="___sec25">Kernel PCA </h2>
|
||||
<h2 id="___sec27">Kernel PCA </h2>
|
||||
<div class="alert alert-block alert-block alert-text-normal">
|
||||
<b></b>
|
||||
<p>
|
||||
@@ -1208,7 +1299,7 @@ X_reduced = rbf_pca.fit_transform(X)
|
||||
|
||||
|
||||
<section>
|
||||
<h2 id="___sec26">LLE </h2>
|
||||
<h2 id="___sec28">LLE </h2>
|
||||
|
||||
<p>
|
||||
Locally Linear Embedding (LLE) is another very powerful nonlinear dimensionality reduction
|
||||
@@ -1220,7 +1311,7 @@ these local relationships are best preserved (more details shortly).
|
||||
|
||||
|
||||
<section>
|
||||
<h2 id="___sec27">Other techniques </h2>
|
||||
<h2 id="___sec29">Other techniques </h2>
|
||||
|
||||
<p>
|
||||
There are many other dimensionality reduction techniques, several of which are available in Scikit-Learn.
|
||||
@@ -1255,42 +1346,6 @@ display(df)
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(df.std())
|
||||
display(df**<span style="color: #B452CD">2</span>)
|
||||
</pre></div>
|
||||
<p>
|
||||
Thereafter we can select specific columns only and plot final results
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
|
||||
<div class="highlight" style="background: #eeeedd"><pre style="font-size: 80%; line-height: 125%"><span></span>df.columns = [<span style="color: #CD5555">'First'</span>, <span style="color: #CD5555">'Second'</span>, <span style="color: #CD5555">'Third'</span>, <span style="color: #CD5555">'Fourth'</span>, <span style="color: #CD5555">'Fifth'</span>]
|
||||
df.index = np.arange(<span style="color: #B452CD">10</span>)
|
||||
|
||||
display(df)
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(df[<span style="color: #CD5555">'Second'</span>].mean() )
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(df.info())
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(df.describe())
|
||||
|
||||
<span style="color: #8B008B; font-weight: bold">from</span> <span style="color: #008b45; text-decoration: underline">pylab</span> <span style="color: #8B008B; font-weight: bold">import</span> plt, mpl
|
||||
plt.style.use(<span style="color: #CD5555">'seaborn'</span>)
|
||||
mpl.rcParams[<span style="color: #CD5555">'font.family'</span>] = <span style="color: #CD5555">'serif'</span>
|
||||
|
||||
df.cumsum().plot(lw=<span style="color: #B452CD">2.0</span>, figsize=(<span style="color: #B452CD">10</span>,<span style="color: #B452CD">6</span>))
|
||||
plt.show()
|
||||
|
||||
|
||||
df.plot.bar(figsize=(<span style="color: #B452CD">10</span>,<span style="color: #B452CD">6</span>), rot=<span style="color: #B452CD">15</span>)
|
||||
plt.show()
|
||||
</pre></div>
|
||||
<p>
|
||||
We can produce a \( 4\times 4 \) matrix
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
|
||||
<div class="highlight" style="background: #eeeedd"><pre style="font-size: 80%; line-height: 125%"><span></span>b = np.arange(<span style="color: #B452CD">16</span>).reshape((<span style="color: #B452CD">4</span>,<span style="color: #B452CD">4</span>))
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(b)
|
||||
df1 = pd.DataFrame(b)
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(df1)
|
||||
</pre></div>
|
||||
<p>
|
||||
and many other operations.
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
@@ -111,15 +111,17 @@ div { text-align: justify; text-justify: inter-word; }
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -161,7 +163,7 @@ MathJax.Hub.Config({
|
||||
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
|
||||
<br>
|
||||
<p>
|
||||
<center><h4>Oct 22, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 24, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
@@ -966,10 +968,10 @@ J(\boldsymbol{W},\boldsymbol{Z}) = \frac{1}{p}\sum_i (\boldsymbol{x}_i - \overli
|
||||
$$
|
||||
|
||||
with \( \overline{\boldsymbol{x}_i} = \boldsymbol{W}\boldsymbol{z}_i \), where \( \boldsymbol{z}_i \) is a row vector with dimension \( {\mathbb{R}}^{n} \) of the matrix
|
||||
\( \boldsymbol{Z}\in {\mathbb{R}}^{p\times n} \).
|
||||
\( \boldsymbol{Z}\in {\mathbb{R}}^{p\times n} \). When doing PCA we want to reduce this dimensionality.
|
||||
|
||||
<p>
|
||||
The PCA theorem states that minimizing the above reconstruction error corresponds to setting \( \boldsymbol{W}=\boldsymbol{S} \), the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors \( l \) $\boldsymbol{z}_i$, with \( l < < p \), defined by the orthogonal projection of the data onto the columns spanned by they eigenvectors of the covariance(correlations matrix).
|
||||
The PCA theorem states that minimizing the above reconstruction error corresponds to setting \( \boldsymbol{W}=\boldsymbol{S} \), the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors \( l \) $\boldsymbol{z}_i$, with \( l < < p \), defined by the orthogonal projection of the data onto the columns spanned by the eigenvectors of the covariance(correlations matrix).
|
||||
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
@@ -977,7 +979,7 @@ The PCA theorem states that minimizing the above reconstruction error correspond
|
||||
<h2 id="___sec18">Proof of the PCA Theorem </h2>
|
||||
|
||||
<p>
|
||||
To show the PCA theorem let us start with the assumption that there is a vector \( \boldsymbol{w}_0 \) which corresponds to a solution which minimized the reconstruction error \( J \). This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of \( \boldsymbol{w}_0 \) and \( \boldsymbol{z}_0 \) as
|
||||
To show the PCA theorem let us start with the assumption that there is one vector \( \boldsymbol{w}_0 \) which corresponds to a solution which minimized the reconstruction error \( J \). This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of \( \boldsymbol{w}_0 \) and \( \boldsymbol{z}_0 \) as
|
||||
$$
|
||||
J(\boldsymbol{w}_0,\boldsymbol{z}_0)= \frac{1}{p}\sum_i (\boldsymbol{x}_i - z_{i0}\boldsymbol{w}_0)^2=\frac{1}{p}\sum_i (\boldsymbol{x}_^T\boldsymbol{x}_i - 2z_{i0}\boldsymbol{w}_0^T\boldsymbol{x}_i+z_{i0}^2\boldsymbol{w}_0^T\boldsymbol{w}_0),
|
||||
$$
|
||||
@@ -997,7 +999,80 @@ where the vectors on the rhs are known.
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec19">Getting started with PCA </h2>
|
||||
<h2 id="___sec19">PCA Proof continued </h2>
|
||||
|
||||
<p>
|
||||
We have now found the unknown parameters \( z_{i0} \). These correspond to the project coordinates and we can write
|
||||
$$
|
||||
J(\boldsymbol{w}_0)= \frac{1}{p}\sum_i (\boldsymbol{x}_i^T\boldsymbol{x}_i - z_{i0}^2)=\mathrm{const}-\frac{1}{p}\sum_i z_{i0}^2.
|
||||
$$
|
||||
|
||||
<p>
|
||||
We can show that the variance of the project coordinates defined by \( \boldsymbol{w}_0^T\boldsymbol{x}_i \) are given by
|
||||
$$
|
||||
\mathrm{var}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \frac{1}{p}\sum_i z_{i0}^2,
|
||||
$$
|
||||
|
||||
since the expectation value of
|
||||
$$
|
||||
\mathbb{E}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \mathbb{E}[z_{i0}]= \boldsymbol{w}_0^T\mathbb{E}[\boldsymbol{x}_i]=0,
|
||||
$$
|
||||
|
||||
where we have used the fact that our data are centered.
|
||||
|
||||
<p>
|
||||
Recalling our definition of the covariance as
|
||||
$$
|
||||
\boldsymbol{C}[\boldsymbol{x}] = \frac{1}{n}\boldsymbol{X}\boldsymbol{X}^T= \mathbb{E}[\boldsymbol{X}\boldsymbol{X}^T],
|
||||
$$
|
||||
|
||||
we have thus that
|
||||
$$
|
||||
\mathrm{var}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \frac{1}{p}\sum_i z_{i0}^2=\boldsymbol{w}_0^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0.
|
||||
$$
|
||||
|
||||
<p>
|
||||
We are almost there, we have obtained a relation between minimizing the reconstruction error and the variance and the covariance matrix. Minimizing the error is equivalent to maximizing the variance of the projected data.
|
||||
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec20">The final step </h2>
|
||||
|
||||
<p>
|
||||
We could trivially maximize the variance of the projection (and
|
||||
thereby minimize the error in the reconstruction function) by letting
|
||||
the norm-2 of \( \boldsymbol{w}_0 \) go to infinity. However, this norm since we
|
||||
want the matrix \( \boldsymbol{W} \) to be an orthogonal matrix, is constrained by
|
||||
\( $\vert\vert \boldsymbol{w}_0 \vert\vert_2^2=1 \). Imposing this condition via a
|
||||
Lagrange multiplier we can then in turn maximize
|
||||
|
||||
$$
|
||||
J(\boldsymbol{w}_0)= \boldsymbol{w}_0^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0+\lambda_0(1-\boldsymbol{w}_0^T\boldsymbol{w}_0).
|
||||
$$
|
||||
|
||||
Taking the derivative with respect to \( \boldsymbol{w}_0 \) we obtain
|
||||
|
||||
$$
|
||||
\frac{\partial J(\boldsymbol{w}_0)}{\partial \boldsymbol{w}_0}= 2\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0-2\lambda_0\boldsymbol{w}_0=0,
|
||||
$$
|
||||
|
||||
meaning that
|
||||
$$
|
||||
\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0=\lambda_0\boldsymbol{w}_0.
|
||||
$$
|
||||
|
||||
<b>The direction that maximizes the variance (or minimizes the construction error) is an eigenvector of the covariance matrix</b>! If we left multiply with \( \boldsymbol{w}_0^T \) we have the variance of the projected data is
|
||||
$$
|
||||
\boldsymbol{w}_^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0=\lambda_0.
|
||||
$$
|
||||
|
||||
If we want to maximize the variance (minimize the construction error) we simply pick the eigenvector of the covariance matrix with the largest eigenvalue. This establishes the link between the minimization of the reconstruction function \( J \) in terms of an orthogonal matrix and the maximization of the variance and thereby the covariance of our observations encoded in the design/feature matrix \( \boldsymbol{X} \). The proof for the other eigenvectors \( \boldsymbol{w}_1,\boldsymbol{w}_2,\dots \) cna be established by applying the above arguments and using the fact that basis of eigenvectors is orthogonal, see <a href="https://mitpress.mit.edu/books/machine-learning-1" target="_blank">Murphy chapter 12.2</a>. The discussion in chapter 12.2 of Murphy's text has also a nice link with the Singular Value Decomposition theorem. For categorical data, see chapter 12.4 and discussion therein.
|
||||
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec21">PCA and Scikit-Learn Functionality </h2>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -1012,7 +1087,7 @@ X_pca = pca.transform(X_train_scaled)
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec20">Principal Component Analysis </h2>
|
||||
<h2 id="___sec22">Principal Component Analysis </h2>
|
||||
<div class="alert alert-block alert-block alert-text-normal">
|
||||
<b></b>
|
||||
<p>
|
||||
@@ -1021,7 +1096,7 @@ First it identifies the hyperplane that lies closest to the data, and then it pr
|
||||
|
||||
<p>
|
||||
The following Python code uses NumPy’s <b>svd()</b> function to obtain all the principal components of the
|
||||
training set, then extracts the first two principal components
|
||||
training set, then extracts the first two principal components. First we center the data
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
|
||||
@@ -1048,7 +1123,7 @@ X2D = X_centered.dot(W2)
|
||||
<p>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec21">PCA and scikit-learn </h2>
|
||||
<h2 id="___sec23">PCA and scikit-learn </h2>
|
||||
|
||||
<p>
|
||||
Scikit-Learn’s PCA class implements PCA using SVD decomposition just like we did before. The
|
||||
@@ -1079,7 +1154,7 @@ More material to come here.
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec22">More on the PCA </h2>
|
||||
<h2 id="___sec24">More on the PCA </h2>
|
||||
|
||||
<p>
|
||||
Instead of arbitrarily choosing the number of dimensions to reduce down to, it is generally preferable to
|
||||
@@ -1109,7 +1184,7 @@ X_reduced = pca.fit_transform(X)
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec23">Incremental PCA </h2>
|
||||
<h2 id="___sec25">Incremental PCA </h2>
|
||||
|
||||
<p>
|
||||
One problem with the preceding implementation of PCA is that it requires the whole training set to fit in
|
||||
@@ -1121,7 +1196,7 @@ instances arrive).
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec24">Randomized PCA </h2>
|
||||
<h2 id="___sec26">Randomized PCA </h2>
|
||||
|
||||
<p>
|
||||
Scikit-Learn offers yet another option to perform PCA, called Randomized PCA. This is a stochastic
|
||||
@@ -1136,7 +1211,7 @@ previous algorithms when \( d \) is much smaller than \( n \).
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec25">Kernel PCA </h2>
|
||||
<h2 id="___sec27">Kernel PCA </h2>
|
||||
<div class="alert alert-block alert-block alert-text-normal">
|
||||
<b></b>
|
||||
<p>
|
||||
@@ -1165,7 +1240,7 @@ X_reduced = rbf_pca.fit_transform(X)
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec26">LLE </h2>
|
||||
<h2 id="___sec28">LLE </h2>
|
||||
|
||||
<p>
|
||||
Locally Linear Embedding (LLE) is another very powerful nonlinear dimensionality reduction
|
||||
@@ -1177,7 +1252,7 @@ these local relationships are best preserved (more details shortly).
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec27">Other techniques </h2>
|
||||
<h2 id="___sec29">Other techniques </h2>
|
||||
|
||||
<p>
|
||||
There are many other dimensionality reduction techniques, several of which are available in Scikit-Learn.
|
||||
@@ -1212,41 +1287,6 @@ display(df)
|
||||
display(df**<span style="color: #B452CD">2</span>)
|
||||
</pre></div>
|
||||
<p>
|
||||
Thereafter we can select specific columns only and plot final results
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
|
||||
<div class="highlight" style="background: #eeeedd"><pre style="line-height: 125%"><span></span>df.columns = [<span style="color: #CD5555">'First'</span>, <span style="color: #CD5555">'Second'</span>, <span style="color: #CD5555">'Third'</span>, <span style="color: #CD5555">'Fourth'</span>, <span style="color: #CD5555">'Fifth'</span>]
|
||||
df.index = np.arange(<span style="color: #B452CD">10</span>)
|
||||
|
||||
display(df)
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(df[<span style="color: #CD5555">'Second'</span>].mean() )
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(df.info())
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(df.describe())
|
||||
|
||||
<span style="color: #8B008B; font-weight: bold">from</span> <span style="color: #008b45; text-decoration: underline">pylab</span> <span style="color: #8B008B; font-weight: bold">import</span> plt, mpl
|
||||
plt.style.use(<span style="color: #CD5555">'seaborn'</span>)
|
||||
mpl.rcParams[<span style="color: #CD5555">'font.family'</span>] = <span style="color: #CD5555">'serif'</span>
|
||||
|
||||
df.cumsum().plot(lw=<span style="color: #B452CD">2.0</span>, figsize=(<span style="color: #B452CD">10</span>,<span style="color: #B452CD">6</span>))
|
||||
plt.show()
|
||||
|
||||
|
||||
df.plot.bar(figsize=(<span style="color: #B452CD">10</span>,<span style="color: #B452CD">6</span>), rot=<span style="color: #B452CD">15</span>)
|
||||
plt.show()
|
||||
</pre></div>
|
||||
<p>
|
||||
We can produce a \( 4\times 4 \) matrix
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
|
||||
<div class="highlight" style="background: #eeeedd"><pre style="line-height: 125%"><span></span>b = np.arange(<span style="color: #B452CD">16</span>).reshape((<span style="color: #B452CD">4</span>,<span style="color: #B452CD">4</span>))
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(b)
|
||||
df1 = pd.DataFrame(b)
|
||||
<span style="color: #8B008B; font-weight: bold">print</span>(df1)
|
||||
</pre></div>
|
||||
<p>
|
||||
and many other operations.
|
||||
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
|
||||
@@ -116,15 +116,17 @@ div { text-align: justify; text-justify: inter-word; }
|
||||
('The Algorithm before the Theorem', 2, None, '___sec16'),
|
||||
('Classical PCA Theorem', 2, None, '___sec17'),
|
||||
('Proof of the PCA Theorem', 2, None, '___sec18'),
|
||||
('Getting started with PCA', 2, None, '___sec19'),
|
||||
('Principal Component Analysis', 2, None, '___sec20'),
|
||||
('PCA and scikit-learn', 2, None, '___sec21'),
|
||||
('More on the PCA', 2, None, '___sec22'),
|
||||
('Incremental PCA', 2, None, '___sec23'),
|
||||
('Randomized PCA', 2, None, '___sec24'),
|
||||
('Kernel PCA', 2, None, '___sec25'),
|
||||
('LLE', 2, None, '___sec26'),
|
||||
('Other techniques', 2, None, '___sec27')]}
|
||||
('PCA Proof continued', 2, None, '___sec19'),
|
||||
('The final step', 2, None, '___sec20'),
|
||||
('PCA and Scikit-Learn Functionality', 2, None, '___sec21'),
|
||||
('Principal Component Analysis', 2, None, '___sec22'),
|
||||
('PCA and scikit-learn', 2, None, '___sec23'),
|
||||
('More on the PCA', 2, None, '___sec24'),
|
||||
('Incremental PCA', 2, None, '___sec25'),
|
||||
('Randomized PCA', 2, None, '___sec26'),
|
||||
('Kernel PCA', 2, None, '___sec27'),
|
||||
('LLE', 2, None, '___sec28'),
|
||||
('Other techniques', 2, None, '___sec29')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -166,7 +168,7 @@ MathJax.Hub.Config({
|
||||
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
|
||||
<br>
|
||||
<p>
|
||||
<center><h4>Oct 22, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 24, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
@@ -971,10 +973,10 @@ J(\boldsymbol{W},\boldsymbol{Z}) = \frac{1}{p}\sum_i (\boldsymbol{x}_i - \overli
|
||||
$$
|
||||
|
||||
with \( \overline{\boldsymbol{x}_i} = \boldsymbol{W}\boldsymbol{z}_i \), where \( \boldsymbol{z}_i \) is a row vector with dimension \( {\mathbb{R}}^{n} \) of the matrix
|
||||
\( \boldsymbol{Z}\in {\mathbb{R}}^{p\times n} \).
|
||||
\( \boldsymbol{Z}\in {\mathbb{R}}^{p\times n} \). When doing PCA we want to reduce this dimensionality.
|
||||
|
||||
<p>
|
||||
The PCA theorem states that minimizing the above reconstruction error corresponds to setting \( \boldsymbol{W}=\boldsymbol{S} \), the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors \( l \) $\boldsymbol{z}_i$, with \( l < < p \), defined by the orthogonal projection of the data onto the columns spanned by they eigenvectors of the covariance(correlations matrix).
|
||||
The PCA theorem states that minimizing the above reconstruction error corresponds to setting \( \boldsymbol{W}=\boldsymbol{S} \), the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors \( l \) $\boldsymbol{z}_i$, with \( l < < p \), defined by the orthogonal projection of the data onto the columns spanned by the eigenvectors of the covariance(correlations matrix).
|
||||
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
@@ -982,7 +984,7 @@ The PCA theorem states that minimizing the above reconstruction error correspond
|
||||
<h2 id="___sec18">Proof of the PCA Theorem </h2>
|
||||
|
||||
<p>
|
||||
To show the PCA theorem let us start with the assumption that there is a vector \( \boldsymbol{w}_0 \) which corresponds to a solution which minimized the reconstruction error \( J \). This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of \( \boldsymbol{w}_0 \) and \( \boldsymbol{z}_0 \) as
|
||||
To show the PCA theorem let us start with the assumption that there is one vector \( \boldsymbol{w}_0 \) which corresponds to a solution which minimized the reconstruction error \( J \). This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of \( \boldsymbol{w}_0 \) and \( \boldsymbol{z}_0 \) as
|
||||
$$
|
||||
J(\boldsymbol{w}_0,\boldsymbol{z}_0)= \frac{1}{p}\sum_i (\boldsymbol{x}_i - z_{i0}\boldsymbol{w}_0)^2=\frac{1}{p}\sum_i (\boldsymbol{x}_^T\boldsymbol{x}_i - 2z_{i0}\boldsymbol{w}_0^T\boldsymbol{x}_i+z_{i0}^2\boldsymbol{w}_0^T\boldsymbol{w}_0),
|
||||
$$
|
||||
@@ -1002,7 +1004,80 @@ where the vectors on the rhs are known.
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec19">Getting started with PCA </h2>
|
||||
<h2 id="___sec19">PCA Proof continued </h2>
|
||||
|
||||
<p>
|
||||
We have now found the unknown parameters \( z_{i0} \). These correspond to the project coordinates and we can write
|
||||
$$
|
||||
J(\boldsymbol{w}_0)= \frac{1}{p}\sum_i (\boldsymbol{x}_i^T\boldsymbol{x}_i - z_{i0}^2)=\mathrm{const}-\frac{1}{p}\sum_i z_{i0}^2.
|
||||
$$
|
||||
|
||||
<p>
|
||||
We can show that the variance of the project coordinates defined by \( \boldsymbol{w}_0^T\boldsymbol{x}_i \) are given by
|
||||
$$
|
||||
\mathrm{var}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \frac{1}{p}\sum_i z_{i0}^2,
|
||||
$$
|
||||
|
||||
since the expectation value of
|
||||
$$
|
||||
\mathbb{E}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \mathbb{E}[z_{i0}]= \boldsymbol{w}_0^T\mathbb{E}[\boldsymbol{x}_i]=0,
|
||||
$$
|
||||
|
||||
where we have used the fact that our data are centered.
|
||||
|
||||
<p>
|
||||
Recalling our definition of the covariance as
|
||||
$$
|
||||
\boldsymbol{C}[\boldsymbol{x}] = \frac{1}{n}\boldsymbol{X}\boldsymbol{X}^T= \mathbb{E}[\boldsymbol{X}\boldsymbol{X}^T],
|
||||
$$
|
||||
|
||||
we have thus that
|
||||
$$
|
||||
\mathrm{var}[\boldsymbol{w}_0^T\boldsymbol{x}_i] = \frac{1}{p}\sum_i z_{i0}^2=\boldsymbol{w}_0^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0.
|
||||
$$
|
||||
|
||||
<p>
|
||||
We are almost there, we have obtained a relation between minimizing the reconstruction error and the variance and the covariance matrix. Minimizing the error is equivalent to maximizing the variance of the projected data.
|
||||
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec20">The final step </h2>
|
||||
|
||||
<p>
|
||||
We could trivially maximize the variance of the projection (and
|
||||
thereby minimize the error in the reconstruction function) by letting
|
||||
the norm-2 of \( \boldsymbol{w}_0 \) go to infinity. However, this norm since we
|
||||
want the matrix \( \boldsymbol{W} \) to be an orthogonal matrix, is constrained by
|
||||
\( $\vert\vert \boldsymbol{w}_0 \vert\vert_2^2=1 \). Imposing this condition via a
|
||||
Lagrange multiplier we can then in turn maximize
|
||||
|
||||
$$
|
||||
J(\boldsymbol{w}_0)= \boldsymbol{w}_0^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0+\lambda_0(1-\boldsymbol{w}_0^T\boldsymbol{w}_0).
|
||||
$$
|
||||
|
||||
Taking the derivative with respect to \( \boldsymbol{w}_0 \) we obtain
|
||||
|
||||
$$
|
||||
\frac{\partial J(\boldsymbol{w}_0)}{\partial \boldsymbol{w}_0}= 2\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0-2\lambda_0\boldsymbol{w}_0=0,
|
||||
$$
|
||||
|
||||
meaning that
|
||||
$$
|
||||
\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0=\lambda_0\boldsymbol{w}_0.
|
||||
$$
|
||||
|
||||
<b>The direction that maximizes the variance (or minimizes the construction error) is an eigenvector of the covariance matrix</b>! If we left multiply with \( \boldsymbol{w}_0^T \) we have the variance of the projected data is
|
||||
$$
|
||||
\boldsymbol{w}_^T\boldsymbol{C}[\boldsymbol{x}]\boldsymbol{w}_0=\lambda_0.
|
||||
$$
|
||||
|
||||
If we want to maximize the variance (minimize the construction error) we simply pick the eigenvector of the covariance matrix with the largest eigenvalue. This establishes the link between the minimization of the reconstruction function \( J \) in terms of an orthogonal matrix and the maximization of the variance and thereby the covariance of our observations encoded in the design/feature matrix \( \boldsymbol{X} \). The proof for the other eigenvectors \( \boldsymbol{w}_1,\boldsymbol{w}_2,\dots \) cna be established by applying the above arguments and using the fact that basis of eigenvectors is orthogonal, see <a href="https://mitpress.mit.edu/books/machine-learning-1" target="_blank">Murphy chapter 12.2</a>. The discussion in chapter 12.2 of Murphy's text has also a nice link with the Singular Value Decomposition theorem. For categorical data, see chapter 12.4 and discussion therein.
|
||||
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec21">PCA and Scikit-Learn Functionality </h2>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -1017,7 +1092,7 @@ X_pca <span style="color: #666666">=</span> pca<span style="color: #666666">.</s
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec20">Principal Component Analysis </h2>
|
||||
<h2 id="___sec22">Principal Component Analysis </h2>
|
||||
<div class="alert alert-block alert-block alert-text-normal">
|
||||
<b></b>
|
||||
<p>
|
||||
@@ -1026,7 +1101,7 @@ First it identifies the hyperplane that lies closest to the data, and then it pr
|
||||
|
||||
<p>
|
||||
The following Python code uses NumPy’s <b>svd()</b> function to obtain all the principal components of the
|
||||
training set, then extracts the first two principal components
|
||||
training set, then extracts the first two principal components. First we center the data
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
@@ -1053,7 +1128,7 @@ X2D <span style="color: #666666">=</span> X_centered<span style="color: #666666"
|
||||
<p>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec21">PCA and scikit-learn </h2>
|
||||
<h2 id="___sec23">PCA and scikit-learn </h2>
|
||||
|
||||
<p>
|
||||
Scikit-Learn’s PCA class implements PCA using SVD decomposition just like we did before. The
|
||||
@@ -1084,7 +1159,7 @@ More material to come here.
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec22">More on the PCA </h2>
|
||||
<h2 id="___sec24">More on the PCA </h2>
|
||||
|
||||
<p>
|
||||
Instead of arbitrarily choosing the number of dimensions to reduce down to, it is generally preferable to
|
||||
@@ -1114,7 +1189,7 @@ X_reduced <span style="color: #666666">=</span> pca<span style="color: #666666">
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec23">Incremental PCA </h2>
|
||||
<h2 id="___sec25">Incremental PCA </h2>
|
||||
|
||||
<p>
|
||||
One problem with the preceding implementation of PCA is that it requires the whole training set to fit in
|
||||
@@ -1126,7 +1201,7 @@ instances arrive).
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec24">Randomized PCA </h2>
|
||||
<h2 id="___sec26">Randomized PCA </h2>
|
||||
|
||||
<p>
|
||||
Scikit-Learn offers yet another option to perform PCA, called Randomized PCA. This is a stochastic
|
||||
@@ -1141,7 +1216,7 @@ previous algorithms when \( d \) is much smaller than \( n \).
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec25">Kernel PCA </h2>
|
||||
<h2 id="___sec27">Kernel PCA </h2>
|
||||
<div class="alert alert-block alert-block alert-text-normal">
|
||||
<b></b>
|
||||
<p>
|
||||
@@ -1170,7 +1245,7 @@ X_reduced <span style="color: #666666">=</span> rbf_pca<span style="color: #6666
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec26">LLE </h2>
|
||||
<h2 id="___sec28">LLE </h2>
|
||||
|
||||
<p>
|
||||
Locally Linear Embedding (LLE) is another very powerful nonlinear dimensionality reduction
|
||||
@@ -1182,7 +1257,7 @@ these local relationships are best preserved (more details shortly).
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec27">Other techniques </h2>
|
||||
<h2 id="___sec29">Other techniques </h2>
|
||||
|
||||
<p>
|
||||
There are many other dimensionality reduction techniques, several of which are available in Scikit-Learn.
|
||||
@@ -1217,41 +1292,6 @@ display(df)
|
||||
display(df<span style="color: #666666">**2</span>)
|
||||
</pre></div>
|
||||
<p>
|
||||
Thereafter we can select specific columns only and plot final results
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>df<span style="color: #666666">.</span>columns <span style="color: #666666">=</span> [<span style="color: #BA2121">'First'</span>, <span style="color: #BA2121">'Second'</span>, <span style="color: #BA2121">'Third'</span>, <span style="color: #BA2121">'Fourth'</span>, <span style="color: #BA2121">'Fifth'</span>]
|
||||
df<span style="color: #666666">.</span>index <span style="color: #666666">=</span> np<span style="color: #666666">.</span>arange(<span style="color: #666666">10</span>)
|
||||
|
||||
display(df)
|
||||
<span style="color: #008000; font-weight: bold">print</span>(df[<span style="color: #BA2121">'Second'</span>]<span style="color: #666666">.</span>mean() )
|
||||
<span style="color: #008000; font-weight: bold">print</span>(df<span style="color: #666666">.</span>info())
|
||||
<span style="color: #008000; font-weight: bold">print</span>(df<span style="color: #666666">.</span>describe())
|
||||
|
||||
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">pylab</span> <span style="color: #008000; font-weight: bold">import</span> plt, mpl
|
||||
plt<span style="color: #666666">.</span>style<span style="color: #666666">.</span>use(<span style="color: #BA2121">'seaborn'</span>)
|
||||
mpl<span style="color: #666666">.</span>rcParams[<span style="color: #BA2121">'font.family'</span>] <span style="color: #666666">=</span> <span style="color: #BA2121">'serif'</span>
|
||||
|
||||
df<span style="color: #666666">.</span>cumsum()<span style="color: #666666">.</span>plot(lw<span style="color: #666666">=2.0</span>, figsize<span style="color: #666666">=</span>(<span style="color: #666666">10</span>,<span style="color: #666666">6</span>))
|
||||
plt<span style="color: #666666">.</span>show()
|
||||
|
||||
|
||||
df<span style="color: #666666">.</span>plot<span style="color: #666666">.</span>bar(figsize<span style="color: #666666">=</span>(<span style="color: #666666">10</span>,<span style="color: #666666">6</span>), rot<span style="color: #666666">=15</span>)
|
||||
plt<span style="color: #666666">.</span>show()
|
||||
</pre></div>
|
||||
<p>
|
||||
We can produce a \( 4\times 4 \) matrix
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>b <span style="color: #666666">=</span> np<span style="color: #666666">.</span>arange(<span style="color: #666666">16</span>)<span style="color: #666666">.</span>reshape((<span style="color: #666666">4</span>,<span style="color: #666666">4</span>))
|
||||
<span style="color: #008000; font-weight: bold">print</span>(b)
|
||||
df1 <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(b)
|
||||
<span style="color: #008000; font-weight: bold">print</span>(df1)
|
||||
</pre></div>
|
||||
<p>
|
||||
and many other operations.
|
||||
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"<!-- Author: --> \n",
|
||||
"**Morten Hjorth-Jensen**, Department of Physics, University of Oslo and Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University\n",
|
||||
"\n",
|
||||
"Date: **Oct 22, 2019**\n",
|
||||
"Date: **Oct 24, 2019**\n",
|
||||
"\n",
|
||||
"Copyright 1999-2019, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license\n",
|
||||
"\n",
|
||||
@@ -1073,15 +1073,15 @@
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"with $\\overline{\\boldsymbol{x}_i} = \\boldsymbol{W}\\boldsymbol{z}_i$, where $\\boldsymbol{z}_i$ is a row vector with dimension ${\\mathbb{R}}^{n}$ of the matrix\n",
|
||||
"$\\boldsymbol{Z}\\in {\\mathbb{R}}^{p\\times n}$. \n",
|
||||
"$\\boldsymbol{Z}\\in {\\mathbb{R}}^{p\\times n}$. When doing PCA we want to reduce this dimensionality. \n",
|
||||
"\n",
|
||||
"The PCA theorem states that minimizing the above reconstruction error corresponds to setting $\\boldsymbol{W}=\\boldsymbol{S}$, the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors $l$ $\\boldsymbol{z}_i$, with $l << p$, defined by the orthogonal projection of the data onto the columns spanned by they eigenvectors of the covariance(correlations matrix).\n",
|
||||
"The PCA theorem states that minimizing the above reconstruction error corresponds to setting $\\boldsymbol{W}=\\boldsymbol{S}$, the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors $l$ $\\boldsymbol{z}_i$, with $l << p$, defined by the orthogonal projection of the data onto the columns spanned by the eigenvectors of the covariance(correlations matrix).\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## Proof of the PCA Theorem\n",
|
||||
"\n",
|
||||
"To show the PCA theorem let us start with the assumption that there is a vector $\\boldsymbol{w}_0$ which corresponds to a solution which minimized the reconstruction error $J$. This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of $\\boldsymbol{w}_0$ and $\\boldsymbol{z}_0$ as"
|
||||
"To show the PCA theorem let us start with the assumption that there is one vector $\\boldsymbol{w}_0$ which corresponds to a solution which minimized the reconstruction error $J$. This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of $\\boldsymbol{w}_0$ and $\\boldsymbol{z}_0$ as"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1131,7 +1131,170 @@
|
||||
"source": [
|
||||
"where the vectors on the rhs are known. \n",
|
||||
"\n",
|
||||
"## Getting started with PCA"
|
||||
"\n",
|
||||
"## PCA Proof continued\n",
|
||||
"\n",
|
||||
"We have now found the unknown parameters $z_{i0}$. These correspond to the project coordinates and we can write"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$$\n",
|
||||
"J(\\boldsymbol{w}_0)= \\frac{1}{p}\\sum_i (\\boldsymbol{x}_i^T\\boldsymbol{x}_i - z_{i0}^2)=\\mathrm{const}-\\frac{1}{p}\\sum_i z_{i0}^2.\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"We can show that the variance of the project coordinates defined by $\\boldsymbol{w}_0^T\\boldsymbol{x}_i$ are given by"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$$\n",
|
||||
"\\mathrm{var}[\\boldsymbol{w}_0^T\\boldsymbol{x}_i] = \\frac{1}{p}\\sum_i z_{i0}^2,\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"since the expectation value of"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$$\n",
|
||||
"\\mathbb{E}[\\boldsymbol{w}_0^T\\boldsymbol{x}_i] = \\mathbb{E}[z_{i0}]= \\boldsymbol{w}_0^T\\mathbb{E}[\\boldsymbol{x}_i]=0,\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"where we have used the fact that our data are centered.\n",
|
||||
"\n",
|
||||
"Recalling our definition of the covariance as"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$$\n",
|
||||
"\\boldsymbol{C}[\\boldsymbol{x}] = \\frac{1}{n}\\boldsymbol{X}\\boldsymbol{X}^T= \\mathbb{E}[\\boldsymbol{X}\\boldsymbol{X}^T],\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"we have thus that"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$$\n",
|
||||
"\\mathrm{var}[\\boldsymbol{w}_0^T\\boldsymbol{x}_i] = \\frac{1}{p}\\sum_i z_{i0}^2=\\boldsymbol{w}_0^T\\boldsymbol{C}[\\boldsymbol{x}]\\boldsymbol{w}_0.\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"We are almost there, we have obtained a relation between minimizing the reconstruction error and the variance and the covariance matrix. Minimizing the error is equivalent to maximizing the variance of the projected data. \n",
|
||||
"\n",
|
||||
"## The final step\n",
|
||||
"\n",
|
||||
"We could trivially maximize the variance of the projection (and\n",
|
||||
"thereby minimize the error in the reconstruction function) by letting\n",
|
||||
"the norm-2 of $\\boldsymbol{w}_0$ go to infinity. However, this norm since we\n",
|
||||
"want the matrix $\\boldsymbol{W}$ to be an orthogonal matrix, is constrained by\n",
|
||||
"$$\\vert\\vert \\boldsymbol{w}_0 \\vert\\vert_2^2=1$. Imposing this condition via a\n",
|
||||
"Lagrange multiplier we can then in turn maximize"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$$\n",
|
||||
"J(\\boldsymbol{w}_0)= \\boldsymbol{w}_0^T\\boldsymbol{C}[\\boldsymbol{x}]\\boldsymbol{w}_0+\\lambda_0(1-\\boldsymbol{w}_0^T\\boldsymbol{w}_0).\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Taking the derivative with respect to $\\boldsymbol{w}_0$ we obtain"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$$\n",
|
||||
"\\frac{\\partial J(\\boldsymbol{w}_0)}{\\partial \\boldsymbol{w}_0}= 2\\boldsymbol{C}[\\boldsymbol{x}]\\boldsymbol{w}_0-2\\lambda_0\\boldsymbol{w}_0=0,\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"meaning that"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$$\n",
|
||||
"\\boldsymbol{C}[\\boldsymbol{x}]\\boldsymbol{w}_0=\\lambda_0\\boldsymbol{w}_0.\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**The direction that maximizes the variance (or minimizes the construction error) is an eigenvector of the covariance matrix**! If we left multiply with $\\boldsymbol{w}_0^T$ we have the variance of the projected data is"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$$\n",
|
||||
"\\boldsymbol{w}_^T\\boldsymbol{C}[\\boldsymbol{x}]\\boldsymbol{w}_0=\\lambda_0.\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"If we want to maximize the variance (minimize the construction error) we simply pick the eigenvector of the covariance matrix with the largest eigenvalue. This establishes the link between the minimization of the reconstruction function $J$ in terms of an orthogonal matrix and the maximization of the variance and thereby the covariance of our observations encoded in the design/feature matrix $\\boldsymbol{X}$. The proof for the other eigenvectors $\\boldsymbol{w}_1,\\boldsymbol{w}_2,\\dots$ cna be established by applying the above arguments and using the fact that basis of eigenvectors is orthogonal, see [Murphy chapter 12.2](https://mitpress.mit.edu/books/machine-learning-1). The discussion in chapter 12.2 of Murphy's text has also a nice link with the Singular Value Decomposition theorem. For categorical data, see chapter 12.4 and discussion therein. \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## PCA and Scikit-Learn Functionality"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1159,7 +1322,7 @@
|
||||
"First it identifies the hyperplane that lies closest to the data, and then it projects the data onto it.\n",
|
||||
"\n",
|
||||
"The following Python code uses NumPy’s **svd()** function to obtain all the principal components of the\n",
|
||||
"training set, then extracts the first two principal components"
|
||||
"training set, then extracts the first two principal components. First we center the data"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1402,69 +1565,6 @@
|
||||
"print(df.std())\n",
|
||||
"display(df**2)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Thereafter we can select specific columns only and plot final results"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df.columns = ['First', 'Second', 'Third', 'Fourth', 'Fifth']\n",
|
||||
"df.index = np.arange(10)\n",
|
||||
"\n",
|
||||
"display(df)\n",
|
||||
"print(df['Second'].mean() )\n",
|
||||
"print(df.info())\n",
|
||||
"print(df.describe())\n",
|
||||
"\n",
|
||||
"from pylab import plt, mpl\n",
|
||||
"plt.style.use('seaborn')\n",
|
||||
"mpl.rcParams['font.family'] = 'serif'\n",
|
||||
"\n",
|
||||
"df.cumsum().plot(lw=2.0, figsize=(10,6))\n",
|
||||
"plt.show()\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"df.plot.bar(figsize=(10,6), rot=15)\n",
|
||||
"plt.show()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"We can produce a $4\\times 4$ matrix"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"b = np.arange(16).reshape((4,4))\n",
|
||||
"print(b)\n",
|
||||
"df1 = pd.DataFrame(b)\n",
|
||||
"print(df1)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"and many other operations."
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -754,16 +754,16 @@ J(\bm{W},\bm{Z}) = \frac{1}{p}\sum_i (\bm{x}_i - \overline{\bm{x}_i})^2,
|
||||
\]
|
||||
!et
|
||||
with $\overline{\bm{x}_i} = \bm{W}\bm{z}_i$, where $\bm{z}_i$ is a row vector with dimension ${\mathbb{R}}^{n}$ of the matrix
|
||||
$\bm{Z}\in {\mathbb{R}}^{p\times n}$.
|
||||
$\bm{Z}\in {\mathbb{R}}^{p\times n}$. When doing PCA we want to reduce this dimensionality.
|
||||
|
||||
The PCA theorem states that minimizing the above reconstruction error corresponds to setting $\bm{W}=\bm{S}$, the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors $l$ $\bm{z}_i$, with $l << p$, defined by the orthogonal projection of the data onto the columns spanned by they eigenvectors of the covariance(correlations matrix).
|
||||
The PCA theorem states that minimizing the above reconstruction error corresponds to setting $\bm{W}=\bm{S}$, the orthogonal matrix which diagonalizes the empirical covariance(correlation) matrix. The optimal low-dimensional encoding of the data is then given by a set of vectors $l$ $\bm{z}_i$, with $l << p$, defined by the orthogonal projection of the data onto the columns spanned by the eigenvectors of the covariance(correlations matrix).
|
||||
|
||||
|
||||
|
||||
!split
|
||||
===== Proof of the PCA Theorem =====
|
||||
|
||||
To show the PCA theorem let us start with the assumption that there is a vector $\bm{w}_0$ which corresponds to a solution which minimized the reconstruction error $J$. This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of $\bm{w}_0$ and $\bm{z}_0$ as
|
||||
To show the PCA theorem let us start with the assumption that there is one vector $\bm{w}_0$ which corresponds to a solution which minimized the reconstruction error $J$. This is an orthogonal vector. It means that we now approximate the reconstruction error in terms of $\bm{w}_0$ and $\bm{z}_0$ as
|
||||
!bt
|
||||
\[
|
||||
J(\bm{w}_0,\bm{z}_0)= \frac{1}{p}\sum_i (\bm{x}_i - z_{i0}\bm{w}_0)^2=\frac{1}{p}\sum_i (\bm{x}_^T\bm{x}_i - 2z_{i0}\bm{w}_0^T\bm{x}_i+z_{i0}^2\bm{w}_0^T\bm{w}_0),
|
||||
@@ -783,8 +783,87 @@ z_{i0}=\bm{w}_0^T\bm{x}_i,
|
||||
!et
|
||||
where the vectors on the rhs are known.
|
||||
|
||||
|
||||
!split
|
||||
===== Getting started with PCA =====
|
||||
===== PCA Proof continued =====
|
||||
|
||||
We have now found the unknown parameters $z_{i0}$. These correspond to the project coordinates and we can write
|
||||
!bt
|
||||
\[
|
||||
J(\bm{w}_0)= \frac{1}{p}\sum_i (\bm{x}_i^T\bm{x}_i - z_{i0}^2)=\mathrm{const}-\frac{1}{p}\sum_i z_{i0}^2.
|
||||
\]
|
||||
!et
|
||||
|
||||
We can show that the variance of the project coordinates defined by $\bm{w}_0^T\bm{x}_i$ are given by
|
||||
!bt
|
||||
\[
|
||||
\mathrm{var}[\bm{w}_0^T\bm{x}_i] = \frac{1}{p}\sum_i z_{i0}^2,
|
||||
\]
|
||||
!et
|
||||
since the expectation value of
|
||||
!bt
|
||||
\[
|
||||
\mathbb{E}[\bm{w}_0^T\bm{x}_i] = \mathbb{E}[z_{i0}]= \bm{w}_0^T\mathbb{E}[\bm{x}_i]=0,
|
||||
\]
|
||||
!et
|
||||
where we have used the fact that our data are centered.
|
||||
|
||||
Recalling our definition of the covariance as
|
||||
!bt
|
||||
\[
|
||||
\bm{C}[\bm{x}] = \frac{1}{n}\bm{X}\bm{X}^T= \mathbb{E}[\bm{X}\bm{X}^T],
|
||||
\]
|
||||
!et
|
||||
we have thus that
|
||||
!bt
|
||||
\[
|
||||
\mathrm{var}[\bm{w}_0^T\bm{x}_i] = \frac{1}{p}\sum_i z_{i0}^2=\bm{w}_0^T\bm{C}[\bm{x}]\bm{w}_0.
|
||||
\]
|
||||
!et
|
||||
|
||||
We are almost there, we have obtained a relation between minimizing the reconstruction error and the variance and the covariance matrix. Minimizing the error is equivalent to maximizing the variance of the projected data.
|
||||
|
||||
!split
|
||||
===== The final step =====
|
||||
|
||||
We could trivially maximize the variance of the projection (and
|
||||
thereby minimize the error in the reconstruction function) by letting
|
||||
the norm-2 of $\bm{w}_0$ go to infinity. However, this norm since we
|
||||
want the matrix $\bm{W}$ to be an orthogonal matrix, is constrained by
|
||||
$$\vert\vert \bm{w}_0 \vert\vert_2^2=1$. Imposing this condition via a
|
||||
Lagrange multiplier we can then in turn maximize
|
||||
|
||||
!bt
|
||||
\[
|
||||
J(\bm{w}_0)= \bm{w}_0^T\bm{C}[\bm{x}]\bm{w}_0+\lambda_0(1-\bm{w}_0^T\bm{w}_0).
|
||||
\]
|
||||
!et
|
||||
Taking the derivative with respect to $\bm{w}_0$ we obtain
|
||||
|
||||
!bt
|
||||
\[
|
||||
\frac{\partial J(\bm{w}_0)}{\partial \bm{w}_0}= 2\bm{C}[\bm{x}]\bm{w}_0-2\lambda_0\bm{w}_0=0,
|
||||
\]
|
||||
!et
|
||||
meaning that
|
||||
!bt
|
||||
\[
|
||||
\bm{C}[\bm{x}]\bm{w}_0=\lambda_0\bm{w}_0.
|
||||
\]
|
||||
!et
|
||||
_The direction that maximizes the variance (or minimizes the construction error) is an eigenvector of the covariance matrix_! If we left multiply with $\bm{w}_0^T$ we have the variance of the projected data is
|
||||
!bt
|
||||
\[
|
||||
\bm{w}_^T\bm{C}[\bm{x}]\bm{w}_0=\lambda_0.
|
||||
\]
|
||||
!et
|
||||
If we want to maximize the variance (minimize the construction error) we simply pick the eigenvector of the covariance matrix with the largest eigenvalue. This establishes the link between the minimization of the reconstruction function $J$ in terms of an orthogonal matrix and the maximization of the variance and thereby the covariance of our observations encoded in the design/feature matrix $\bm{X}$. The proof for the other eigenvectors $\bm{w}_1,\bm{w}_2,\dots$ cna be established by applying the above arguments and using the fact that basis of eigenvectors is orthogonal, see "Murphy chapter 12.2":"https://mitpress.mit.edu/books/machine-learning-1". The discussion in chapter 12.2 of Murphy's text has also a nice link with the Singular Value Decomposition theorem. For categorical data, see chapter 12.4 and discussion therein.
|
||||
|
||||
|
||||
|
||||
|
||||
!split
|
||||
===== PCA and Scikit-Learn Functionality =====
|
||||
|
||||
|
||||
!bc pycod
|
||||
@@ -805,7 +884,7 @@ Principal Component Analysis (PCA) is by far the most popular dimensionality red
|
||||
First it identifies the hyperplane that lies closest to the data, and then it projects the data onto it.
|
||||
|
||||
The following Python code uses NumPy’s _svd()_ function to obtain all the principal components of the
|
||||
training set, then extracts the first two principal components
|
||||
training set, then extracts the first two principal components. First we center the data
|
||||
!bc pycod
|
||||
X_centered = X - X.mean(axis=0)
|
||||
U, s, V = np.linalg.svd(X_centered)
|
||||
@@ -960,33 +1039,3 @@ print(df.std())
|
||||
display(df**2)
|
||||
!ec
|
||||
|
||||
Thereafter we can select specific columns only and plot final results
|
||||
!bc pycod
|
||||
df.columns = ['First', 'Second', 'Third', 'Fourth', 'Fifth']
|
||||
df.index = np.arange(10)
|
||||
|
||||
display(df)
|
||||
print(df['Second'].mean() )
|
||||
print(df.info())
|
||||
print(df.describe())
|
||||
|
||||
from pylab import plt, mpl
|
||||
plt.style.use('seaborn')
|
||||
mpl.rcParams['font.family'] = 'serif'
|
||||
|
||||
df.cumsum().plot(lw=2.0, figsize=(10,6))
|
||||
plt.show()
|
||||
|
||||
|
||||
df.plot.bar(figsize=(10,6), rot=15)
|
||||
plt.show()
|
||||
!ec
|
||||
We can produce a $4\times 4$ matrix
|
||||
!bc pycod
|
||||
b = np.arange(16).reshape((4,4))
|
||||
print(b)
|
||||
df1 = pd.DataFrame(b)
|
||||
print(df1)
|
||||
!ec
|
||||
and many other operations.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user