Update on project 2, replaced R2 and MSE with accuracy score for log reg

This commit is contained in:
mhjensen
2018-10-16 10:51:53 +02:00
parent 016672dbf0
commit 5644101f09
7 changed files with 123 additions and 68 deletions
@@ -162,7 +162,7 @@ MathJax.Hub.Config({
<center><b>Department of Physics, University of Oslo, Norway</b></center>
<br>
<p>
<center><h4>Oct 12, 2018</h4></center> <!-- date -->
<center><h4>Oct 16, 2018</h4></center> <!-- date -->
<br>
<p>
</div> <!-- end jumbotron -->
@@ -399,7 +399,7 @@ called ordered states (the spins tend to point in one direction,
resulting in a net magnetic moment) while those above the critical
temperature are called disordered. Since a finite lattice like this
does not exhibit a clear sign of a phase transition we will mainly
stay with either orderer or disoredered phases. You could include the
stay with either orderer or disordered phases. You could include the
critical phase if you want.
<p>
@@ -411,13 +411,24 @@ notes on <a href="https://compphysics.github.io/MachineLearning/doc/pub/LogReg/h
regression</a>.
<p>
You should include either bootstrap or cross-validation in setting up
your model (as done in project 1) and compute the \( R2 \) score and the
mean-square error.
We will use both ordered and disordered states to train
the logistic regressor and, once the supervised training procedure is
complete, you should evaluate the performance of your classification model on
unseen ordered, disordered and possibly critical states.
In this case, to evaluate the model, we will use the so-called accuracy score
instead of the bootstrap or cross-validation as done in the standard linear regression part discussed in b). Examples of how to define the accuracy score can be found under the neural network slides, see for example the <a href="https://compphysics.github.io/MachineLearning/doc/pub/NeuralNet/html/._NeuralNet-bs047.html" target="_self">slides here</a>.
<p>
To measure the performance of our network we evaluate how well it does
it data it has never seen before, i.e. the test data. We measure the
performance of the network using the <em>accuracy</em> score. The accuracy
is as you would expect just the number of images correctly labeled
divided by the total number of images. A perfect classifier will have
an accuracy score of \( 1 \).
$$
\text{Accuracy} = \frac{\sum_{i=1}^n I(t_i = y_i)}{n} ,
$$
<p>
where \( I \) is the indicator function, \( 1 \) if \( t_i = y_i \) and \( 0 \)
otherwise, where \( t_i \) represents the target and \( y_i \) the outputs.
<p>
In order to find the optimal parameters of your logistic regressor you should
@@ -428,8 +439,8 @@ Since we don't have so many data points, you may just code the
standard gradient descent with a given learning rate, or even attempt
to use the Newton-Raphson method. Alternatively, it may be useful for
the next part on neural networks to implement a stochastic gradient
descent. For all gradient methods, you can use <b>scikit-learn</b>'s toolbox for
optimization methods in order to test your own results.
descent with and without mini-batches. Stochastic gradient with mini-batches may give the best results. You could finally compare your code with the output from <b>scikit-learn</b>'s toolbox for
optimization methods applied to logistic regression.
<p>
The notebook of <a href="https://physics.bu.edu/~pankajm/ML-Notebooks/HTML/NB_CVII-logreg_ising.html" target="_self">Mehta et al</a> is highly recommended in order to benchmark your code and results.
@@ -449,10 +460,6 @@ to use the codes in the above lecture slides as starting points.
Train your network and compare the results with those from your linear regression code.
You can test your results against a similar code using _scikit_learn_ (see the examples in the above lecture notes) or <b>tensorflow/keras</b>.
<p>
You should have the same elements as in the regression examples, including the \( R2 \) score, the MSE, and bootstrap or cross-validation.
You may also need to think of using another activation function than the standard logistic function.
<p>
A useful reference on the back progagation algorithm is <a href="http://neuralnetworksanddeeplearning.com/" target="_self">Nielsen's book</a>. It is an excellent read.
+22 -15
View File
@@ -120,7 +120,7 @@ MathJax.Hub.Config({
<center><b>Department of Physics, University of Oslo, Norway</b></center>
<br>
<p>
<center><h4>Oct 12, 2018</h4></center> <!-- date -->
<center><h4>Oct 16, 2018</h4></center> <!-- date -->
<br>
<h2 id="___sec0">Classification and Regression, from linear and logistic regression to neural networks </h2>
@@ -355,7 +355,7 @@ called ordered states (the spins tend to point in one direction,
resulting in a net magnetic moment) while those above the critical
temperature are called disordered. Since a finite lattice like this
does not exhibit a clear sign of a phase transition we will mainly
stay with either orderer or disoredered phases. You could include the
stay with either orderer or disordered phases. You could include the
critical phase if you want.
<p>
@@ -367,13 +367,24 @@ notes on <a href="https://compphysics.github.io/MachineLearning/doc/pub/LogReg/h
regression</a>.
<p>
You should include either bootstrap or cross-validation in setting up
your model (as done in project 1) and compute the \( R2 \) score and the
mean-square error.
We will use both ordered and disordered states to train
the logistic regressor and, once the supervised training procedure is
complete, you should evaluate the performance of your classification model on
unseen ordered, disordered and possibly critical states.
In this case, to evaluate the model, we will use the so-called accuracy score
instead of the bootstrap or cross-validation as done in the standard linear regression part discussed in b). Examples of how to define the accuracy score can be found under the neural network slides, see for example the <a href="https://compphysics.github.io/MachineLearning/doc/pub/NeuralNet/html/._NeuralNet-bs047.html" target="_blank">slides here</a>.
<p>
To measure the performance of our network we evaluate how well it does
it data it has never seen before, i.e. the test data. We measure the
performance of the network using the <em>accuracy</em> score. The accuracy
is as you would expect just the number of images correctly labeled
divided by the total number of images. A perfect classifier will have
an accuracy score of \( 1 \).
$$
\text{Accuracy} = \frac{\sum_{i=1}^n I(t_i = y_i)}{n} ,
$$
<p>
where \( I \) is the indicator function, \( 1 \) if \( t_i = y_i \) and \( 0 \)
otherwise, where \( t_i \) represents the target and \( y_i \) the outputs.
<p>
In order to find the optimal parameters of your logistic regressor you should
@@ -384,8 +395,8 @@ Since we don't have so many data points, you may just code the
standard gradient descent with a given learning rate, or even attempt
to use the Newton-Raphson method. Alternatively, it may be useful for
the next part on neural networks to implement a stochastic gradient
descent. For all gradient methods, you can use <b>scikit-learn</b>'s toolbox for
optimization methods in order to test your own results.
descent with and without mini-batches. Stochastic gradient with mini-batches may give the best results. You could finally compare your code with the output from <b>scikit-learn</b>'s toolbox for
optimization methods applied to logistic regression.
<p>
The notebook of <a href="https://physics.bu.edu/~pankajm/ML-Notebooks/HTML/NB_CVII-logreg_ising.html" target="_blank">Mehta et al</a> is highly recommended in order to benchmark your code and results.
@@ -405,10 +416,6 @@ to use the codes in the above lecture slides as starting points.
Train your network and compare the results with those from your linear regression code.
You can test your results against a similar code using _scikit_learn_ (see the examples in the above lecture notes) or <b>tensorflow/keras</b>.
<p>
You should have the same elements as in the regression examples, including the \( R2 \) score, the MSE, and bootstrap or cross-validation.
You may also need to think of using another activation function than the standard logistic function.
<p>
A useful reference on the back progagation algorithm is <a href="http://neuralnetworksanddeeplearning.com/" target="_blank">Nielsen's book</a>. It is an excellent read.
+26 -13
View File
@@ -155,7 +155,7 @@ Project 2 on Machine Learning, deadline November 5
% --- begin date ---
\begin{center}
Oct 12, 2018
Oct 16, 2018
\end{center}
% --- end date ---
@@ -371,7 +371,7 @@ called ordered states (the spins tend to point in one direction,
resulting in a net magnetic moment) while those above the critical
temperature are called disordered. Since a finite lattice like this
does not exhibit a clear sign of a phase transition we will mainly
stay with either orderer or disoredered phases. You could include the
stay with either orderer or disordered phases. You could include the
critical phase if you want.
@@ -382,13 +382,23 @@ and write your own code for doing logistic regression, see the lecture
notes on \href{{https://compphysics.github.io/MachineLearning/doc/pub/LogReg/html/LogReg-bs.html}}{logistic
regression}.
You should include either bootstrap or cross-validation in setting up
your model (as done in project 1) and compute the $R2$ score and the
mean-square error.
We will use both ordered and disordered states to train
the logistic regressor and, once the supervised training procedure is
complete, you should evaluate the performance of your classification model on
unseen ordered, disordered and possibly critical states.
In this case, to evaluate the model, we will use the so-called accuracy score
instead of the bootstrap or cross-validation as done in the standard linear regression part discussed in b). Examples of how to define the accuracy score can be found under the neural network slides, see for example the \href{{https://compphysics.github.io/MachineLearning/doc/pub/NeuralNet/html/._NeuralNet-bs047.html}}{slides here}.
To measure the performance of our network we evaluate how well it does
it data it has never seen before, i.e.~the test data. We measure the
performance of the network using the \emph{accuracy} score. The accuracy
is as you would expect just the number of images correctly labeled
divided by the total number of images. A perfect classifier will have
an accuracy score of $1$.
\[
\text{Accuracy} = \frac{\sum_{i=1}^n I(t_i = y_i)}{n} ,
\]
where $I$ is the indicator function, $1$ if $t_i = y_i$ and $0$
otherwise, where $t_i$ represents the target and $y_i$ the outputs.
@@ -400,8 +410,8 @@ Since we don't have so many data points, you may just code the
standard gradient descent with a given learning rate, or even attempt
to use the Newton-Raphson method. Alternatively, it may be useful for
the next part on neural networks to implement a stochastic gradient
descent. For all gradient methods, you can use \textbf{scikit-learn}'s toolbox for
optimization methods in order to test your own results.
descent with and without mini-batches. Stochastic gradient with mini-batches may give the best results. You could finally compare your code with the output from \textbf{scikit-learn}'s toolbox for
optimization methods applied to logistic regression.
The notebook of \href{{https://physics.bu.edu/~pankajm/ML-Notebooks/HTML/NB_CVII-logreg_ising.html}}{Mehta et al} is highly recommended in order to benchmark your code and results.
@@ -418,8 +428,6 @@ to use the codes in the above lecture slides as starting points.
Train your network and compare the results with those from your linear regression code.
You can test your results against a similar code using _scikit_learn_ (see the examples in the above lecture notes) or \textbf{tensorflow/keras}.
You should have the same elements as in the regression examples, including the $R2$ score, the MSE, and bootstrap or cross-validation.
You may also need to think of using another activation function than the standard logistic function.
A useful reference on the back progagation algorithm is \href{{http://neuralnetworksanddeeplearning.com/}}{Nielsen's book}. It is an excellent read.
@@ -568,6 +576,11 @@ of code developers and contributors keeps increasing.
% ------------------- end of main content ---------------
% #ifdef PREAMBLE
Binary file not shown.
+26 -13
View File
@@ -125,7 +125,7 @@ Project 2 on Machine Learning, deadline November 5
% --- begin date ---
\begin{center}
Oct 12, 2018
Oct 16, 2018
\end{center}
% --- end date ---
@@ -341,7 +341,7 @@ called ordered states (the spins tend to point in one direction,
resulting in a net magnetic moment) while those above the critical
temperature are called disordered. Since a finite lattice like this
does not exhibit a clear sign of a phase transition we will mainly
stay with either orderer or disoredered phases. You could include the
stay with either orderer or disordered phases. You could include the
critical phase if you want.
@@ -352,13 +352,23 @@ and write your own code for doing logistic regression, see the lecture
notes on \href{{https://compphysics.github.io/MachineLearning/doc/pub/LogReg/html/LogReg-bs.html}}{logistic
regression}.
You should include either bootstrap or cross-validation in setting up
your model (as done in project 1) and compute the $R2$ score and the
mean-square error.
We will use both ordered and disordered states to train
the logistic regressor and, once the supervised training procedure is
complete, you should evaluate the performance of your classification model on
unseen ordered, disordered and possibly critical states.
In this case, to evaluate the model, we will use the so-called accuracy score
instead of the bootstrap or cross-validation as done in the standard linear regression part discussed in b). Examples of how to define the accuracy score can be found under the neural network slides, see for example the \href{{https://compphysics.github.io/MachineLearning/doc/pub/NeuralNet/html/._NeuralNet-bs047.html}}{slides here}.
To measure the performance of our network we evaluate how well it does
it data it has never seen before, i.e.~the test data. We measure the
performance of the network using the \emph{accuracy} score. The accuracy
is as you would expect just the number of images correctly labeled
divided by the total number of images. A perfect classifier will have
an accuracy score of $1$.
\[
\text{Accuracy} = \frac{\sum_{i=1}^n I(t_i = y_i)}{n} ,
\]
where $I$ is the indicator function, $1$ if $t_i = y_i$ and $0$
otherwise, where $t_i$ represents the target and $y_i$ the outputs.
@@ -370,8 +380,8 @@ Since we don't have so many data points, you may just code the
standard gradient descent with a given learning rate, or even attempt
to use the Newton-Raphson method. Alternatively, it may be useful for
the next part on neural networks to implement a stochastic gradient
descent. For all gradient methods, you can use \textbf{scikit-learn}'s toolbox for
optimization methods in order to test your own results.
descent with and without mini-batches. Stochastic gradient with mini-batches may give the best results. You could finally compare your code with the output from \textbf{scikit-learn}'s toolbox for
optimization methods applied to logistic regression.
The notebook of \href{{https://physics.bu.edu/~pankajm/ML-Notebooks/HTML/NB_CVII-logreg_ising.html}}{Mehta et al} is highly recommended in order to benchmark your code and results.
@@ -388,8 +398,6 @@ to use the codes in the above lecture slides as starting points.
Train your network and compare the results with those from your linear regression code.
You can test your results against a similar code using _scikit_learn_ (see the examples in the above lecture notes) or \textbf{tensorflow/keras}.
You should have the same elements as in the regression examples, including the $R2$ score, the MSE, and bootstrap or cross-validation.
You may also need to think of using another activation function than the standard logistic function.
A useful reference on the back progagation algorithm is \href{{http://neuralnetworksanddeeplearning.com/}}{Nielsen's book}. It is an excellent read.
@@ -538,6 +546,11 @@ of code developers and contributors keeps increasing.
% ------------------- end of main content ---------------
\end{document}
+27 -12
View File
@@ -225,7 +225,7 @@ called ordered states (the spins tend to point in one direction,
resulting in a net magnetic moment) while those above the critical
temperature are called disordered. Since a finite lattice like this
does not exhibit a clear sign of a phase transition we will mainly
stay with either orderer or disoredered phases. You could include the
stay with either orderer or disordered phases. You could include the
critical phase if you want.
@@ -236,13 +236,25 @@ and write your own code for doing logistic regression, see the lecture
notes on "logistic
regression":"https://compphysics.github.io/MachineLearning/doc/pub/LogReg/html/LogReg-bs.html".
You should include either bootstrap or cross-validation in setting up
your model (as done in project 1) and compute the $R2$ score and the
mean-square error.
We will use both ordered and disordered states to train
the logistic regressor and, once the supervised training procedure is
complete, you should evaluate the performance of your classification model on
unseen ordered, disordered and possibly critical states.
In this case, to evaluate the model, we will use the so-called accuracy score
instead of the bootstrap or cross-validation as done in the standard linear regression part discussed in b). Examples of how to define the accuracy score can be found under the neural network slides, see for example the "slides here":"https://compphysics.github.io/MachineLearning/doc/pub/NeuralNet/html/._NeuralNet-bs047.html".
To measure the performance of our network we evaluate how well it does
it data it has never seen before, i.e. the test data. We measure the
performance of the network using the *accuracy* score. The accuracy
is as you would expect just the number of images correctly labeled
divided by the total number of images. A perfect classifier will have
an accuracy score of $1$.
!bt
\[
\text{Accuracy} = \frac{\sum_{i=1}^n I(t_i = y_i)}{n} ,
\]
!et
where $I$ is the indicator function, $1$ if $t_i = y_i$ and $0$
otherwise, where $t_i$ represents the target and $y_i$ the outputs.
@@ -254,8 +266,8 @@ Since we don't have so many data points, you may just code the
standard gradient descent with a given learning rate, or even attempt
to use the Newton-Raphson method. Alternatively, it may be useful for
the next part on neural networks to implement a stochastic gradient
descent. For all gradient methods, you can use _scikit-learn_'s toolbox for
optimization methods in order to test your own results.
descent with and without mini-batches. Stochastic gradient with mini-batches may give the best results. You could finally compare your code with the output from _scikit-learn_'s toolbox for
optimization methods applied to logistic regression.
The notebook of "Mehta et al":"https://physics.bu.edu/~pankajm/ML-Notebooks/HTML/NB_CVII-logreg_ising.html" is highly recommended in order to benchmark your code and results.
@@ -273,8 +285,6 @@ to use the codes in the above lecture slides as starting points.
Train your network and compare the results with those from your linear regression code.
You can test your results against a similar code using _scikit_learn_ (see the examples in the above lecture notes) or _tensorflow/keras_.
You should have the same elements as in the regression examples, including the $R2$ score, the MSE, and bootstrap or cross-validation.
You may also need to think of using another activation function than the standard logistic function.
A useful reference on the back progagation algorithm is "Nielsen's book":"http://neuralnetworksanddeeplearning.com/". It is an excellent read.
@@ -400,3 +410,8 @@ of code developers and contributors keeps increasing.