Updating slides

This commit is contained in:
mhjensen
2019-09-18 22:11:35 +02:00
parent d0adb4b485
commit 26b3a6a4a6
176 changed files with 2460 additions and 4282 deletions
+40 -42
View File
@@ -6,6 +6,7 @@ Automatically generated HTML file from DocOnce source
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Data Analysis and Machine Learning: Neural networks, from the simple perceptron to deep learning and convolutional networks">
<title>Data Analysis and Machine Learning: Neural networks, from the simple perceptron to deep learning and convolutional networks</title>
@@ -265,7 +266,7 @@ MathJax.Hub.Config({
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Oct 19, 2018</h4></center> <!-- date -->
<center><h4>Sep 18, 2019</h4></center> <!-- date -->
<br>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
@@ -1019,7 +1020,7 @@ $$
and using the Hadamard product of two vectors we can write this as
$$
\hat{\delta}^L = f'(\hat{z}^L)\circ\frac{\partial {\cal C}}{\partial (\hat{a}L)}.
\hat{\delta}^L = f'(\hat{z}^L)\circ\frac{\partial {\cal C}}{\partial (\hat{a}^L)}.
$$
<p>
@@ -2040,17 +2041,16 @@ being realizations of this object with different hyperparameters. An implementat
<!-- 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">class</span> <span style="color: #0000FF; font-weight: bold">NeuralNetwork</span>:
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">__init__</span>(
<span style="color: #008000">self</span>,
X_data,
Y_data,
n_hidden_neurons<span style="color: #666666">=50</span>,
n_categories<span style="color: #666666">=10</span>,
epochs<span style="color: #666666">=10</span>,
batch_size<span style="color: #666666">=100</span>,
eta<span style="color: #666666">=0.1</span>,
lmbd<span style="color: #666666">=0.0</span>,
<span style="color: #008000">self</span>,
X_data,
Y_data,
n_hidden_neurons<span style="color: #666666">=50</span>,
n_categories<span style="color: #666666">=10</span>,
epochs<span style="color: #666666">=10</span>,
batch_size<span style="color: #666666">=100</span>,
eta<span style="color: #666666">=0.1</span>,
lmbd<span style="color: #666666">=0.0</span>):
):
<span style="color: #008000">self</span><span style="color: #666666">.</span>X_data_full <span style="color: #666666">=</span> X_data
<span style="color: #008000">self</span><span style="color: #666666">.</span>Y_data_full <span style="color: #666666">=</span> Y_data
@@ -2473,19 +2473,18 @@ X_train, X_test, Y_train, Y_test <span style="color: #666666">=</span> train_tes
<span style="color: #008000; font-weight: bold">class</span> <span style="color: #0000FF; font-weight: bold">NeuralNetworkTensorflow</span>:
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">__init__</span>(
<span style="color: #008000">self</span>,
X_train,
Y_train,
X_test,
Y_test,
n_neurons_layer1<span style="color: #666666">=100</span>,
n_neurons_layer2<span style="color: #666666">=50</span>,
n_categories<span style="color: #666666">=2</span>,
epochs<span style="color: #666666">=10</span>,
batch_size<span style="color: #666666">=100</span>,
eta<span style="color: #666666">=0.1</span>,
lmbd<span style="color: #666666">=0.0</span>,
):
<span style="color: #008000">self</span>,
X_train,
Y_train,
X_test,
Y_test,
n_neurons_layer1<span style="color: #666666">=100</span>,
n_neurons_layer2<span style="color: #666666">=50</span>,
n_categories<span style="color: #666666">=2</span>,
epochs<span style="color: #666666">=10</span>,
batch_size<span style="color: #666666">=100</span>,
eta<span style="color: #666666">=0.1</span>,
lmbd<span style="color: #666666">=0.0</span>):
<span style="color: #408080; font-style: italic"># keep track of number of steps</span>
<span style="color: #008000">self</span><span style="color: #666666">.</span>global_step <span style="color: #666666">=</span> tf<span style="color: #666666">.</span>Variable(<span style="color: #666666">0</span>, dtype<span style="color: #666666">=</span>tf<span style="color: #666666">.</span>int32, trainable<span style="color: #666666">=</span><span style="color: #008000">False</span>, name<span style="color: #666666">=</span><span style="color: #BA2121">&#39;global_step&#39;</span>)
@@ -3330,22 +3329,21 @@ We need to define model and architecture and choose cost function and optmizer.
class ConvolutionalNeuralNetworkTensorflow:
def __init__(
self,
X_train,
Y_train,
X_test,
Y_test,
n_filters=10,
n_neurons_connected=50,
n_categories=10,
receptive_field=3,
stride=1,
padding=1,
epochs=10,
batch_size=100,
eta=0.1,
lmbd=0.0,
):
self,
X_train,
Y_train,
X_test,
Y_test,
n_filters=10,
n_neurons_connected=50,
n_categories=10,
receptive_field=3,
stride=1,
padding=1,
epochs=10,
batch_size=100,
eta=0.1,
lmbd=0.0):
self.global_step = tf.Variable(0, dtype=tf.int32, trainable=False, name=&#39;global_step&#39;)
@@ -4306,7 +4304,7 @@ the solution minimizes the cost function.
<center style="font-size:80%">
<!-- copyright --> &copy; 1999-2018, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
<!-- copyright --> &copy; 1999-2019, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
</center>