small change

This commit is contained in:
mhjensen
2019-10-24 13:40:20 +02:00
parent 5068c1690e
commit aecd18f3f7
39 changed files with 855 additions and 888 deletions
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -227,7 +225,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs001.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -227,7 +225,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs002.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -226,7 +224,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs003.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -229,7 +227,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs004.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -304,7 +302,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs005.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -254,7 +252,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs006.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -233,7 +231,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs007.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -288,7 +286,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs008.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -218,7 +216,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs009.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -267,7 +265,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs010.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -262,7 +260,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs011.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -250,7 +248,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs012.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -252,7 +250,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs013.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -234,7 +232,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs014.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -270,7 +268,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs015.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -250,7 +248,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs016.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -258,7 +256,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs017.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -241,7 +239,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs018.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -228,7 +226,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs019.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -230,7 +228,7 @@ where the vectors on the rhs are known.
<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-bs029.html">30</a></li>
<li><a href="._DimRed-bs020.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+16 -20
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -244,8 +242,6 @@ We are almost there, we have obtained a relation between minimizing the reconstr
<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">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+16 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -256,7 +254,6 @@ chapter 12.4 and discussion therein.
<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">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+63 -25
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -184,17 +182,58 @@ MathJax.Hub.Config({
<a name="part0022"></a>
<!-- !split -->
<h2 id="___sec21" class="anchor">PCA and Scikit-Learn Functionality </h2>
<h2 id="___sec21" 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>
The following Python code uses NumPy&#8217;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 using either <b>pandas</b> or our own code
<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: #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)
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">pandas</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">pd</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">IPython.display</span> <span style="color: #008000; font-weight: bold">import</span> display
np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>seed(<span style="color: #666666">100</span>)
<span style="color: #408080; font-style: italic"># setting up a 10 x 5 vanilla matrix </span>
rows <span style="color: #666666">=</span> <span style="color: #666666">10</span>
cols <span style="color: #666666">=</span> <span style="color: #666666">5</span>
X <span style="color: #666666">=</span> np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>randn(rows,cols)
df <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(X)
<span style="color: #408080; font-style: italic"># Pandas does the centering for us</span>
df <span style="color: #666666">=</span> df <span style="color: #666666">-</span>df<span style="color: #666666">.</span>mean()
display(df)
X_pca <span style="color: #666666">=</span> pca<span style="color: #666666">.</span>transform(X_train_scaled)
<span style="color: #408080; font-style: italic"># we center it ourselves</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>)
<span style="color: #408080; font-style: italic"># Then check the difference between pandas and our own set up</span>
<span style="color: #008000; font-weight: bold">print</span>(X_centered<span style="color: #666666">-</span>df)
<span style="color: #408080; font-style: italic">#Now we do an SVD</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>]
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)
<span style="color: #008000; font-weight: bold">print</span>(X2D)
</pre></div>
<p>
PCA assumes that the dataset is centered around the origin. Scikit-Learn&#8217;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&#8217;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>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>
@@ -219,7 +258,6 @@ X_pca <span style="color: #666666">=</span> pca<span style="color: #666666">.</s
<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">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+36 -42
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -182,41 +180,38 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0023"></a>
<!-- !split -->
<!-- !split -->
<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.
<h2 id="___sec22" class="anchor">PCA and scikit-learn </h2>
<p>
The following Python code uses NumPy&#8217;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
Scikit-Learn&#8217;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>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>]
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #408080; font-style: italic">#thereafter we do a PCA with Scikit-learn</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)
<span style="color: #008000; font-weight: bold">print</span>(X2D)
</pre></div>
<p>
PCA assumes that the dataset is centered around the origin. Scikit-Learn&#8217;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&#8217;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.
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>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)
<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&#8217;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 -->
@@ -239,7 +234,6 @@ X2D <span style="color: #666666">=</span> X_centered<span style="color: #666666"
<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">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+33 -37
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -182,36 +180,35 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0024"></a>
<!-- !split -->
<!-- !split -->
<h2 id="___sec23" class="anchor">PCA and scikit-learn </h2>
<h2 id="___sec23" class="anchor">More on the PCA </h2>
<p>
Scikit-Learn&#8217;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):
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 &#8212; 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&#8217;s variance:
<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)
<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">&gt;=</span> <span style="color: #666666">0.95</span>) <span style="color: #666666">+</span> <span style="color: #666666">1</span>
</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
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>components_<span style="color: #666666">.</span>T[:, <span style="color: #666666">0</span>])<span style="color: #666666">.</span>
<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>
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&#8217;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 -->
@@ -233,7 +230,6 @@ More material to come here.
<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">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+22 -43
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -184,33 +182,15 @@ MathJax.Hub.Config({
<a name="part0025"></a>
<!-- !split -->
<h2 id="___sec24" class="anchor">More on the PCA </h2>
<h2 id="___sec24" class="anchor">Incremental PCA </h2>
<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 &#8212; 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&#8217;s variance:
<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).
<!-- 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">&gt;=</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 -->
@@ -231,7 +211,6 @@ X_reduced <span style="color: #666666">=</span> pca<span style="color: #666666">
<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">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+26 -25
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -184,14 +182,18 @@ MathJax.Hub.Config({
<a name="part0026"></a>
<!-- !split -->
<h2 id="___sec25" class="anchor">Incremental PCA </h2>
<h2 id="___sec25" class="anchor">Randomized PCA </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 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>
@@ -212,7 +214,6 @@ instances arrive).
<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">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+35 -24
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -184,14 +182,28 @@ MathJax.Hub.Config({
<a name="part0027"></a>
<!-- !split -->
<h2 id="___sec26" class="anchor">Randomized PCA </h2>
<h2 id="___sec26" 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 -->
<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 \).
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&#8217;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">&quot;rbf&quot;</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>
@@ -215,7 +227,6 @@ previous algorithms when \( d \) is much smaller than \( n \).
<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">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+22 -43
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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="#___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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -184,32 +182,14 @@ MathJax.Hub.Config({
<a name="part0028"></a>
<!-- !split -->
<h2 id="___sec27" 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="___sec27" class="anchor">LLE </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&#8217;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">&quot;rbf&quot;</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>
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).
<p>
<p>
@@ -228,7 +208,6 @@ X_reduced <span style="color: #666666">=</span> rbf_pca<span style="color: #6666
<li><a href="._DimRed-bs027.html">28</a></li>
<li class="active"><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-bs029.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+28 -26
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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="#___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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -184,16 +182,22 @@ MathJax.Hub.Config({
<a name="part0029"></a>
<!-- !split -->
<h2 id="___sec28" class="anchor">LLE </h2>
<h2 id="___sec28" class="anchor">Other techniques </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).
There are many other dimensionality reduction techniques, several of which are available in Scikit-Learn.
<p>
Here are some of the most popular:
<ul>
<li> <b>Multidimensional Scaling (MDS)</b> reduces dimensionality while trying to preserve the distances between the instances.</li>
<li> <b>Isomap</b> creates a graph by connecting each instance to its nearest neighbors, then reduces dimensionality while trying to preserve the geodesic distances between the instances.</li>
<li> <b>t-Distributed Stochastic Neighbor Embedding</b> (t-SNE) reduces dimensionality while trying to keep similar instances close and dissimilar instances apart. It is mostly used for visualization, in particular to visualize clusters of instances in high-dimensional space (e.g., to visualize the MNIST images in 2D).</li>
<li> Linear Discriminant Analysis (LDA) is actually a classification algorithm, but during training it learns the most discriminative axes between the classes, and these axes can then be used to define a hyperplane onto which to project the data. The benefit is that the projection will keep classes as far apart as possible, so LDA is a good technique to reduce dimensionality before running another classification algorithm such as a Support Vector Machine (SVM) classifier discussed in the SVM lectures.</li>
</ul>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -209,8 +213,6 @@ these local relationships are best preserved (more details shortly).
<li><a href="._DimRed-bs027.html">28</a></li>
<li><a href="._DimRed-bs028.html">29</a></li>
<li class="active"><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs030.html">31</a></li>
<li><a href="._DimRed-bs030.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+17 -19
View File
@@ -93,15 +93,14 @@ Automatically generated HTML file from DocOnce source
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -160,15 +159,14 @@ MathJax.Hub.Config({
<!-- 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%;">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>
<!-- navigation toc: --> <li><a href="._DimRed-bs022.html#___sec21" style="font-size: 80%;">Principal Component Analysis</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs023.html#___sec22" style="font-size: 80%;">PCA and scikit-learn</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs024.html#___sec23" style="font-size: 80%;">More on the PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs025.html#___sec24" style="font-size: 80%;">Incremental PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs026.html#___sec25" style="font-size: 80%;">Randomized PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs027.html#___sec26" style="font-size: 80%;">Kernel PCA</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs028.html#___sec27" style="font-size: 80%;">LLE</a></li>
<!-- navigation toc: --> <li><a href="._DimRed-bs029.html#___sec28" style="font-size: 80%;">Other techniques</a></li>
</ul>
</li>
@@ -227,7 +225,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-bs030.html">31</a></li>
<li><a href="._DimRed-bs029.html">30</a></li>
<li><a href="._DimRed-bs001.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+34 -28
View File
@@ -1148,23 +1148,7 @@ chapter 12.4 and discussion therein.
<section>
<h2 id="___sec21">PCA and Scikit-Learn Functionality </h2>
<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><span style="color: #228B22"># Now add PCA</span>
<span style="color: #8B008B; font-weight: bold">from</span> <span style="color: #008b45; text-decoration: underline">sklearn.decomposition</span> <span style="color: #8B008B; font-weight: bold">import</span> PCA
pca = PCA(n_components = <span style="color: #B452CD">2</span>)
pca.fit(X_train_scaled)
X_pca = pca.transform(X_train_scaled)
</pre></div>
</section>
<section>
<h2 id="___sec22">Principal Component Analysis </h2>
<h2 id="___sec21">Principal Component Analysis </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -1173,14 +1157,34 @@ First it identifies the hyperplane that lies closest to the data, and then it pr
<p>
The following Python code uses NumPy&#8217;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
training set, then extracts the first two principal components. First we center the data using either <b>pandas</b> or our own code
<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>X_centered = X - X.mean(axis=<span style="color: #B452CD">0</span>)
<div class="highlight" style="background: #eeeedd"><pre style="font-size: 80%; line-height: 125%"><span></span><span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">numpy</span> <span style="color: #8B008B; font-weight: bold">as</span> <span style="color: #008b45; text-decoration: underline">np</span>
<span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">pandas</span> <span style="color: #8B008B; font-weight: bold">as</span> <span style="color: #008b45; text-decoration: underline">pd</span>
<span style="color: #8B008B; font-weight: bold">from</span> <span style="color: #008b45; text-decoration: underline">IPython.display</span> <span style="color: #8B008B; font-weight: bold">import</span> display
np.random.seed(<span style="color: #B452CD">100</span>)
<span style="color: #228B22"># setting up a 10 x 5 vanilla matrix </span>
rows = <span style="color: #B452CD">10</span>
cols = <span style="color: #B452CD">5</span>
X = np.random.randn(rows,cols)
df = pd.DataFrame(X)
<span style="color: #228B22"># Pandas does the centering for us</span>
df = df -df.mean()
display(df)
<span style="color: #228B22"># we center it ourselves</span>
X_centered = X - X.mean(axis=<span style="color: #B452CD">0</span>)
<span style="color: #228B22"># Then check the difference between pandas and our own set up</span>
<span style="color: #8B008B; font-weight: bold">print</span>(X_centered-df)
<span style="color: #228B22">#Now we do an SVD</span>
U, s, V = np.linalg.svd(X_centered)
c1 = V.T[:, <span style="color: #B452CD">0</span>]
c2 = V.T[:, <span style="color: #B452CD">1</span>]
W2 = V.T[:, :<span style="color: #B452CD">2</span>]
X2D = X_centered.dot(W2)
<span style="color: #8B008B; font-weight: bold">print</span>(X2D)
</pre></div>
<p>
PCA assumes that the dataset is centered around the origin. Scikit-Learn&#8217;s PCA classes take care of centering
@@ -1201,7 +1205,7 @@ X2D = X_centered.dot(W2)
<section>
<h2 id="___sec23">PCA and scikit-learn </h2>
<h2 id="___sec22">PCA and scikit-learn </h2>
<p>
Scikit-Learn&#8217;s PCA class implements PCA using SVD decomposition just like we did before. The
@@ -1210,9 +1214,11 @@ that it automatically takes care of centering the data):
<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><span style="color: #8B008B; font-weight: bold">from</span> <span style="color: #008b45; text-decoration: underline">sklearn.decomposition</span> <span style="color: #8B008B; font-weight: bold">import</span> PCA
<div class="highlight" style="background: #eeeedd"><pre style="font-size: 80%; line-height: 125%"><span></span><span style="color: #228B22">#thereafter we do a PCA with Scikit-learn</span>
<span style="color: #8B008B; font-weight: bold">from</span> <span style="color: #008b45; text-decoration: underline">sklearn.decomposition</span> <span style="color: #8B008B; font-weight: bold">import</span> PCA
pca = PCA(n_components = <span style="color: #B452CD">2</span>)
X2D = pca.fit_transform(X)
<span style="color: #8B008B; font-weight: bold">print</span>(X2D)
</pre></div>
<p>
After fitting the PCA transformer to the dataset, you can access the principal components using the
@@ -1221,7 +1227,7 @@ principal component is equal to
<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>pca.components_.T[:, <span style="color: #B452CD">0</span>]).
<div class="highlight" style="background: #eeeedd"><pre style="font-size: 80%; line-height: 125%"><span></span>pca.components_.T[:, <span style="color: #B452CD">0</span>].
</pre></div>
<p>
Another very useful piece of information is the explained variance ratio of each principal component,
@@ -1232,7 +1238,7 @@ More material to come here.
<section>
<h2 id="___sec24">More on the PCA </h2>
<h2 id="___sec23">More on the PCA </h2>
<p>
Instead of arbitrarily choosing the number of dimensions to reduce down to, it is generally preferable to
@@ -1263,7 +1269,7 @@ X_reduced = pca.fit_transform(X)
<section>
<h2 id="___sec25">Incremental PCA </h2>
<h2 id="___sec24">Incremental PCA </h2>
<p>
One problem with the preceding implementation of PCA is that it requires the whole training set to fit in
@@ -1275,7 +1281,7 @@ instances arrive).
<section>
<h2 id="___sec26">Randomized PCA </h2>
<h2 id="___sec25">Randomized PCA </h2>
<p>
Scikit-Learn offers yet another option to perform PCA, called Randomized PCA. This is a stochastic
@@ -1289,7 +1295,7 @@ previous algorithms when \( d \) is much smaller than \( n \).
<section>
<h2 id="___sec27">Kernel PCA </h2>
<h2 id="___sec26">Kernel PCA </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -1315,7 +1321,7 @@ X_reduced = rbf_pca.fit_transform(X)
<section>
<h2 id="___sec28">LLE </h2>
<h2 id="___sec27">LLE </h2>
<p>
Locally Linear Embedding (LLE) is another very powerful nonlinear dimensionality reduction
@@ -1327,7 +1333,7 @@ these local relationships are best preserved (more details shortly).
<section>
<h2 id="___sec29">Other techniques </h2>
<h2 id="___sec28">Other techniques </h2>
<p>
There are many other dimensionality reduction techniques, several of which are available in Scikit-Learn.
+42 -36
View File
@@ -113,15 +113,14 @@ div { text-align: justify; text-justify: inter-word; }
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -1088,22 +1087,7 @@ 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>
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
<div class="highlight" style="background: #eeeedd"><pre style="line-height: 125%"><span></span><span style="color: #228B22"># Now add PCA</span>
<span style="color: #8B008B; font-weight: bold">from</span> <span style="color: #008b45; text-decoration: underline">sklearn.decomposition</span> <span style="color: #8B008B; font-weight: bold">import</span> PCA
pca = PCA(n_components = <span style="color: #B452CD">2</span>)
pca.fit(X_train_scaled)
X_pca = pca.transform(X_train_scaled)
</pre></div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec22">Principal Component Analysis </h2>
<h2 id="___sec21">Principal Component Analysis </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -1112,14 +1096,34 @@ First it identifies the hyperplane that lies closest to the data, and then it pr
<p>
The following Python code uses NumPy&#8217;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
training set, then extracts the first two principal components. First we center the data using either <b>pandas</b> or our own code
<p>
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
<div class="highlight" style="background: #eee8d5"><pre style="line-height: 125%"><span></span>X_centered = X - X.mean(axis=<span style="color: #B452CD">0</span>)
<div class="highlight" style="background: #eee8d5"><pre style="line-height: 125%"><span></span><span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">numpy</span> <span style="color: #8B008B; font-weight: bold">as</span> <span style="color: #008b45; text-decoration: underline">np</span>
<span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">pandas</span> <span style="color: #8B008B; font-weight: bold">as</span> <span style="color: #008b45; text-decoration: underline">pd</span>
<span style="color: #8B008B; font-weight: bold">from</span> <span style="color: #008b45; text-decoration: underline">IPython.display</span> <span style="color: #8B008B; font-weight: bold">import</span> display
np.random.seed(<span style="color: #B452CD">100</span>)
<span style="color: #228B22"># setting up a 10 x 5 vanilla matrix </span>
rows = <span style="color: #B452CD">10</span>
cols = <span style="color: #B452CD">5</span>
X = np.random.randn(rows,cols)
df = pd.DataFrame(X)
<span style="color: #228B22"># Pandas does the centering for us</span>
df = df -df.mean()
display(df)
<span style="color: #228B22"># we center it ourselves</span>
X_centered = X - X.mean(axis=<span style="color: #B452CD">0</span>)
<span style="color: #228B22"># Then check the difference between pandas and our own set up</span>
<span style="color: #8B008B; font-weight: bold">print</span>(X_centered-df)
<span style="color: #228B22">#Now we do an SVD</span>
U, s, V = np.linalg.svd(X_centered)
c1 = V.T[:, <span style="color: #B452CD">0</span>]
c2 = V.T[:, <span style="color: #B452CD">1</span>]
W2 = V.T[:, :<span style="color: #B452CD">2</span>]
X2D = X_centered.dot(W2)
<span style="color: #8B008B; font-weight: bold">print</span>(X2D)
</pre></div>
<p>
PCA assumes that the dataset is centered around the origin. Scikit-Learn&#8217;s PCA classes take care of centering
@@ -1139,7 +1143,7 @@ X2D = X_centered.dot(W2)
<p>
<!-- !split -->
<h2 id="___sec23">PCA and scikit-learn </h2>
<h2 id="___sec22">PCA and scikit-learn </h2>
<p>
Scikit-Learn&#8217;s PCA class implements PCA using SVD decomposition just like we did before. The
@@ -1148,9 +1152,11 @@ that it automatically takes care of centering the data):
<p>
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
<div class="highlight" style="background: #eee8d5"><pre style="line-height: 125%"><span></span><span style="color: #8B008B; font-weight: bold">from</span> <span style="color: #008b45; text-decoration: underline">sklearn.decomposition</span> <span style="color: #8B008B; font-weight: bold">import</span> PCA
<div class="highlight" style="background: #eee8d5"><pre style="line-height: 125%"><span></span><span style="color: #228B22">#thereafter we do a PCA with Scikit-learn</span>
<span style="color: #8B008B; font-weight: bold">from</span> <span style="color: #008b45; text-decoration: underline">sklearn.decomposition</span> <span style="color: #8B008B; font-weight: bold">import</span> PCA
pca = PCA(n_components = <span style="color: #B452CD">2</span>)
X2D = pca.fit_transform(X)
<span style="color: #8B008B; font-weight: bold">print</span>(X2D)
</pre></div>
<p>
After fitting the PCA transformer to the dataset, you can access the principal components using the
@@ -1159,7 +1165,7 @@ principal component is equal to
<p>
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
<div class="highlight" style="background: #eee8d5"><pre style="line-height: 125%"><span></span>pca.components_.T[:, <span style="color: #B452CD">0</span>]).
<div class="highlight" style="background: #eee8d5"><pre style="line-height: 125%"><span></span>pca.components_.T[:, <span style="color: #B452CD">0</span>].
</pre></div>
<p>
Another very useful piece of information is the explained variance ratio of each principal component,
@@ -1170,7 +1176,7 @@ More material to come here.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec24">More on the PCA </h2>
<h2 id="___sec23">More on the PCA </h2>
<p>
Instead of arbitrarily choosing the number of dimensions to reduce down to, it is generally preferable to
@@ -1200,7 +1206,7 @@ X_reduced = pca.fit_transform(X)
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec25">Incremental PCA </h2>
<h2 id="___sec24">Incremental PCA </h2>
<p>
One problem with the preceding implementation of PCA is that it requires the whole training set to fit in
@@ -1212,7 +1218,7 @@ instances arrive).
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec26">Randomized PCA </h2>
<h2 id="___sec25">Randomized PCA </h2>
<p>
Scikit-Learn offers yet another option to perform PCA, called Randomized PCA. This is a stochastic
@@ -1227,7 +1233,7 @@ previous algorithms when \( d \) is much smaller than \( n \).
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec27">Kernel PCA </h2>
<h2 id="___sec26">Kernel PCA </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -1256,7 +1262,7 @@ X_reduced = rbf_pca.fit_transform(X)
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec28">LLE </h2>
<h2 id="___sec27">LLE </h2>
<p>
Locally Linear Embedding (LLE) is another very powerful nonlinear dimensionality reduction
@@ -1268,7 +1274,7 @@ these local relationships are best preserved (more details shortly).
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec29">Other techniques </h2>
<h2 id="___sec28">Other techniques </h2>
<p>
There are many other dimensionality reduction techniques, several of which are available in Scikit-Learn.
+42 -36
View File
@@ -118,15 +118,14 @@ div { text-align: justify; text-justify: inter-word; }
('Proof of the PCA Theorem', 2, None, '___sec18'),
('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')]}
('Principal Component Analysis', 2, None, '___sec21'),
('PCA and scikit-learn', 2, None, '___sec22'),
('More on the PCA', 2, None, '___sec23'),
('Incremental PCA', 2, None, '___sec24'),
('Randomized PCA', 2, None, '___sec25'),
('Kernel PCA', 2, None, '___sec26'),
('LLE', 2, None, '___sec27'),
('Other techniques', 2, None, '___sec28')]}
end of tocinfo -->
<body>
@@ -1093,22 +1092,7 @@ 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>
<!-- 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)
X_pca <span style="color: #666666">=</span> pca<span style="color: #666666">.</span>transform(X_train_scaled)
</pre></div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec22">Principal Component Analysis </h2>
<h2 id="___sec21">Principal Component Analysis </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -1117,14 +1101,34 @@ First it identifies the hyperplane that lies closest to the data, and then it pr
<p>
The following Python code uses NumPy&#8217;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
training set, then extracts the first two principal components. First we center the data using either <b>pandas</b> or our own code
<p>
<!-- 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>)
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">pandas</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">pd</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">IPython.display</span> <span style="color: #008000; font-weight: bold">import</span> display
np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>seed(<span style="color: #666666">100</span>)
<span style="color: #408080; font-style: italic"># setting up a 10 x 5 vanilla matrix </span>
rows <span style="color: #666666">=</span> <span style="color: #666666">10</span>
cols <span style="color: #666666">=</span> <span style="color: #666666">5</span>
X <span style="color: #666666">=</span> np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>randn(rows,cols)
df <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(X)
<span style="color: #408080; font-style: italic"># Pandas does the centering for us</span>
df <span style="color: #666666">=</span> df <span style="color: #666666">-</span>df<span style="color: #666666">.</span>mean()
display(df)
<span style="color: #408080; font-style: italic"># we center it ourselves</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>)
<span style="color: #408080; font-style: italic"># Then check the difference between pandas and our own set up</span>
<span style="color: #008000; font-weight: bold">print</span>(X_centered<span style="color: #666666">-</span>df)
<span style="color: #408080; font-style: italic">#Now we do an SVD</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>]
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)
<span style="color: #008000; font-weight: bold">print</span>(X2D)
</pre></div>
<p>
PCA assumes that the dataset is centered around the origin. Scikit-Learn&#8217;s PCA classes take care of centering
@@ -1144,7 +1148,7 @@ X2D <span style="color: #666666">=</span> X_centered<span style="color: #666666"
<p>
<!-- !split -->
<h2 id="___sec23">PCA and scikit-learn </h2>
<h2 id="___sec22">PCA and scikit-learn </h2>
<p>
Scikit-Learn&#8217;s PCA class implements PCA using SVD decomposition just like we did before. The
@@ -1153,9 +1157,11 @@ 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">#thereafter we do a PCA with Scikit-learn</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)
<span style="color: #008000; font-weight: bold">print</span>(X2D)
</pre></div>
<p>
After fitting the PCA transformer to the dataset, you can access the principal components using the
@@ -1164,7 +1170,7 @@ 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>
<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,
@@ -1175,7 +1181,7 @@ More material to come here.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec24">More on the PCA </h2>
<h2 id="___sec23">More on the PCA </h2>
<p>
Instead of arbitrarily choosing the number of dimensions to reduce down to, it is generally preferable to
@@ -1205,7 +1211,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="___sec25">Incremental PCA </h2>
<h2 id="___sec24">Incremental PCA </h2>
<p>
One problem with the preceding implementation of PCA is that it requires the whole training set to fit in
@@ -1217,7 +1223,7 @@ instances arrive).
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec26">Randomized PCA </h2>
<h2 id="___sec25">Randomized PCA </h2>
<p>
Scikit-Learn offers yet another option to perform PCA, called Randomized PCA. This is a stochastic
@@ -1232,7 +1238,7 @@ previous algorithms when \( d \) is much smaller than \( n \).
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec27">Kernel PCA </h2>
<h2 id="___sec26">Kernel PCA </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -1261,7 +1267,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="___sec28">LLE </h2>
<h2 id="___sec27">LLE </h2>
<p>
Locally Linear Embedding (LLE) is another very powerful nonlinear dimensionality reduction
@@ -1273,7 +1279,7 @@ these local relationships are best preserved (more details shortly).
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec29">Other techniques </h2>
<h2 id="___sec28">Other techniques </h2>
<p>
There are many other dimensionality reduction techniques, several of which are available in Scikit-Learn.
+38 -37
View File
@@ -1308,7 +1308,14 @@
"\n",
"\n",
"\n",
"## PCA and Scikit-Learn Functionality"
"\n",
"\n",
"## Principal Component Analysis\n",
"Principal Component Analysis (PCA) is by far the most popular dimensionality reduction algorithm.\n",
"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 NumPys **svd()** function to obtain all the principal components of the\n",
"training set, then extracts the first two principal components. First we center the data using either **pandas** or our own code"
]
},
{
@@ -1319,38 +1326,30 @@
},
"outputs": [],
"source": [
"# Now add PCA\n",
"from sklearn.decomposition import PCA\n",
"pca = PCA(n_components = 2)\n",
"pca.fit(X_train_scaled)\n",
"import numpy as np\n",
"import pandas as pd\n",
"from IPython.display import display\n",
"np.random.seed(100)\n",
"# setting up a 10 x 5 vanilla matrix \n",
"rows = 10\n",
"cols = 5\n",
"X = np.random.randn(rows,cols)\n",
"df = pd.DataFrame(X)\n",
"# Pandas does the centering for us\n",
"df = df -df.mean()\n",
"display(df)\n",
"\n",
"X_pca = pca.transform(X_train_scaled)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Principal Component Analysis\n",
"Principal Component Analysis (PCA) is by far the most popular dimensionality reduction algorithm.\n",
"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 NumPys **svd()** function to obtain all the principal components of the\n",
"training set, then extracts the first two principal components. First we center the data"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# we center it ourselves\n",
"X_centered = X - X.mean(axis=0)\n",
"# Then check the difference between pandas and our own set up\n",
"print(X_centered-df)\n",
"#Now we do an SVD\n",
"U, s, V = np.linalg.svd(X_centered)\n",
"c1 = V.T[:, 0]\n",
"c2 = V.T[:, 1]"
"c2 = V.T[:, 1]\n",
"W2 = V.T[:, :2]\n",
"X2D = X_centered.dot(W2)\n",
"print(X2D)"
]
},
{
@@ -1368,7 +1367,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 12,
"metadata": {
"collapsed": false
},
@@ -1392,15 +1391,17 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"#thereafter we do a PCA with Scikit-learn\n",
"from sklearn.decomposition import PCA\n",
"pca = PCA(n_components = 2)\n",
"X2D = pca.fit_transform(X)"
"X2D = pca.fit_transform(X)\n",
"print(X2D)"
]
},
{
@@ -1414,13 +1415,13 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"pca.components_.T[:, 0])."
"pca.components_.T[:, 0]."
]
},
{
@@ -1444,7 +1445,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 15,
"metadata": {
"collapsed": false
},
@@ -1467,7 +1468,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 16,
"metadata": {
"collapsed": false
},
@@ -1514,7 +1515,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 17,
"metadata": {
"collapsed": false
},
Binary file not shown.
Binary file not shown.
+24 -15
View File
@@ -877,19 +877,6 @@ chapter 12.4 and discussion therein.
!split
===== PCA and Scikit-Learn Functionality =====
!bc pycod
# Now add PCA
from sklearn.decomposition import PCA
pca = PCA(n_components = 2)
pca.fit(X_train_scaled)
X_pca = pca.transform(X_train_scaled)
!ec
!split
@@ -899,12 +886,32 @@ 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 NumPys _svd()_ function to obtain all the principal components of the
training set, then extracts the first two principal components. First we center the data
training set, then extracts the first two principal components. First we center the data using either _pandas_ or our own code
!bc pycod
import numpy as np
import pandas as pd
from IPython.display import display
np.random.seed(100)
# setting up a 10 x 5 vanilla matrix
rows = 10
cols = 5
X = np.random.randn(rows,cols)
df = pd.DataFrame(X)
# Pandas does the centering for us
df = df -df.mean()
display(df)
# we center it ourselves
X_centered = X - X.mean(axis=0)
# Then check the difference between pandas and our own set up
print(X_centered-df)
#Now we do an SVD
U, s, V = np.linalg.svd(X_centered)
c1 = V.T[:, 0]
c2 = V.T[:, 1]
W2 = V.T[:, :2]
X2D = X_centered.dot(W2)
print(X2D)
!ec
PCA assumes that the dataset is centered around the origin. Scikit-Learns PCA classes take care of centering
@@ -926,15 +933,17 @@ Scikit-Learns PCA class implements PCA using SVD decomposition just like we d
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):
!bc pycod
#thereafter we do a PCA with Scikit-learn
from sklearn.decomposition import PCA
pca = PCA(n_components = 2)
X2D = pca.fit_transform(X)
print(X2D)
!ec
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
!bc pycod
pca.components_.T[:, 0]).
pca.components_.T[:, 0].
!ec
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 datasets
+21 -33
View File
@@ -1,31 +1,3 @@
from sklearn.decomposition import PCA
pca = PCA(n_components = 2)
pca.fit(X_train_scaled)
X_pca = pca.transform(X_train_scaled)
X_centered = X - X.mean(axis=0)
U, s, V = np.linalg.svd(X_centered)
c1 = V.T[:, 0]
c2 = V.T[:, 1]
W2 = V.T[:, :2]
X2D = X_centered.dot(W2)
pca = PCA(n_components = 2)
X2D = pca.fit_transform(X)
pca.components_.T[:, 0]).
pca = PCA()
pca.fit(X)
cumsum = np.cumsum(pca.explained_variance_ratio_)
d = np.argmax(cumsum >= 0.95) + 1
pca = PCA(n_components=0.95)
X_reduced = pca.fit_transform(X)
import numpy as np
import pandas as pd
from IPython.display import display
@@ -33,11 +5,27 @@ np.random.seed(100)
# setting up a 10 x 5 matrix
rows = 10
cols = 5
a = np.random.randn(rows,cols)
df = pd.DataFrame(a)
X = np.random.randn(rows,cols)
df = pd.DataFrame(X)
# Pandas does the centering for us
df = df -df.mean()
display(df)
print(df.mean())
print(df.std())
display(df**2)
# we center it ourselves
X_centered = X - X.mean(axis=0)
print(X_centered-df)
#Now we do an SVD
U, s, V = np.linalg.svd(X_centered)
c1 = V.T[:, 0]
c2 = V.T[:, 1]
W2 = V.T[:, :2]
X2D = X_centered.dot(W2)
print(X2D)
#thereafter we do a PCA with Scikit-learn
from sklearn.decomposition import PCA
pca = PCA(n_components = 2)
X2D = pca.fit_transform(X)
print(X2D)
print(pca.components_.T[:, 0])