Updating slides
This commit is contained in:
@@ -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>
|
||||
@@ -260,7 +261,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>
|
||||
@@ -1014,7 +1015,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>
|
||||
@@ -2035,17 +2036,16 @@ being realizations of this object with different hyperparameters. An implementat
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
|
||||
<div class="highlight" style="background: #eeeedd"><pre style="line-height: 125%"><span></span><span style="color: #8B008B; font-weight: bold">class</span> <span style="color: #008b45; font-weight: bold">NeuralNetwork</span>:
|
||||
<span style="color: #8B008B; font-weight: bold">def</span> <span style="color: #008b45">__init__</span>(
|
||||
<span style="color: #658b00">self</span>,
|
||||
X_data,
|
||||
Y_data,
|
||||
n_hidden_neurons=<span style="color: #B452CD">50</span>,
|
||||
n_categories=<span style="color: #B452CD">10</span>,
|
||||
epochs=<span style="color: #B452CD">10</span>,
|
||||
batch_size=<span style="color: #B452CD">100</span>,
|
||||
eta=<span style="color: #B452CD">0.1</span>,
|
||||
lmbd=<span style="color: #B452CD">0.0</span>,
|
||||
<span style="color: #658b00">self</span>,
|
||||
X_data,
|
||||
Y_data,
|
||||
n_hidden_neurons=<span style="color: #B452CD">50</span>,
|
||||
n_categories=<span style="color: #B452CD">10</span>,
|
||||
epochs=<span style="color: #B452CD">10</span>,
|
||||
batch_size=<span style="color: #B452CD">100</span>,
|
||||
eta=<span style="color: #B452CD">0.1</span>,
|
||||
lmbd=<span style="color: #B452CD">0.0</span>):
|
||||
|
||||
):
|
||||
<span style="color: #658b00">self</span>.X_data_full = X_data
|
||||
<span style="color: #658b00">self</span>.Y_data_full = Y_data
|
||||
|
||||
@@ -2468,19 +2468,18 @@ X_train, X_test, Y_train, Y_test = train_test_split(inputs, labels, train_size=t
|
||||
|
||||
<span style="color: #8B008B; font-weight: bold">class</span> <span style="color: #008b45; font-weight: bold">NeuralNetworkTensorflow</span>:
|
||||
<span style="color: #8B008B; font-weight: bold">def</span> <span style="color: #008b45">__init__</span>(
|
||||
<span style="color: #658b00">self</span>,
|
||||
X_train,
|
||||
Y_train,
|
||||
X_test,
|
||||
Y_test,
|
||||
n_neurons_layer1=<span style="color: #B452CD">100</span>,
|
||||
n_neurons_layer2=<span style="color: #B452CD">50</span>,
|
||||
n_categories=<span style="color: #B452CD">2</span>,
|
||||
epochs=<span style="color: #B452CD">10</span>,
|
||||
batch_size=<span style="color: #B452CD">100</span>,
|
||||
eta=<span style="color: #B452CD">0.1</span>,
|
||||
lmbd=<span style="color: #B452CD">0.0</span>,
|
||||
):
|
||||
<span style="color: #658b00">self</span>,
|
||||
X_train,
|
||||
Y_train,
|
||||
X_test,
|
||||
Y_test,
|
||||
n_neurons_layer1=<span style="color: #B452CD">100</span>,
|
||||
n_neurons_layer2=<span style="color: #B452CD">50</span>,
|
||||
n_categories=<span style="color: #B452CD">2</span>,
|
||||
epochs=<span style="color: #B452CD">10</span>,
|
||||
batch_size=<span style="color: #B452CD">100</span>,
|
||||
eta=<span style="color: #B452CD">0.1</span>,
|
||||
lmbd=<span style="color: #B452CD">0.0</span>):
|
||||
|
||||
<span style="color: #228B22"># keep track of number of steps</span>
|
||||
<span style="color: #658b00">self</span>.global_step = tf.Variable(<span style="color: #B452CD">0</span>, dtype=tf.int32, trainable=<span style="color: #658b00">False</span>, name=<span style="color: #CD5555">'global_step'</span>)
|
||||
@@ -3325,22 +3324,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='global_step')
|
||||
|
||||
@@ -4301,7 +4299,7 @@ the solution minimizes the cost function.
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright --> © 1999-2018, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
|
||||
<!-- copyright --> © 1999-2019, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
|
||||
</center>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user