diff --git a/doc/pub/DimRed/html/._DimRed-bs000.html b/doc/pub/DimRed/html/._DimRed-bs000.html index 2fdf5d407..e98d32dba 100644 --- a/doc/pub/DimRed/html/._DimRed-bs000.html +++ b/doc/pub/DimRed/html/._DimRed-bs000.html @@ -224,7 +224,7 @@ MathJax.Hub.Config({
-
diff --git a/doc/pub/DimRed/html/._DimRed-bs018.html b/doc/pub/DimRed/html/._DimRed-bs018.html index a11bbb777..54860bafa 100644 --- a/doc/pub/DimRed/html/._DimRed-bs018.html +++ b/doc/pub/DimRed/html/._DimRed-bs018.html @@ -278,7 +278,7 @@ specific case.
-Now we are going to use the mean centered data to compute the sample covariance of the data. +Now we are going to use the mean centered data to compute the sample covariance of the data by using the following equation $$ \begin{equation*} \Sigma_n = \frac{1}{n-1} \sum_{i=1}^n \bar{x}_i^T \bar{x}_i = \frac{1}{n-1} \sum_{i=1}^n (x_i - \mu_n)^T (x_i - \mu_n) @@ -294,8 +294,8 @@ We can write our own code or simply use either the functionaly of numpy o print(np.cov(X_centered.T))
-Note that the way we define the covariance matrix here has a factor \( n-1 \) instead of \( n \). -Our own code here is not very elegant and asks for improvements. +Note that the way we define the covariance matrix here has a factor \( n-1 \) instead of \( n \). This is included in the cov() function by numpy and pandas. +Our own code here is not very elegant and asks for obvious improvements. It is tailored to this specific \( 2\times 2 \) covariance matrix.
diff --git a/doc/pub/DimRed/html/DimRed-bs.html b/doc/pub/DimRed/html/DimRed-bs.html index 2fdf5d407..e98d32dba 100644 --- a/doc/pub/DimRed/html/DimRed-bs.html +++ b/doc/pub/DimRed/html/DimRed-bs.html @@ -224,7 +224,7 @@ MathJax.Hub.Config({
-
diff --git a/doc/pub/DimRed/html/DimRed-reveal.html b/doc/pub/DimRed/html/DimRed-reveal.html index 5077e5fff..a6c087b82 100644 --- a/doc/pub/DimRed/html/DimRed-reveal.html +++ b/doc/pub/DimRed/html/DimRed-reveal.html @@ -148,7 +148,7 @@ MathJax.Hub.Config({
-
@@ -1088,7 +1088,7 @@ specific case.
-Now we are going to use the mean centered data to compute the sample covariance of the data. +Now we are going to use the mean centered data to compute the sample covariance of the data by using the following equation
$$
\begin{equation*}
@@ -1106,8 +1106,8 @@ We can write our own code or simply use either the functionaly of numpy o
print(np.cov(X_centered.T))
-Note that the way we define the covariance matrix here has a factor \( n-1 \) instead of \( n \). -Our own code here is not very elegant and asks for improvements. +Note that the way we define the covariance matrix here has a factor \( n-1 \) instead of \( n \). This is included in the cov() function by numpy and pandas. +Our own code here is not very elegant and asks for obvious improvements. It is tailored to this specific \( 2\times 2 \) covariance matrix.
diff --git a/doc/pub/DimRed/html/DimRed-solarized.html b/doc/pub/DimRed/html/DimRed-solarized.html index 7f81d4685..afc784777 100644 --- a/doc/pub/DimRed/html/DimRed-solarized.html +++ b/doc/pub/DimRed/html/DimRed-solarized.html @@ -179,7 +179,7 @@ MathJax.Hub.Config({
-
@@ -1064,7 +1064,7 @@ specific case.
-Now we are going to use the mean centered data to compute the sample covariance of the data. +Now we are going to use the mean centered data to compute the sample covariance of the data by using the following equation $$ \begin{equation*} \Sigma_n = \frac{1}{n-1} \sum_{i=1}^n \bar{x}_i^T \bar{x}_i = \frac{1}{n-1} \sum_{i=1}^n (x_i - \mu_n)^T (x_i - \mu_n) @@ -1080,8 +1080,8 @@ We can write our own code or simply use either the functionaly of numpy o print(np.cov(X_centered.T))
-Note that the way we define the covariance matrix here has a factor \( n-1 \) instead of \( n \). -Our own code here is not very elegant and asks for improvements. +Note that the way we define the covariance matrix here has a factor \( n-1 \) instead of \( n \). This is included in the cov() function by numpy and pandas. +Our own code here is not very elegant and asks for obvious improvements. It is tailored to this specific \( 2\times 2 \) covariance matrix.
diff --git a/doc/pub/DimRed/html/DimRed.html b/doc/pub/DimRed/html/DimRed.html index 324cbc7d7..782810c60 100644 --- a/doc/pub/DimRed/html/DimRed.html +++ b/doc/pub/DimRed/html/DimRed.html @@ -184,7 +184,7 @@ MathJax.Hub.Config({
-
@@ -1069,7 +1069,7 @@ specific case.
-Now we are going to use the mean centered data to compute the sample covariance of the data. +Now we are going to use the mean centered data to compute the sample covariance of the data by using the following equation $$ \begin{equation*} \Sigma_n = \frac{1}{n-1} \sum_{i=1}^n \bar{x}_i^T \bar{x}_i = \frac{1}{n-1} \sum_{i=1}^n (x_i - \mu_n)^T (x_i - \mu_n) @@ -1085,8 +1085,8 @@ We can write our own code or simply use either the functionaly of numpy o print(np.cov(X_centered.T))
-Note that the way we define the covariance matrix here has a factor \( n-1 \) instead of \( n \). -Our own code here is not very elegant and asks for improvements. +Note that the way we define the covariance matrix here has a factor \( n-1 \) instead of \( n \). This is included in the cov() function by numpy and pandas. +Our own code here is not very elegant and asks for obvious improvements. It is tailored to this specific \( 2\times 2 \) covariance matrix.
diff --git a/doc/pub/DimRed/ipynb/DimRed.ipynb b/doc/pub/DimRed/ipynb/DimRed.ipynb index f51883b28..271ded656 100644 --- a/doc/pub/DimRed/ipynb/DimRed.ipynb +++ b/doc/pub/DimRed/ipynb/DimRed.ipynb @@ -10,7 +10,7 @@ " \n", "**Morten Hjorth-Jensen**, Department of Physics, University of Oslo and Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University\n", "\n", - "Date: **Jan 2, 2020**\n", + "Date: **Jan 3, 2020**\n", "\n", "Copyright 1999-2020, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license\n", "\n", @@ -1192,7 +1192,7 @@ "\n", "### Compute the sample covariance\n", "\n", - "Now we are going to use the mean centered data to compute the sample covariance of the data." + "Now we are going to use the mean centered data to compute the sample covariance of the data by using the following equation" ] }, { @@ -1228,8 +1228,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Note that the way we define the covariance matrix here has a factor $n-1$ instead of $n$.\n", - "Our own code here is not very elegant and asks for improvements." + "Note that the way we define the covariance matrix here has a factor $n-1$ instead of $n$. This is included in the **cov()** function by **numpy** and **pandas**. \n", + "Our own code here is not very elegant and asks for obvious improvements. It is tailored to this specific $2\\times 2$ covariance matrix." ] }, { diff --git a/doc/pub/DimRed/ipynb/ipynb-DimRed-src.tar.gz b/doc/pub/DimRed/ipynb/ipynb-DimRed-src.tar.gz index e774e0d7c..97c434b49 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 1112487ce..e0063f554 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 e6cc7ee23..9e0f013a7 100644 --- a/doc/src/DimRed/DimRed.do.txt +++ b/doc/src/DimRed/DimRed.do.txt @@ -829,7 +829,7 @@ specific case. === Compute the sample covariance === -Now we are going to use the mean centered data to compute the sample covariance of the data. +Now we are going to use the mean centered data to compute the sample covariance of the data by using the following equation !bt \begin{equation*} \Sigma_n = \frac{1}{n-1} \sum_{i=1}^n \bar{x}_i^T \bar{x}_i = \frac{1}{n-1} \sum_{i=1}^n (x_i - \mu_n)^T (x_i - \mu_n) @@ -841,8 +841,8 @@ We can write our own code or simply use either the functionaly of _numpy_ or tha print(df.cov()) print(np.cov(X_centered.T)) !ec -Note that the way we define the covariance matrix here has a factor $n-1$ instead of $n$. -Our own code here is not very elegant and asks for improvements. +Note that the way we define the covariance matrix here has a factor $n-1$ instead of $n$. This is included in the _cov()_ function by _numpy_ and _pandas_. +Our own code here is not very elegant and asks for obvious improvements. It is tailored to this specific $2\times 2$ covariance matrix. !bc pycod # extract the relevant columns from the centered design matrix of dim n x 2 x = X_centered[:,0]