diff --git a/doc/pub/DimRed/html/._DimRed-bs018.html b/doc/pub/DimRed/html/._DimRed-bs018.html index 4686a77d7..1dc23b946 100644 --- a/doc/pub/DimRed/html/._DimRed-bs018.html +++ b/doc/pub/DimRed/html/._DimRed-bs018.html @@ -258,7 +258,7 @@ $$ When you are done with these steps, print out \( \mu_n \) to verify it is close to \( \mu \) and plot your mean centered data to verify it is centered at the origin! Compare your code with the functionality from Scikit-Learn discussed above. -The following code elements perform these operations using pandas or your own functionality for doing so. +The following code elements perform these operations using pandas or using our own functionality for doing so. The latter, using numpy is rather simply through the mean() function.

@@ -277,7 +277,7 @@ Alternatively, you could also have used the functions we discussed earlier for s That is, we could have used the StandardScaler function in Scikit-Learn, a function which ensures that for each feature/predictor we study the mean value is zero and the variance is one (every column in the design/feature -matrix). +matrix). You would then not get the same results, since we divide by the variance. For diagonal covariance matrix elements will then be one, while the non-diagonal ones will be divided by \( 2\sqrt{2} \) for our specific case.

Compute the sample covariance

@@ -319,11 +319,11 @@ following tasks: $$ \begin{equation*} -x_i \approx \tilde{x}_i := \mu_n + \langle x_i, v_0 \rangle v_0 +x_i \approx \tilde{x}_i = \mu_n + \langle x_i, v_0 \rangle v_0 \end{equation*} $$ -where \( v_0 \) is the first principal component. What do you observe? +where \( v_0 \) is the first principal component.

Collecting all these steps we can write our own PCA function and diff --git a/doc/pub/DimRed/html/DimRed-reveal.html b/doc/pub/DimRed/html/DimRed-reveal.html index dff77c4d9..d40e41dbd 100644 --- a/doc/pub/DimRed/html/DimRed-reveal.html +++ b/doc/pub/DimRed/html/DimRed-reveal.html @@ -1068,7 +1068,7 @@ $$ When you are done with these steps, print out \( \mu_n \) to verify it is close to \( \mu \) and plot your mean centered data to verify it is centered at the origin! Compare your code with the functionality from Scikit-Learn discussed above. -The following code elements perform these operations using pandas or your own functionality for doing so. +The following code elements perform these operations using pandas or using our own functionality for doing so. The latter, using numpy is rather simply through the mean() function.

@@ -1087,7 +1087,7 @@ Alternatively, you could also have used the functions we discussed earlier for s That is, we could have used the StandardScaler function in Scikit-Learn, a function which ensures that for each feature/predictor we study the mean value is zero and the variance is one (every column in the design/feature -matrix). +matrix). You would then not get the same results, since we divide by the variance. For diagonal covariance matrix elements will then be one, while the non-diagonal ones will be divided by \( 2\sqrt{2} \) for our specific case.

Compute the sample covariance

@@ -1131,12 +1131,12 @@ following tasks:

 
$$ \begin{equation*} -x_i \approx \tilde{x}_i := \mu_n + \langle x_i, v_0 \rangle v_0 +x_i \approx \tilde{x}_i = \mu_n + \langle x_i, v_0 \rangle v_0 \end{equation*} $$

 
-where \( v_0 \) is the first principal component. What do you observe? +where \( v_0 \) is the first principal component.

Collecting all these steps we can write our own PCA function and diff --git a/doc/pub/DimRed/html/DimRed-solarized.html b/doc/pub/DimRed/html/DimRed-solarized.html index ee3a4cc6f..a15038ff7 100644 --- a/doc/pub/DimRed/html/DimRed-solarized.html +++ b/doc/pub/DimRed/html/DimRed-solarized.html @@ -1044,7 +1044,7 @@ $$ When you are done with these steps, print out \( \mu_n \) to verify it is close to \( \mu \) and plot your mean centered data to verify it is centered at the origin! Compare your code with the functionality from Scikit-Learn discussed above. -The following code elements perform these operations using pandas or your own functionality for doing so. +The following code elements perform these operations using pandas or using our own functionality for doing so. The latter, using numpy is rather simply through the mean() function.

@@ -1063,7 +1063,7 @@ Alternatively, you could also have used the functions we discussed earlier for s That is, we could have used the StandardScaler function in Scikit-Learn, a function which ensures that for each feature/predictor we study the mean value is zero and the variance is one (every column in the design/feature -matrix). +matrix). You would then not get the same results, since we divide by the variance. For diagonal covariance matrix elements will then be one, while the non-diagonal ones will be divided by \( 2\sqrt{2} \) for our specific case.

Compute the sample covariance

@@ -1105,11 +1105,11 @@ following tasks: $$ \begin{equation*} -x_i \approx \tilde{x}_i := \mu_n + \langle x_i, v_0 \rangle v_0 +x_i \approx \tilde{x}_i = \mu_n + \langle x_i, v_0 \rangle v_0 \end{equation*} $$ -where \( v_0 \) is the first principal component. What do you observe? +where \( v_0 \) is the first principal component.

Collecting all these steps we can write our own PCA function and diff --git a/doc/pub/DimRed/html/DimRed.html b/doc/pub/DimRed/html/DimRed.html index 2e10a51a3..424c95f51 100644 --- a/doc/pub/DimRed/html/DimRed.html +++ b/doc/pub/DimRed/html/DimRed.html @@ -1049,7 +1049,7 @@ $$ When you are done with these steps, print out \( \mu_n \) to verify it is close to \( \mu \) and plot your mean centered data to verify it is centered at the origin! Compare your code with the functionality from Scikit-Learn discussed above. -The following code elements perform these operations using pandas or your own functionality for doing so. +The following code elements perform these operations using pandas or using our own functionality for doing so. The latter, using numpy is rather simply through the mean() function.

@@ -1068,7 +1068,7 @@ Alternatively, you could also have used the functions we discussed earlier for s That is, we could have used the StandardScaler function in Scikit-Learn, a function which ensures that for each feature/predictor we study the mean value is zero and the variance is one (every column in the design/feature -matrix). +matrix). You would then not get the same results, since we divide by the variance. For diagonal covariance matrix elements will then be one, while the non-diagonal ones will be divided by \( 2\sqrt{2} \) for our specific case.

Compute the sample covariance

@@ -1110,11 +1110,11 @@ following tasks: $$ \begin{equation*} -x_i \approx \tilde{x}_i := \mu_n + \langle x_i, v_0 \rangle v_0 +x_i \approx \tilde{x}_i = \mu_n + \langle x_i, v_0 \rangle v_0 \end{equation*} $$ -where \( v_0 \) is the first principal component. What do you observe? +where \( v_0 \) is the first principal component.

Collecting all these steps we can write our own PCA function and diff --git a/doc/pub/DimRed/ipynb/DimRed.ipynb b/doc/pub/DimRed/ipynb/DimRed.ipynb index c6bca2820..42b7a9f71 100644 --- a/doc/pub/DimRed/ipynb/DimRed.ipynb +++ b/doc/pub/DimRed/ipynb/DimRed.ipynb @@ -1161,7 +1161,7 @@ "When you are done with these steps, print out $\\mu_n$ to verify it is\n", "close to $\\mu$ and plot your mean centered data to verify it is\n", "centered at the origin! Compare your code with the functionality from **Scikit-Learn** discussed above.\n", - "The following code elements perform these operations using **pandas** or your own functionality for doing so." + "The following code elements perform these operations using **pandas** or using our own functionality for doing so. The latter, using **numpy** is rather simply through the **mean()** function." ] }, { @@ -1191,7 +1191,7 @@ "That is, we could have used the **StandardScaler** function in **Scikit-Learn**, a function which \n", "ensures that for each feature/predictor we study the mean value is\n", "zero and the variance is one (every column in the design/feature\n", - "matrix).\n", + "matrix). You would then not get the same results, since we divide by the variance. For diagonal covariance matrix elements will then be one, while the non-diagonal ones will be divided by $2\\sqrt{2}$ for our specific case.\n", "\n", "### Compute the sample covariance\n", "\n", @@ -1257,7 +1257,7 @@ "metadata": {}, "source": [ "$$\n", - "x_i \\approx \\tilde{x}_i := \\mu_n + \\langle x_i, v_0 \\rangle v_0\n", + "x_i \\approx \\tilde{x}_i = \\mu_n + \\langle x_i, v_0 \\rangle v_0\n", "$$" ] }, @@ -1265,7 +1265,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "where $v_0$ is the first principal component. What do you observe?\n", + "where $v_0$ is the first principal component. \n", "\n", "Collecting all these steps we can write our own PCA function and\n", "compare this with the functionality included in **Scikit-Learn**. \n", diff --git a/doc/pub/DimRed/ipynb/ipynb-DimRed-src.tar.gz b/doc/pub/DimRed/ipynb/ipynb-DimRed-src.tar.gz index 352fb2e04..3dcbbe279 100644 Binary files a/doc/pub/DimRed/ipynb/ipynb-DimRed-src.tar.gz and b/doc/pub/DimRed/ipynb/ipynb-DimRed-src.tar.gz differ diff --git a/doc/pub/DimRed/pdf/DimRed-minted.pdf b/doc/pub/DimRed/pdf/DimRed-minted.pdf index 02e5a8671..d9bb19dfd 100644 Binary files a/doc/pub/DimRed/pdf/DimRed-minted.pdf and b/doc/pub/DimRed/pdf/DimRed-minted.pdf differ diff --git a/doc/src/DimRed/DimRed.do.txt b/doc/src/DimRed/DimRed.do.txt index c4536868a..17ddc720e 100644 --- a/doc/src/DimRed/DimRed.do.txt +++ b/doc/src/DimRed/DimRed.do.txt @@ -812,7 +812,7 @@ and the mean-centered data $\bar{X} = \{ \bar{x}_1, \ldots, \bar{x}_n \}$ takes When you are done with these steps, print out $\mu_n$ to verify it is close to $\mu$ and plot your mean centered data to verify it is centered at the origin! Compare your code with the functionality from _Scikit-Learn_ discussed above. -The following code elements perform these operations using _pandas_ or your own functionality for doing so. +The following code elements perform these operations using _pandas_ or using our own functionality for doing so. The latter, using _numpy_ is rather simply through the _mean()_ function. !bc pycod df = pd.DataFrame(X) # Pandas does the centering for us @@ -828,7 +828,7 @@ Alternatively, you could also have used the functions we discussed earlier for s That is, we could have used the _StandardScaler_ function in _Scikit-Learn_, a function which ensures that for each feature/predictor we study the mean value is zero and the variance is one (every column in the design/feature -matrix). +matrix). You would then not get the same results, since we divide by the variance. For diagonal covariance matrix elements will then be one, while the non-diagonal ones will be divided by $2\sqrt{2}$ for our specific case. === Compute the sample covariance === @@ -860,12 +860,13 @@ following tasks: * We plot the mean centered data and lines along the first and second principal components * Then we project the mean centered data onto the first and second principal components, and plot the projected data. * Finally, we approximate the data as + !bt \begin{equation*} -x_i \approx \tilde{x}_i := \mu_n + \langle x_i, v_0 \rangle v_0 +x_i \approx \tilde{x}_i = \mu_n + \langle x_i, v_0 \rangle v_0 \end{equation*} !et -where $v_0$ is the first principal component. What do you observe? +where $v_0$ is the first principal component. Collecting all these steps we can write our own PCA function and compare this with the functionality included in _Scikit-Learn_.