Typos in hw corrected

This commit is contained in:
mhjensen
2018-08-27 21:23:26 +02:00
parent 930ffb34fa
commit ea15852ff3
7 changed files with 30 additions and 43 deletions
+6 -8
View File
@@ -128,7 +128,7 @@ MathJax.Hub.Config({
<h2 id="___sec0" class="anchor">Exercise 1 </h2>
<p>
The first exercise here is of a mere technical art. We want you have installed
The first exercise here is of a mere technical art. We want you to have
<ul>
<li> git as a version control software and to establish a user account on a provider like GitHub. Other providers like GitLab etc are equally fine. You can also use the University of Oslo <a href="https://www.uio.no/tjenester/it/maskin/filer/versjonskontroll/github.html" target="_self">GitHub facilities</a>.</li>
@@ -141,9 +141,7 @@ IPython/Jupyter notebooks invaluable in your work. You can run <b>R</b>
codes in the Jupyter/IPython notebooks, with the immediate benefit of
visualizing your data. You can also use compiled languages like C++,
Rust, Fortran etc if you prefer. The focus in these lectures will be
on Python, but we will provide many code examples for those of you who
prefer R or compiled languages. You can integrate C++ codes and R in for example
a Jupyter notebook.
on Python.
<p>
If you have Python installed (we recommend Python3) and you feel
@@ -209,7 +207,7 @@ We recommend using <b>Anaconda</b>.
<h2 id="___sec1" class="anchor">Exercise 2 </h2>
<p>
We will generate our own dataset for function \( y(x) \) where \( x \in [0,2] \) and defined by random numbers computed with the uniform distribution. The function \( y \) is a quadratic polynomial in \( x \) with added stochastic noise according to the normal distribution \( \cal {N}(0,1) \).
We will generate our own dataset for a function \( y(x) \) where \( x \in [0,1] \) and defined by random numbers computed with the uniform distribution. The function \( y \) is a quadratic polynomial in \( x \) with added stochastic noise according to the normal distribution \( \cal {N}(0,1) \).
The following simple Python instructions define our \( x \) and \( y \) values (with 100 data points).
<p>
@@ -218,9 +216,9 @@ The following simple Python instructions define our \( x \) and \( y \) values (
y <span style="color: #666666">=</span> <span style="color: #666666">5*</span>x<span style="color: #666666">*</span>x<span style="color: #666666">+0.1*</span>np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>randn(<span style="color: #666666">100</span>,<span style="color: #666666">1</span>)
</pre></div>
<ol>
<li> Write your own code (following the examples under the <a href="https://compphysics.github.io/MachineLearning/doc/pub/Regression/html/Regression-bs.html" target="_self">regression slides</a> for computing the parametrization of the data set fitting a second-order polynomial.</li>
<li> Write your own code (following the examples under the <a href="https://compphysics.github.io/MachineLearning/doc/pub/Regression/html/Regression-bs.html" target="_self">regression slides</a>) for computing the parametrization of the data set fitting a second-order polynomial.</li>
<li> Use thereafter <b>scikit-learn</b> (see again the examples in the regression slides) and compare with your own code.</li>
<li> Using scikit-learn, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error or loss defined as</li>
<li> Using scikit-learn, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error defined as</li>
</ol>
$$ MSE(\hat{y},\hat{\tilde{y}}) = \frac{1}{n}
@@ -238,7 +236,7 @@ $$
\bar{y} = \frac{1}{n} \sum_{i=0}^{n - 1} y_i.
$$
<p>
You can use the functionality included in scikit-learn. If you feel for it, you can use your own program and define functions which compute the above two functions.
Discuss the meaning of these results. Try also to vary the coefficient in front of the added stochastic noise term and discuss the quality of the fits.
<h2 id="___sec2" class="anchor">Exercise 3, variance of the parameters \( \beta \) in linear regression </h2>
+6 -8
View File
@@ -92,7 +92,7 @@ MathJax.Hub.Config({
<h2 id="___sec0">Exercise 1 </h2>
<p>
The first exercise here is of a mere technical art. We want you have installed
The first exercise here is of a mere technical art. We want you to have
<ul>
<li> git as a version control software and to establish a user account on a provider like GitHub. Other providers like GitLab etc are equally fine. You can also use the University of Oslo <a href="https://www.uio.no/tjenester/it/maskin/filer/versjonskontroll/github.html" target="_blank">GitHub facilities</a>.</li>
@@ -105,9 +105,7 @@ IPython/Jupyter notebooks invaluable in your work. You can run <b>R</b>
codes in the Jupyter/IPython notebooks, with the immediate benefit of
visualizing your data. You can also use compiled languages like C++,
Rust, Fortran etc if you prefer. The focus in these lectures will be
on Python, but we will provide many code examples for those of you who
prefer R or compiled languages. You can integrate C++ codes and R in for example
a Jupyter notebook.
on Python.
<p>
If you have Python installed (we recommend Python3) and you feel
@@ -173,7 +171,7 @@ We recommend using <b>Anaconda</b>.
<h2 id="___sec1">Exercise 2 </h2>
<p>
We will generate our own dataset for function \( y(x) \) where \( x \in [0,2] \) and defined by random numbers computed with the uniform distribution. The function \( y \) is a quadratic polynomial in \( x \) with added stochastic noise according to the normal distribution \( \cal {N}(0,1) \).
We will generate our own dataset for a function \( y(x) \) where \( x \in [0,1] \) and defined by random numbers computed with the uniform distribution. The function \( y \) is a quadratic polynomial in \( x \) with added stochastic noise according to the normal distribution \( \cal {N}(0,1) \).
The following simple Python instructions define our \( x \) and \( y \) values (with 100 data points).
<p>
@@ -182,9 +180,9 @@ The following simple Python instructions define our \( x \) and \( y \) values (
y <span style="color: #666666">=</span> <span style="color: #666666">5*</span>x<span style="color: #666666">*</span>x<span style="color: #666666">+0.1*</span>np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>randn(<span style="color: #666666">100</span>,<span style="color: #666666">1</span>)
</pre></div>
<ol>
<li> Write your own code (following the examples under the <a href="https://compphysics.github.io/MachineLearning/doc/pub/Regression/html/Regression-bs.html" target="_blank">regression slides</a> for computing the parametrization of the data set fitting a second-order polynomial.</li>
<li> Write your own code (following the examples under the <a href="https://compphysics.github.io/MachineLearning/doc/pub/Regression/html/Regression-bs.html" target="_blank">regression slides</a>) for computing the parametrization of the data set fitting a second-order polynomial.</li>
<li> Use thereafter <b>scikit-learn</b> (see again the examples in the regression slides) and compare with your own code.</li>
<li> Using scikit-learn, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error or loss defined as</li>
<li> Using scikit-learn, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error defined as</li>
</ol>
$$ MSE(\hat{y},\hat{\tilde{y}}) = \frac{1}{n}
@@ -202,7 +200,7 @@ $$
\bar{y} = \frac{1}{n} \sum_{i=0}^{n - 1} y_i.
$$
<p>
You can use the functionality included in scikit-learn. If you feel for it, you can use your own program and define functions which compute the above two functions.
Discuss the meaning of these results. Try also to vary the coefficient in front of the added stochastic noise term and discuss the quality of the fits.
<h2 id="___sec2">Exercise 3, variance of the parameters \( \beta \) in linear regression </h2>
Binary file not shown.
+6 -9
View File
@@ -164,7 +164,7 @@ Aug 27, 2018
\subsection{Exercise 1}
The first exercise here is of a mere technical art. We want you have installed
The first exercise here is of a mere technical art. We want you to have
\begin{itemize}
\item git as a version control software and to establish a user account on a provider like GitHub. Other providers like GitLab etc are equally fine. You can also use the University of Oslo \href{{https://www.uio.no/tjenester/it/maskin/filer/versjonskontroll/github.html}}{GitHub facilities}.
@@ -178,10 +178,7 @@ IPython/Jupyter notebooks invaluable in your work. You can run \textbf{R}
codes in the Jupyter/IPython notebooks, with the immediate benefit of
visualizing your data. You can also use compiled languages like C++,
Rust, Fortran etc if you prefer. The focus in these lectures will be
on Python, but we will provide many code examples for those of you who
prefer R or compiled languages. You can integrate C++ codes and R in for example
a Jupyter notebook.
on Python.
If you have Python installed (we recommend Python3) and you feel
pretty familiar with installing different packages, we recommend that
@@ -246,7 +243,7 @@ We recommend using \textbf{Anaconda}.
\subsection{Exercise 2}
We will generate our own dataset for function $y(x)$ where $x \in [0,2]$ and defined by random numbers computed with the uniform distribution. The function $y$ is a quadratic polynomial in $x$ with added stochastic noise according to the normal distribution $\cal {N}(0,1)$.
We will generate our own dataset for a function $y(x)$ where $x \in [0,1]$ and defined by random numbers computed with the uniform distribution. The function $y$ is a quadratic polynomial in $x$ with added stochastic noise according to the normal distribution $\cal {N}(0,1)$.
The following simple Python instructions define our $x$ and $y$ values (with 100 data points).
\bpycod
x = np.random.rand(100,1)
@@ -254,11 +251,11 @@ y = 5*x*x+0.1*np.random.randn(100,1)
\epycod
\begin{enumerate}
\item Write your own code (following the examples under the \href{{https://compphysics.github.io/MachineLearning/doc/pub/Regression/html/Regression-bs.html}}{regression slides} for computing the parametrization of the data set fitting a second-order polynomial.
\item Write your own code (following the examples under the \href{{https://compphysics.github.io/MachineLearning/doc/pub/Regression/html/Regression-bs.html}}{regression slides}) for computing the parametrization of the data set fitting a second-order polynomial.
\item Use thereafter \textbf{scikit-learn} (see again the examples in the regression slides) and compare with your own code.
\item Using scikit-learn, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error or loss defined as
\item Using scikit-learn, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error defined as
\end{enumerate}
\noindent
@@ -274,7 +271,7 @@ where we have defined the mean value of $\hat{y}$ as
\[
\bar{y} = \frac{1}{n} \sum_{i=0}^{n - 1} y_i.
\]
You can use the functionality included in scikit-learn. If you feel for it, you can use your own program and define functions which compute the above two functions.
Discuss the meaning of these results. Try also to vary the coefficient in front of the added stochastic noise term and discuss the quality of the fits.
Binary file not shown.
+6 -9
View File
@@ -134,7 +134,7 @@ Aug 27, 2018
\subsection*{Exercise 1}
The first exercise here is of a mere technical art. We want you have installed
The first exercise here is of a mere technical art. We want you to have
\begin{itemize}
\item git as a version control software and to establish a user account on a provider like GitHub. Other providers like GitLab etc are equally fine. You can also use the University of Oslo \href{{https://www.uio.no/tjenester/it/maskin/filer/versjonskontroll/github.html}}{GitHub facilities}.
@@ -148,10 +148,7 @@ IPython/Jupyter notebooks invaluable in your work. You can run \textbf{R}
codes in the Jupyter/IPython notebooks, with the immediate benefit of
visualizing your data. You can also use compiled languages like C++,
Rust, Fortran etc if you prefer. The focus in these lectures will be
on Python, but we will provide many code examples for those of you who
prefer R or compiled languages. You can integrate C++ codes and R in for example
a Jupyter notebook.
on Python.
If you have Python installed (we recommend Python3) and you feel
pretty familiar with installing different packages, we recommend that
@@ -216,7 +213,7 @@ We recommend using \textbf{Anaconda}.
\subsection*{Exercise 2}
We will generate our own dataset for function $y(x)$ where $x \in [0,2]$ and defined by random numbers computed with the uniform distribution. The function $y$ is a quadratic polynomial in $x$ with added stochastic noise according to the normal distribution $\cal {N}(0,1)$.
We will generate our own dataset for a function $y(x)$ where $x \in [0,1]$ and defined by random numbers computed with the uniform distribution. The function $y$ is a quadratic polynomial in $x$ with added stochastic noise according to the normal distribution $\cal {N}(0,1)$.
The following simple Python instructions define our $x$ and $y$ values (with 100 data points).
\begin{print}
x = np.random.rand(100,1)
@@ -224,11 +221,11 @@ y = 5*x*x+0.1*np.random.randn(100,1)
\end{print}
\begin{enumerate}
\item Write your own code (following the examples under the \href{{https://compphysics.github.io/MachineLearning/doc/pub/Regression/html/Regression-bs.html}}{regression slides} for computing the parametrization of the data set fitting a second-order polynomial.
\item Write your own code (following the examples under the \href{{https://compphysics.github.io/MachineLearning/doc/pub/Regression/html/Regression-bs.html}}{regression slides}) for computing the parametrization of the data set fitting a second-order polynomial.
\item Use thereafter \textbf{scikit-learn} (see again the examples in the regression slides) and compare with your own code.
\item Using scikit-learn, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error or loss defined as
\item Using scikit-learn, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error defined as
\end{enumerate}
\noindent
@@ -244,7 +241,7 @@ where we have defined the mean value of $\hat{y}$ as
\[
\bar{y} = \frac{1}{n} \sum_{i=0}^{n - 1} y_i.
\]
You can use the functionality included in scikit-learn. If you feel for it, you can use your own program and define functions which compute the above two functions.
Discuss the meaning of these results. Try also to vary the coefficient in front of the added stochastic noise term and discuss the quality of the fits.
+6 -9
View File
@@ -5,7 +5,7 @@ DATE:Today
===== Exercise 1 =====
The first exercise here is of a mere technical art. We want you have installed
The first exercise here is of a mere technical art. We want you to have
* git as a version control software and to establish a user account on a provider like GitHub. Other providers like GitLab etc are equally fine. You can also use the University of Oslo "GitHub facilities":"https://www.uio.no/tjenester/it/maskin/filer/versjonskontroll/github.html".
* Install various Python packages
@@ -15,10 +15,7 @@ IPython/Jupyter notebooks invaluable in your work. You can run _R_
codes in the Jupyter/IPython notebooks, with the immediate benefit of
visualizing your data. You can also use compiled languages like C++,
Rust, Fortran etc if you prefer. The focus in these lectures will be
on Python, but we will provide many code examples for those of you who
prefer R or compiled languages. You can integrate C++ codes and R in for example
a Jupyter notebook.
on Python.
If you have Python installed (we recommend Python3) and you feel
pretty familiar with installing different packages, we recommend that
@@ -68,16 +65,16 @@ We recommend using _Anaconda_.
===== Exercise 2 =====
We will generate our own dataset for function $y(x)$ where $x \in [0,2]$ and defined by random numbers computed with the uniform distribution. The function $y$ is a quadratic polynomial in $x$ with added stochastic noise according to the normal distribution $\cal {N}(0,1)$.
We will generate our own dataset for a function $y(x)$ where $x \in [0,1]$ and defined by random numbers computed with the uniform distribution. The function $y$ is a quadratic polynomial in $x$ with added stochastic noise according to the normal distribution $\cal {N}(0,1)$.
The following simple Python instructions define our $x$ and $y$ values (with 100 data points).
!bc pycod
x = np.random.rand(100,1)
y = 5*x*x+0.1*np.random.randn(100,1)
!ec
o Write your own code (following the examples under the "regression slides":"https://compphysics.github.io/MachineLearning/doc/pub/Regression/html/Regression-bs.html" for computing the parametrization of the data set fitting a second-order polynomial.
o Write your own code (following the examples under the "regression slides":"https://compphysics.github.io/MachineLearning/doc/pub/Regression/html/Regression-bs.html") for computing the parametrization of the data set fitting a second-order polynomial.
o Use thereafter _scikit-learn_ (see again the examples in the regression slides) and compare with your own code.
o Using scikit-learn, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error or loss defined as
o Using scikit-learn, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error defined as
!bt
\[ MSE(\hat{y},\hat{\tilde{y}}) = \frac{1}{n}
\sum_{i=0}^{n-1}(y_i-\tilde{y}_i)^2,
@@ -96,7 +93,7 @@ where we have defined the mean value of $\hat{y}$ as
\bar{y} = \frac{1}{n} \sum_{i=0}^{n - 1} y_i.
\]
!et
You can use the functionality included in scikit-learn. If you feel for it, you can use your own program and define functions which compute the above two functions.
Discuss the meaning of these results. Try also to vary the coefficient in front of the added stochastic noise term and discuss the quality of the fits.