upgrading neural nets with cans

This commit is contained in:
mhjensen
2018-10-19 05:04:15 +02:00
parent 98f03271a5
commit 2e478fadab
258 changed files with 60828 additions and 1199 deletions
+385
View File
@@ -0,0 +1,385 @@
<!--
Automatically generated HTML file from DocOnce source
(https://github.com/hplgit/doconce/)
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
<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>
<!-- Bootstrap style: bootstrap -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
content:"";
display:block;
height:50px; /* fixed header height for style bootstrap */
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Neural networks', 2, None, '___sec0'),
('Artificial neurons', 2, None, '___sec1'),
('Neural network types', 2, None, '___sec2'),
('Feed-forward neural networks', 2, None, '___sec3'),
('Convolutional Neural Network', 2, None, '___sec4'),
('Recurrent neural networks', 2, None, '___sec5'),
('Other types of networks', 2, None, '___sec6'),
('Multilayer perceptrons', 2, None, '___sec7'),
('Why multilayer perceptrons?', 2, None, '___sec8'),
('Mathematical model', 2, None, '___sec9'),
('Mathematical model', 2, None, '___sec10'),
('Mathematical model', 2, None, '___sec11'),
('Mathematical model', 2, None, '___sec12'),
('Mathematical model', 2, None, '___sec13'),
('Matrix-vector notation', 3, None, '___sec14'),
('Matrix-vector notation and activation', 3, None, '___sec15'),
('Activation functions', 3, None, '___sec16'),
('Activation functions, Logistic and Hyperbolic ones',
3,
None,
'___sec17'),
('Relevance', 3, None, '___sec18'),
('The multilayer perceptron (MLP)', 2, None, '___sec19'),
('From one to many layers, the universal approximation theorem',
2,
None,
'___sec20'),
('Deriving the back propagation code for a multilayer perceptron '
'model',
2,
None,
'___sec21'),
('Definitions', 2, None, '___sec22'),
('Derivatives and the chain rule', 2, None, '___sec23'),
('Derivative of the cost function', 2, None, '___sec24'),
('Bringing it together, first back propagation equation',
2,
None,
'___sec25'),
('Derivatives in terms of $z_j^L$', 2, None, '___sec26'),
('Bringing it together', 2, None, '___sec27'),
('Final back propagating equation', 2, None, '___sec28'),
('Setting up the Back propagation algorithm',
2,
None,
'___sec29'),
('Setting up a Multi-layer perceptron model for classification',
2,
None,
'___sec30'),
('Defining the cost function', 2, None, '___sec31'),
('Example: binary classification problem', 2, None, '___sec32'),
('The Softmax function', 2, None, '___sec33'),
('Developing a code for doing neural networks with back '
'propagation',
2,
None,
'___sec34'),
('Collect and pre-process data', 2, None, '___sec35'),
('Train and test datasets', 2, None, '___sec36'),
('Define model and architecture', 2, None, '___sec37'),
('Layers', 2, None, '___sec38'),
('Weights and biases', 2, None, '___sec39'),
('Feed-forward pass', 2, None, '___sec40'),
('Matrix multiplications', 2, None, '___sec41'),
('Choose cost function and optimizer', 2, None, '___sec42'),
('Optimizing the cost function', 2, None, '___sec43'),
('Regularization', 2, None, '___sec44'),
('Matrix multiplication', 2, None, '___sec45'),
('Improving performance', 2, None, '___sec46'),
('Full object-oriented implementation', 2, None, '___sec47'),
('Evaluate model performance on test data', 2, None, '___sec48'),
('Adjust hyperparameters', 2, None, '___sec49'),
('Visualization', 2, None, '___sec50'),
('scikit-learn implementation', 2, None, '___sec51'),
('Visualization', 2, None, '___sec52'),
('Building neural networks in Tensorflow and Keras',
2,
None,
'___sec53'),
('Tensorflow', 2, None, '___sec54'),
('Collect and pre-process data', 2, None, '___sec55'),
('Using TensorFlow backend', 2, None, '___sec56'),
('Optimizing and using gradient descent', 2, None, '___sec57'),
('Using Keras', 2, None, '___sec58'),
('Which activation function should I use?', 2, None, '___sec59'),
('Is the Logistic activation function (Sigmoid) our choice?',
2,
None,
'___sec60'),
('The derivative of the Logistic funtion', 2, None, '___sec61'),
('The RELU function family', 2, None, '___sec62'),
('Which activation function should we use?', 2, None, '___sec63'),
('A top-down perspective on Neural networks',
2,
None,
'___sec64'),
('Limitations of supervised learning with deep networks',
2,
None,
'___sec65'),
('Convolutional Neural Networks (recognizing images)',
2,
None,
'___sec66'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec67'),
('3D volumes of neurons', 2, None, '___sec68'),
('Layers used to build CNNs', 2, None, '___sec69'),
('Transforming images', 2, None, '___sec70'),
('CNNs in brief', 2, None, '___sec71'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec72'),
('Setting it up', 2, None, '___sec73'),
('The MNIST dataset again', 2, None, '___sec74'),
('Strong correlations', 2, None, '___sec75'),
('Layers of a CNN', 2, None, '___sec76'),
('Systematic reduction', 2, None, '___sec77'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec78'),
('Importing Keras and Tensorflow', 2, None, '___sec79'),
('Using TensorFlow backend', 2, None, '___sec80'),
('Train the model', 2, None, '___sec81'),
('Visualizing the results', 2, None, '___sec82'),
('Running with Keras', 2, None, '___sec83'),
('Final part', 2, None, '___sec84'),
('Final visualization', 2, None, '___sec85'),
('Fun links', 2, None, '___sec86')]}
end of tocinfo -->
<body>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
equationNumbers: { autoNumber: "none" },
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
}
});
</script>
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="NeuralNet-bs.html">Data Analysis and Machine Learning: Neural networks, from the simple perceptron to deep learning and convolutional networks</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._NeuralNet-bs001.html#___sec0" style="font-size: 80%;"><b>Neural networks</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs002.html#___sec1" style="font-size: 80%;"><b>Artificial neurons</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs003.html#___sec2" style="font-size: 80%;"><b>Neural network types</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs004.html#___sec3" style="font-size: 80%;"><b>Feed-forward neural networks</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs005.html#___sec4" style="font-size: 80%;"><b>Convolutional Neural Network</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs006.html#___sec5" style="font-size: 80%;"><b>Recurrent neural networks</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs007.html#___sec6" style="font-size: 80%;"><b>Other types of networks</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs008.html#___sec7" style="font-size: 80%;"><b>Multilayer perceptrons</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs009.html#___sec8" style="font-size: 80%;"><b>Why multilayer perceptrons?</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs010.html#___sec9" style="font-size: 80%;"><b>Mathematical model</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs011.html#___sec10" style="font-size: 80%;"><b>Mathematical model</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs012.html#___sec11" style="font-size: 80%;"><b>Mathematical model</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs013.html#___sec12" style="font-size: 80%;"><b>Mathematical model</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs014.html#___sec13" style="font-size: 80%;"><b>Mathematical model</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs015.html#___sec14" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Matrix-vector notation</a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs016.html#___sec15" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Matrix-vector notation and activation</a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs017.html#___sec16" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Activation functions</a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs018.html#___sec17" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Activation functions, Logistic and Hyperbolic ones</a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs019.html#___sec18" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Relevance</a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs020.html#___sec19" style="font-size: 80%;"><b>The multilayer perceptron (MLP)</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs021.html#___sec20" style="font-size: 80%;"><b>From one to many layers, the universal approximation theorem</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs022.html#___sec21" style="font-size: 80%;"><b>Deriving the back propagation code for a multilayer perceptron model</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs023.html#___sec22" style="font-size: 80%;"><b>Definitions</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs024.html#___sec23" style="font-size: 80%;"><b>Derivatives and the chain rule</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs025.html#___sec24" style="font-size: 80%;"><b>Derivative of the cost function</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs026.html#___sec25" style="font-size: 80%;"><b>Bringing it together, first back propagation equation</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs027.html#___sec26" style="font-size: 80%;"><b>Derivatives in terms of \( z_j^L \)</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs028.html#___sec27" style="font-size: 80%;"><b>Bringing it together</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs029.html#___sec28" style="font-size: 80%;"><b>Final back propagating equation</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs030.html#___sec29" style="font-size: 80%;"><b>Setting up the Back propagation algorithm</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs031.html#___sec30" style="font-size: 80%;"><b>Setting up a Multi-layer perceptron model for classification</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs032.html#___sec31" style="font-size: 80%;"><b>Defining the cost function</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs033.html#___sec32" style="font-size: 80%;"><b>Example: binary classification problem</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs034.html#___sec33" style="font-size: 80%;"><b>The Softmax function</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs035.html#___sec34" style="font-size: 80%;"><b>Developing a code for doing neural networks with back propagation</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs036.html#___sec35" style="font-size: 80%;"><b>Collect and pre-process data</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs037.html#___sec36" style="font-size: 80%;"><b>Train and test datasets</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs038.html#___sec37" style="font-size: 80%;"><b>Define model and architecture</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs039.html#___sec38" style="font-size: 80%;"><b>Layers</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs040.html#___sec39" style="font-size: 80%;"><b>Weights and biases</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs041.html#___sec40" style="font-size: 80%;"><b>Feed-forward pass</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs042.html#___sec41" style="font-size: 80%;"><b>Matrix multiplications</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs043.html#___sec42" style="font-size: 80%;"><b>Choose cost function and optimizer</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs044.html#___sec43" style="font-size: 80%;"><b>Optimizing the cost function</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs045.html#___sec44" style="font-size: 80%;"><b>Regularization</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs046.html#___sec45" style="font-size: 80%;"><b>Matrix multiplication</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs047.html#___sec46" style="font-size: 80%;"><b>Improving performance</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs048.html#___sec47" style="font-size: 80%;"><b>Full object-oriented implementation</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs049.html#___sec48" style="font-size: 80%;"><b>Evaluate model performance on test data</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs050.html#___sec49" style="font-size: 80%;"><b>Adjust hyperparameters</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs051.html#___sec50" style="font-size: 80%;"><b>Visualization</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs052.html#___sec51" style="font-size: 80%;"><b>scikit-learn implementation</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs053.html#___sec52" style="font-size: 80%;"><b>Visualization</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs054.html#___sec53" style="font-size: 80%;"><b>Building neural networks in Tensorflow and Keras</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs055.html#___sec54" style="font-size: 80%;"><b>Tensorflow</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs056.html#___sec55" style="font-size: 80%;"><b>Collect and pre-process data</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs057.html#___sec56" style="font-size: 80%;"><b>Using TensorFlow backend</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs058.html#___sec57" style="font-size: 80%;"><b>Optimizing and using gradient descent</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs059.html#___sec58" style="font-size: 80%;"><b>Using Keras</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs060.html#___sec59" style="font-size: 80%;"><b>Which activation function should I use?</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs061.html#___sec60" style="font-size: 80%;"><b>Is the Logistic activation function (Sigmoid) our choice?</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs062.html#___sec61" style="font-size: 80%;"><b>The derivative of the Logistic funtion</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs063.html#___sec62" style="font-size: 80%;"><b>The RELU function family</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs064.html#___sec63" style="font-size: 80%;"><b>Which activation function should we use?</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs065.html#___sec64" style="font-size: 80%;"><b>A top-down perspective on Neural networks</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs066.html#___sec65" style="font-size: 80%;"><b>Limitations of supervised learning with deep networks</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs067.html#___sec66" style="font-size: 80%;"><b>Convolutional Neural Networks (recognizing images)</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs068.html#___sec67" style="font-size: 80%;"><b>Regular NNs dont scale well to full images</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs069.html#___sec68" style="font-size: 80%;"><b>3D volumes of neurons</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs070.html#___sec69" style="font-size: 80%;"><b>Layers used to build CNNs</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs071.html#___sec70" style="font-size: 80%;"><b>Transforming images</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs072.html#___sec71" style="font-size: 80%;"><b>CNNs in brief</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs073.html#___sec72" style="font-size: 80%;"><b>CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs074.html#___sec73" style="font-size: 80%;"><b>Setting it up</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs075.html#___sec74" style="font-size: 80%;"><b>The MNIST dataset again</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs076.html#___sec75" style="font-size: 80%;"><b>Strong correlations</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs077.html#___sec76" style="font-size: 80%;"><b>Layers of a CNN</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs078.html#___sec77" style="font-size: 80%;"><b>Systematic reduction</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs079.html#___sec78" style="font-size: 80%;"><b>Prerequisites: Collect and pre-process data</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs080.html#___sec79" style="font-size: 80%;"><b>Importing Keras and Tensorflow</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs081.html#___sec80" style="font-size: 80%;"><b>Using TensorFlow backend</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs082.html#___sec81" style="font-size: 80%;"><b>Train the model</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs083.html#___sec82" style="font-size: 80%;"><b>Visualizing the results</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs084.html#___sec83" style="font-size: 80%;"><b>Running with Keras</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs085.html#___sec84" style="font-size: 80%;"><b>Final part</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs086.html#___sec85" style="font-size: 80%;"><b>Final visualization</b></a></li>
<!-- navigation toc: --> <li><a href="._NeuralNet-bs087.html#___sec86" style="font-size: 80%;"><b>Fun links</b></a></li>
</ul>
</li>
</ul>
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0000"></a>
<!-- ------------------- main content ---------------------- -->
<div class="jumbotron">
<center><h1>Data Analysis and Machine Learning: Neural networks, from the simple perceptron to deep learning and convolutional networks</h1></center> <!-- document title -->
<p>
<!-- author(s): Morten Hjorth-Jensen -->
<center>
<b>Morten Hjorth-Jensen</b> [1, 2]
</center>
<p>
<!-- institution(s) -->
<center>[1] <b>Department of Physics, University of Oslo</b></center>
<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 -->
<br>
<p>
<p><a href="._NeuralNet-bs001.html" class="btn btn-primary btn-lg">Read &raquo;</a></p>
</div> <!-- end jumbotron -->
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
<li class="active"><a href="._NeuralNet-bs000.html">1</a></li>
<li><a href="._NeuralNet-bs001.html">2</a></li>
<li><a href="._NeuralNet-bs002.html">3</a></li>
<li><a href="._NeuralNet-bs003.html">4</a></li>
<li><a href="._NeuralNet-bs004.html">5</a></li>
<li><a href="._NeuralNet-bs005.html">6</a></li>
<li><a href="._NeuralNet-bs006.html">7</a></li>
<li><a href="._NeuralNet-bs007.html">8</a></li>
<li><a href="._NeuralNet-bs008.html">9</a></li>
<li><a href="._NeuralNet-bs009.html">10</a></li>
<li><a href="">...</a></li>
<li><a href="._NeuralNet-bs087.html">88</a></li>
<li><a href="._NeuralNet-bs001.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="http://..."><img width="250" align=right src="http://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright --> &copy; 1999-2018, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
</center>
</body>
</html>
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+478 -111
View File
@@ -2487,10 +2487,12 @@ Neural Network would have $32\times 32\times 3 = 3072$ weights. This amount stil
seems manageable, but clearly this fully-connected structure does not
scale to larger images. For example, an image of more respectable
size, say $200\times 200\times 3$, would lead to neurons that have
$200\times 200\times 3 = 120,000$ weights. Moreover, we would almost certainly want to have
several such neurons, so the parameters would add up quickly! Clearly,
$200\times 200\times 3 = 120,000$ weights.
We could have
several such neurons, and the parameters would add up quickly! Clearly,
this full connectivity is wasteful and the huge number of parameters
would quickly lead to overfitting.
would quickly lead to possible overfitting.
FIGURE: [figslides/nn.jpeg, width=500 frac=0.6] A regular 3-layer Neural Network.
@@ -2538,13 +2540,27 @@ will stack these layers to form a full CNN architecture.
A simple CNN for image classification could have the architecture:
* INPUT ($32\times 32 \times 3$) will hold the raw pixel values of the image, in this case an image of width 32, height 32, and with three color channels R,G,B.
* CONV layer will compute the output of neurons that are connected to local regions in the input, each computing a dot product between their weights and a small region they are connected to in the input volume. This may result in volume such as $[32\times 32\times 12]$ if we decided to use 12 filters.
* RELU layer will apply an elementwise activation function, such as the $max(0,x)$ thresholding at zero. This leaves the size of the volume unchanged ($[32\times 32\times 12]$).
* POOL layer will perform a downsampling operation along the spatial dimensions (width, height), resulting in volume such as $[16\times 16\times 12]$.
* FC (i.e. fully-connected) layer will compute the class scores, resulting in volume of size $[1\times 1\times 10]$, where each of the 10 numbers correspond to a class score, such as among the 10 categories of the MNIST images we considered above . As with ordinary Neural Networks and as the name implies, each neuron in this layer will be connected to all the numbers in the previous volume.
* _INPUT_ ($32\times 32 \times 3$) will hold the raw pixel values of the image, in this case an image of width 32, height 32, and with three color channels R,G,B.
* _CONV_ (convolutional )layer will compute the output of neurons that are connected to local regions in the input, each computing a dot product between their weights and a small region they are connected to in the input volume. This may result in volume such as $[32\times 32\times 12]$ if we decided to use 12 filters.
* _RELU_ layer will apply an elementwise activation function, such as the $max(0,x)$ thresholding at zero. This leaves the size of the volume unchanged ($[32\times 32\times 12]$).
* _POOL_ (pooling) layer will perform a downsampling operation along the spatial dimensions (width, height), resulting in volume such as $[16\times 16\times 12]$.
* _FC_ (i.e. fully-connected) layer will compute the class scores, resulting in volume of size $[1\times 1\times 10]$, where each of the 10 numbers correspond to a class score, such as among the 10 categories of the MNIST images we considered above . As with ordinary Neural Networks and as the name implies, each neuron in this layer will be connected to all the numbers in the previous volume.
In this way, CNNs transform the original image layer by layer from the original pixel values to the final class scores. Note that some layers contain parameters and other dont. In particular, the CONV/FC layers perform transformations that are a function of not only the activations in the input volume, but also of the parameters (the weights and biases of the neurons). On the other hand, the RELU/POOL layers will implement a fixed function. The parameters in the CONV/FC layers will be trained with gradient descent so that the class scores that the CNN computes are consistent with the labels in the training set for each image.
!split
===== Transforming images =====
CNNs transform the original image layer by layer from the original
pixel values to the final class scores.
Observe that some layers contain
parameters and other dont. In particular, the CNN layers perform
transformations that are a function of not only the activations in the
input volume, but also of the parameters (the weights and biases of
the neurons). On the other hand, the RELU/POOL layers will implement a
fixed function. The parameters in the CONV/FC layers will be trained
with gradient descent so that the class scores that the CNN computes
are consistent with the labels in the training set for each image.
!split
@@ -2558,126 +2574,477 @@ In summary:
* Each Layer may or may not have parameters (e.g. CONV/FC do, RELU/POOL dont)
* Each Layer may or may not have additional hyperparameters (e.g. CONV/FC/POOL do, RELU doesnt)
For more material on convolutional networks, we strongly recommend
the course
"IN5400 Machine Learning for Image Analysis":"https://www.uio.no/studier/emner/matnat/ifi/IN5400/index-eng.html"
and the slides of "CS231":"http://cs231n.github.io/convolutional-networks/" which is taught at Stanford University (consistently ranked as one of the top computer science programs in the world). "Michael Nielsen's book is a must read, in particular chapter 6 which deals with CNNs":"http://neuralnetworksanddeeplearning.com/chap6.html".
!split
===== CNNs in more detail =====
===== CNNs in more detail, building convolutional neural networks in Tensorflow and Keras =====
More material to come with examples.
As discussed above, CNNs are neural networks built from the assumption that the inputs
to the network are 2D images. This is important because the number of features or pixels in images
grows very fast with the image size, and an enormous number of weights and biases are needed in order to build an accurate network.
As before, we still have our input, a hidden layer and an output. What's novel about convolutional networks
are the _convolutional_ and _pooling_ layers stacked in pairs between the input and the hidden layer.
In addition, the data is no longer represented as a 2D feature matrix, instead each input is a number of 2D
matrices, typically 1 for each color dimension (Red, Green, Blue).
!split
===== Setting it up =====
It means that to represent the entire
dataset of images, we require a 4D matrix or _tensor_. This tensor has the dimensions:
!bt
\[
(n_{inputs},\, n_{pixels, width},\, n_{pixels, height},\, depth) .
\]
!et
!split
===== The MNIST dataset again =====
The MNIST dataset consists of grayscale images with a pixel size of
$28\times 28$, meaning we require $28 \times 28 = 724$ weights to each
neuron in the first hidden layer.
If we were to analyze images of size $128\times 128$ we would require
$128 \times 128 = 16384$ weights to each neuron. Even worse if we were
dealing with color images, as most images are, we have an image matrix
of size $128\times 128$ for each color dimension (Red, Green, Blue),
meaning 3 times the number of weights $= 49152$ are required for every
single neuron in the first hidden layer.
!split
===== Strong correlations =====
Images typically have strong local correlations, meaning that a small
part of the image varies little from its neighboring regions. If for
example we have an image of a blue car, we can roughly assume that a
small blue part of the image is surrounded by other blue regions.
Therefore, instead of connecting every single pixel to a neuron in the
first hidden layer, as we have previously done with deep neural
networks, we can instead connect each neuron to a small part of the
image (in all 3 RGB depth dimensions). The size of each small area is
fixed, and known as a "receptive":"https://en.wikipedia.org/wiki/Receptive_field".
!split
===== Layers of a CNN =====
The layers of a convolutional neural network arrange neurons in 3D: width, height and depth.
The input image is typically a square matrix of depth 3.
A _convolution_ is performed on the image which outputs
a 3D volume of neurons. The weights to the input are arranged in a number of 2D matrices, known as _filters_.
In particular, for each pixel in the input image, we encoded the
pixel's intensity as the value for a corresponding neuron in the input
layer. For the 28×28 pixel images we've been using, this means our
network has 784 (=28×28) input neurons. We then trained the network's
weights and biases so that the network's output would - we hope! -
correctly identify the input image: '0', '1', '2', ..., '8', or '9'.
Each filter slides along the input image, taking the dot product
between each small part of the image and the filter, in all depth
dimensions. This is then passed through a non-linear function,
typically the _Rectified Linear (ReLu)_ function, which serves as the
activation of the neurons in the first convolutional layer. This is
further passed through a _pooling layer_, which reduces the size of the
convolutional layer, e.g. by taking the maximum or average across some
small regions, and this serves as input to the next convolutional
layer.
Our earlier networks work pretty well: we've obtained a classification
accuracy better than 98 percent, using training and test data from the
MNIST handwritten digit data set. But upon reflection, it's strange to
use networks with fully-connected layers to classify images. The
reason is that such a network architecture does not take into account
the spatial structure of the images. For instance, it treats input
pixels which are far apart and close together on exactly the same
footing. Such concepts of spatial structure must instead be inferred
from the training data. But what if, instead of starting with a
network architecture which is tabula rasa, we used an architecture
which tries to take advantage of the spatial structure? In this
section I describe convolutional neural networks* *The origins of
convolutional neural networks go back to the 1970s. But the seminal
paper establishing the modern subject of convolutional networks was a
1998 paper, "Gradient-based learning applied to document recognition",
by Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. LeCun
has since made an interesting remark on the terminology for
convolutional nets: "The [biological] neural inspiration in models
like convolutional nets is very tenuous. That's why I call them
'convolutional nets' not 'convolutional neural nets', and why we call
the nodes 'units' and not 'neurons' ". Despite this remark,
convolutional nets use many of the same ideas as the neural networks
we've studied up to now: ideas such as backpropagation, gradient
descent, regularization, non-linear activation functions, and so
on. And so we will follow common practice, and consider them a type of
neural network. I will use the terms "convolutional neural network"
and "convolutional net(work)" interchangeably. I will also use the
terms "[artificial] neuron" and "unit" interchangeably.. These
networks use a special architecture which is particularly well-adapted
to classify images. Using this architecture makes convolutional
networks fast to train. This, in turn, helps us train deep, many-layer
networks, which are very good at classifying images. Today, deep
convolutional networks or some close variant are used in most neural
networks for image recognition.
!split
===== Systematic reduction =====
Convolutional neural networks use three basic ideas: local receptive fields, shared weights, and pooling.
By systematically reducing the size of the input volume, through
convolution and pooling, the network should create representations of
small parts of the input, and then from them assemble representations
of larger areas. The final pooling layer is flattened to serve as
input to a hidden layer, such that each neuron in the final pooling
layer is connected to every single neuron in the hidden layer. This
then serves as input to the output layer, e.g. a softmax output for
classification.
!split
===== Prerequisites: Collect and pre-process data =====
!bc pycod
# import necessary packages
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
Local receptive fields: In the fully-connected layers shown earlier, the inputs were depicted as a vertical line of neurons. In a convolutional net, it'll help to think instead of the inputs as a 28×28 square of neurons, whose values correspond to the 28×28 pixel intensities we're using as inputs:
# ensure the same random numbers appear every time
np.random.seed(0)
# display images in notebook
%matplotlib inline
plt.rcParams['figure.figsize'] = (12,12)
As per usual, we'll connect the input pixels to a layer of hidden neurons. But we won't connect every input pixel to every hidden neuron. Instead, we only make connections in small, localized regions of the input image.
# download MNIST dataset
digits = datasets.load_digits()
To be more precise, each neuron in the first hidden layer will be connected to a small region of the input neurons, say, for example, a 5×5 region, corresponding to 25 input pixels. So, for a particular hidden neuron, we might have connections that look like this:
# define inputs and labels
inputs = digits.images
labels = digits.target
# RGB images have a depth of 3
# our images are grayscale so they should have a depth of 1
inputs = inputs[:,:,:,np.newaxis]
print("inputs = (n_inputs, pixel_width, pixel_height, depth) = " + str(inputs.shape))
print("labels = (n_inputs) = " + str(labels.shape))
That region in the input image is called the local receptive field for the hidden neuron. It's a little window on the input pixels. Each connection learns a weight. And the hidden neuron learns an overall bias as well. You can think of that particular hidden neuron as learning to analyze its particular local receptive field.
# choose some random images to display
n_inputs = len(inputs)
indices = np.arange(n_inputs)
random_indices = np.random.choice(indices, size=5)
We then slide the local receptive field across the entire input image. For each local receptive field, there is a different hidden neuron in the first hidden layer. To illustrate this concretely, let's start with a local receptive field in the top-left corner:
for i, image in enumerate(digits.images[random_indices]):
plt.subplot(1, 5, i+1)
plt.axis('off')
plt.imshow(image, cmap=plt.cm.gray_r, interpolation='nearest')
plt.title("Label: %d" % digits.target[random_indices[i]])
plt.show()
!ec
Then we slide the local receptive field over by one pixel to the right (i.e., by one neuron), to connect to a second hidden neuron:
!split
===== Importing Keras and Tensorflow =====
!bc pycod
from keras.utils import to_categorical
from sklearn.model_selection import train_test_split
# representation of labels
labels = to_categorical(labels)
# split into train and test data
# one-liner from scikit-learn library
train_size = 0.8
test_size = 1 - train_size
X_train, X_test, Y_train, Y_test = train_test_split(inputs, labels, train_size=train_size,
test_size=test_size)
!ec
!split
===== Using TensorFlow backend =====
We need to define model and architecture and choose cost function and optmizer.
!bc pycid
import tensorflow as tf
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.global_step = tf.Variable(0, dtype=tf.int32, trainable=False, name='global_step')
self.X_train = X_train
self.Y_train = Y_train
self.X_test = X_test
self.Y_test = Y_test
self.n_inputs, self.input_width, self.input_height, self.depth = X_train.shape
self.n_filters = n_filters
self.n_downsampled = int(self.input_width*self.input_height*n_filters / 4)
self.n_neurons_connected = n_neurons_connected
self.n_categories = n_categories
self.receptive_field = receptive_field
self.stride = stride
self.strides = [stride, stride, stride, stride]
self.padding = padding
self.epochs = epochs
self.batch_size = batch_size
self.iterations = self.n_inputs // self.batch_size
self.eta = eta
self.lmbd = lmbd
self.create_placeholders()
self.create_CNN()
self.create_loss()
self.create_optimiser()
self.create_accuracy()
def create_placeholders(self):
with tf.name_scope('data'):
self.X = tf.placeholder(tf.float32, shape=(None, self.input_width, self.input_height, self.depth), name='X_data')
self.Y = tf.placeholder(tf.float32, shape=(None, self.n_categories), name='Y_data')
def create_CNN(self):
with tf.name_scope('CNN'):
# Convolutional layer
self.W_conv = self.weight_variable([self.receptive_field, self.receptive_field, self.depth, self.n_filters], name='conv', dtype=tf.float32)
b_conv = self.weight_variable([self.n_filters], name='conv', dtype=tf.float32)
z_conv = tf.nn.conv2d(self.X, self.W_conv, self.strides, padding='SAME', name='conv') + b_conv
a_conv = tf.nn.relu(z_conv)
# 2x2 max pooling
a_pool = tf.nn.max_pool(a_conv, [1, 2, 2, 1], [1, 2, 2, 1], padding='SAME', name='pool')
# Fully connected layer
a_pool_flat = tf.reshape(a_pool, [-1, self.n_downsampled])
self.W_fc = self.weight_variable([self.n_downsampled, self.n_neurons_connected], name='fc', dtype=tf.float32)
b_fc = self.bias_variable([self.n_neurons_connected], name='fc', dtype=tf.float32)
a_fc = tf.nn.relu(tf.matmul(a_pool_flat, self.W_fc) + b_fc)
# Output layer
self.W_out = self.weight_variable([self.n_neurons_connected, self.n_categories], name='out', dtype=tf.float32)
b_out = self.bias_variable([self.n_categories], name='out', dtype=tf.float32)
self.z_out = tf.matmul(a_fc, self.W_out) + b_out
def create_loss(self):
with tf.name_scope('loss'):
softmax_loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(labels=self.Y, logits=self.z_out))
regularizer_loss_conv = tf.nn.l2_loss(self.W_conv)
regularizer_loss_fc = tf.nn.l2_loss(self.W_fc)
regularizer_loss_out = tf.nn.l2_loss(self.W_out)
regularizer_loss = self.lmbd*(regularizer_loss_conv + regularizer_loss_fc + regularizer_loss_out)
self.loss = softmax_loss + regularizer_loss
def create_accuracy(self):
with tf.name_scope('accuracy'):
probabilities = tf.nn.softmax(self.z_out)
predictions = tf.argmax(probabilities, 1)
labels = tf.argmax(self.Y, 1)
correct_predictions = tf.equal(predictions, labels)
correct_predictions = tf.cast(correct_predictions, tf.float32)
self.accuracy = tf.reduce_mean(correct_predictions)
def create_optimiser(self):
with tf.name_scope('optimizer'):
self.optimizer = tf.train.GradientDescentOptimizer(learning_rate=self.eta).minimize(self.loss, global_step=self.global_step)
def weight_variable(self, shape, name='', dtype=tf.float32):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial, name=name, dtype=dtype)
def bias_variable(self, shape, name='', dtype=tf.float32):
initial = tf.constant(0.1, shape=shape)
return tf.Variable(initial, name=name, dtype=dtype)
def fit(self):
data_indices = np.arange(self.n_inputs)
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for i in range(self.epochs):
for j in range(self.iterations):
chosen_datapoints = np.random.choice(data_indices, size=self.batch_size, replace=False)
batch_X, batch_Y = self.X_train[chosen_datapoints], self.Y_train[chosen_datapoints]
sess.run([CNN.loss, CNN.optimizer],
feed_dict={CNN.X: batch_X,
CNN.Y: batch_Y})
accuracy = sess.run(CNN.accuracy,
feed_dict={CNN.X: batch_X,
CNN.Y: batch_Y})
step = sess.run(CNN.global_step)
self.train_loss, self.train_accuracy = sess.run([CNN.loss, CNN.accuracy],
feed_dict={CNN.X: self.X_train,
CNN.Y: self.Y_train})
self.test_loss, self.test_accuracy = sess.run([CNN.loss, CNN.accuracy],
feed_dict={CNN.X: self.X_test,
CNN.Y: self.Y_test})
!ec
!split
===== Train the model =====
We need now to train the model, evaluate it and test its performance on test data, and eventually include hyperparameters.
!bc pycod
epochs = 100
batch_size = 100
n_filters = 10
n_neurons_connected = 50
n_categories = 10
eta_vals = np.logspace(-5, 1, 7)
lmbd_vals = np.logspace(-5, 1, 7)
CNN_tf = np.zeros((len(eta_vals), len(lmbd_vals)), dtype=object)
for i, eta in enumerate(eta_vals):
for j, lmbd in enumerate(lmbd_vals):
CNN = ConvolutionalNeuralNetworkTensorflow(X_train, Y_train, X_test, Y_test,
n_filters=n_filters, n_neurons_connected=n_neurons_connected,
n_categories=n_categories, epochs=epochs, batch_size=batch_size,
eta=eta, lmbd=lmbd)
CNN.fit()
print("Learning rate = ", eta)
print("Lambda = ", lmbd)
print("Test accuracy: %.3f" % CNN.test_accuracy)
print()
CNN_tf[i][j] = CNN
!ec
!split
===== Visualizing the results =====
!bc pycod
# visual representation of grid search
# uses seaborn heatmap, could probably do this in matplotlib
import seaborn as sns
sns.set()
train_accuracy = np.zeros((len(eta_vals), len(lmbd_vals)))
test_accuracy = np.zeros((len(eta_vals), len(lmbd_vals)))
for i in range(len(eta_vals)):
for j in range(len(lmbd_vals)):
CNN = CNN_tf[i][j]
train_accuracy[i][j] = CNN.train_accuracy
test_accuracy[i][j] = CNN.test_accuracy
fig, ax = plt.subplots(figsize = (10, 10))
sns.heatmap(train_accuracy, annot=True, ax=ax, cmap="viridis")
ax.set_title("Training Accuracy")
ax.set_ylabel("$\eta$")
ax.set_xlabel("$\lambda$")
plt.show()
fig, ax = plt.subplots(figsize = (10, 10))
sns.heatmap(test_accuracy, annot=True, ax=ax, cmap="viridis")
ax.set_title("Test Accuracy")
ax.set_ylabel("$\eta$")
ax.set_xlabel("$\lambda$")
plt.show()
!ec
!split
===== Running with Keras =====
!bc pycod
from keras.models import Sequential
from keras.layers.convolutional import Conv2D
from keras.layers.convolutional import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
from keras.regularizers import l2
from keras.optimizers import SGD
def create_convolutional_neural_network_keras(input_shape, receptive_field,
n_filters, n_neurons_connected, n_categories,
eta, lmbd):
model = Sequential()
model.add(Conv2D(n_filters, (receptive_field, receptive_field), input_shape=input_shape, padding='same',
activation='relu', kernel_regularizer=l2(lmbd)))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(n_neurons_connected, activation='relu', kernel_regularizer=l2(lmbd)))
model.add(Dense(n_categories, activation='softmax', kernel_regularizer=l2(lmbd)))
sgd = SGD(lr=eta)
model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy'])
return model
epochs = 100
batch_size = 100
input_shape = X_train.shape[1:4]
receptive_field = 3
n_filters = 10
n_neurons_connected = 50
n_categories = 10
eta_vals = np.logspace(-5, 1, 7)
lmbd_vals = np.logspace(-5, 1, 7)
!ec
!split
===== Final part =====
!bc pycod
CNN_keras = np.zeros((len(eta_vals), len(lmbd_vals)), dtype=object)
for i, eta in enumerate(eta_vals):
for j, lmbd in enumerate(lmbd_vals):
CNN = create_convolutional_neural_network_keras(input_shape, receptive_field,
n_filters, n_neurons_connected, n_categories,
eta, lmbd)
CNN.fit(X_train, Y_train, epochs=epochs, batch_size=batch_size, verbose=0)
scores = CNN.evaluate(X_test, Y_test)
CNN_keras[i][j] = CNN
print("Learning rate = ", eta)
print("Lambda = ", lmbd)
print("Test accuracy: %.3f" % scores[1])
print()
!ec
!split
===== Final visualization =====
!bc
# visual representation of grid search
# uses seaborn heatmap, could probably do this in matplotlib
import seaborn as sns
sns.set()
train_accuracy = np.zeros((len(eta_vals), len(lmbd_vals)))
test_accuracy = np.zeros((len(eta_vals), len(lmbd_vals)))
for i in range(len(eta_vals)):
for j in range(len(lmbd_vals)):
CNN = CNN_keras[i][j]
train_accuracy[i][j] = CNN.evaluate(X_train, Y_train)[1]
test_accuracy[i][j] = CNN.evaluate(X_test, Y_test)[1]
fig, ax = plt.subplots(figsize = (10, 10))
sns.heatmap(train_accuracy, annot=True, ax=ax, cmap="viridis")
ax.set_title("Training Accuracy")
ax.set_ylabel("$\eta$")
ax.set_xlabel("$\lambda$")
plt.show()
fig, ax = plt.subplots(figsize = (10, 10))
sns.heatmap(test_accuracy, annot=True, ax=ax, cmap="viridis")
ax.set_title("Test Accuracy")
ax.set_ylabel("$\eta$")
ax.set_xlabel("$\lambda$")
plt.show()
!ec
!split
===== Fun links =====
o "Self-Driving cars using a convolutional neural network":"https://arxiv.org/abs/1604.07316"
o "Abstract art using convolutional neural networks":"https://deepdreamgenerator.com/"
And so on, building up the first hidden layer. Note that if we have a 28×28 input image, and 5×5 local receptive fields, then there will be 24×24 neurons in the hidden layer. This is because we can only move the local receptive field 23 neurons across (or 23 neurons down), before colliding with the right-hand side (or bottom) of the input image.
I've shown the local receptive field being moved by one pixel at a time. In fact, sometimes a different stride length is used. For instance, we might move the local receptive field 2 pixels to the right (or down), in which case we'd say a stride length of 2 is used. In this chapter we'll mostly stick with stride length 1, but it's worth knowing that people sometimes experiment with different stride lengths* *As was done in earlier chapters, if we're interested in trying different stride lengths then we can use validation data to pick out the stride length which gives the best performance. For more details, see the earlier discussion of how to choose hyper-parameters in a neural network. The same approach may also be used to choose the size of the local receptive field - there is, of course, nothing special about using a 5×5 local receptive field. In general, larger local receptive fields tend to be helpful when the input images are significantly larger than the 28×28 pixel MNIST images..
Shared weights and biases: I've said that each hidden neuron has a bias and 5×5 weights connected to its local receptive field. What I did not yet mention is that we're going to use the same weights and bias for each of the 24×24 hidden neurons. In other words, for the j,kth hidden neuron, the output is:
σ(b+∑l=04∑m=04wl,maj+l,k+m).(125)
Here, σ is the neural activation function - perhaps the sigmoid function we used in earlier chapters. b is the shared value for the bias. wl,m is a 5×5 array of shared weights. And, finally, we use ax,y to denote the input activation at position x,y.
This means that all the neurons in the first hidden layer detect exactly the same feature* *I haven't precisely defined the notion of a feature. Informally, think of the feature detected by a hidden neuron as the kind of input pattern that will cause the neuron to activate: it might be an edge in the image, for instance, or maybe some other type of shape. , just at different locations in the input image. To see why this makes sense, suppose the weights and bias are such that the hidden neuron can pick out, say, a vertical edge in a particular local receptive field. That ability is also likely to be useful at other places in the image. And so it is useful to apply the same feature detector everywhere in the image. To put it in slightly more abstract terms, convolutional networks are well adapted to the translation invariance of images: move a picture of a cat (say) a little ways, and it's still an image of a cat* *In fact, for the MNIST digit classification problem we've been studying, the images are centered and size-normalized. So MNIST has less translation invariance than images found "in the wild", so to speak. Still, features like edges and corners are likely to be useful across much of the input space. .
For this reason, we sometimes call the map from the input layer to the hidden layer a feature map. We call the weights defining the feature map the shared weights. And we call the bias defining the feature map in this way the shared bias. The shared weights and bias are often said to define a kernel or filter. In the literature, people sometimes use these terms in slightly different ways, and for that reason I'm not going to be more precise; rather, in a moment, we'll look at some concrete examples.
The network structure I've described so far can detect just a single kind of localized feature. To do image recognition we'll need more than one feature map. And so a complete convolutional layer consists of several different feature maps:
In the example shown, there are 3 feature maps. Each feature map is defined by a set of 5×5 shared weights, and a single shared bias. The result is that the network can detect 3 different kinds of features, with each feature being detectable across the entire image.
I've shown just 3 feature maps, to keep the diagram above simple. However, in practice convolutional networks may use more (and perhaps many more) feature maps. One of the early convolutional networks, LeNet-5, used 6 feature maps, each associated to a 5×5 local receptive field, to recognize MNIST digits. So the example illustrated above is actually pretty close to LeNet-5. In the examples we develop later in the chapter we'll use convolutional layers with 20 and 40 feature maps. Let's take a quick peek at some of the features which are learned* *The feature maps illustrated come from the final convolutional network we train, see here.:
The 20 images correspond to 20 different feature maps (or filters, or kernels). Each map is represented as a 5×5 block image, corresponding to the 5×5 weights in the local receptive field. Whiter blocks mean a smaller (typically, more negative) weight, so the feature map responds less to corresponding input pixels. Darker blocks mean a larger weight, so the feature map responds more to the corresponding input pixels. Very roughly speaking, the images above show the type of features the convolutional layer responds to.
So what can we conclude from these feature maps? It's clear there is spatial structure here beyond what we'd expect at random: many of the features have clear sub-regions of light and dark. That shows our network really is learning things related to the spatial structure. However, beyond that, it's difficult to see what these feature detectors are learning. Certainly, we're not learning (say) the Gabor filters which have been used in many traditional approaches to image recognition. In fact, there's now a lot of work on better understanding the features learnt by convolutional networks. If you're interested in following up on that work, I suggest starting with the paper Visualizing and Understanding Convolutional Networks by Matthew Zeiler and Rob Fergus (2013).
A big advantage of sharing weights and biases is that it greatly reduces the number of parameters involved in a convolutional network. For each feature map we need 25=5×5 shared weights, plus a single shared bias. So each feature map requires 26 parameters. If we have 20 feature maps that's a total of 20×26=520 parameters defining the convolutional layer. By comparison, suppose we had a fully connected first layer, with 784=28×28 input neurons, and a relatively modest 30 hidden neurons, as we used in many of the examples earlier in the book. That's a total of 784×30 weights, plus an extra 30 biases, for a total of 23,550 parameters. In other words, the fully-connected layer would have more than 40 times as many parameters as the convolutional layer.
Of course, we can't really do a direct comparison between the number of parameters, since the two models are different in essential ways. But, intuitively, it seems likely that the use of translation invariance by the convolutional layer will reduce the number of parameters it needs to get the same performance as the fully-connected model. That, in turn, will result in faster training for the convolutional model, and, ultimately, will help us build deep networks using convolutional layers.
Incidentally, the name convolutional comes from the fact that the operation in Equation (125) is sometimes known as a convolution. A little more precisely, people sometimes write that equation as a1=σ(b+wa0), where a1 denotes the set of output activations from one feature map, a0 is the set of input activations, and is called a convolution operation. We're not going to make any deep use of the mathematics of convolutions, so you don't need to worry too much about this connection. But it's worth at least knowing where the name comes from.
Pooling layers: In addition to the convolutional layers just described, convolutional neural networks also contain pooling layers. Pooling layers are usually used immediately after convolutional layers. What the pooling layers do is simplify the information in the output from the convolutional layer.
In detail, a pooling layer takes each feature map* *The nomenclature is being used loosely here. In particular, I'm using "feature map" to mean not the function computed by the convolutional layer, but rather the activation of the hidden neurons output from the layer. This kind of mild abuse of nomenclature is pretty common in the research literature. output from the convolutional layer and prepares a condensed feature map. For instance, each unit in the pooling layer may summarize a region of (say) 2×2 neurons in the previous layer. As a concrete example, one common procedure for pooling is known as max-pooling. In max-pooling, a pooling unit simply outputs the maximum activation in the 2×2 input region, as illustrated in the following diagram:
Note that since we have 24×24 neurons output from the convolutional layer, after pooling we have 12×12 neurons.
As mentioned above, the convolutional layer usually involves more than a single feature map. We apply max-pooling to each feature map separately. So if there were three feature maps, the combined convolutional and max-pooling layers would look like:
We can think of max-pooling as a way for the network to ask whether a given feature is found anywhere in a region of the image. It then throws away the exact positional information. The intuition is that once a feature has been found, its exact location isn't as important as its rough location relative to other features. A big benefit is that there are many fewer pooled features, and so this helps reduce the number of parameters needed in later layers.
Max-pooling isn't the only technique used for pooling. Another common approach is known as L2 pooling. Here, instead of taking the maximum activation of a 2×2 region of neurons, we take the square root of the sum of the squares of the activations in the 2×2 region. While the details are different, the intuition is similar to max-pooling: L2 pooling is a way of condensing information from the convolutional layer. In practice, both techniques have been widely used. And sometimes people use other types of pooling operation. If you're really trying to optimize performance, you may use validation data to compare several different approaches to pooling, and choose the approach which works best. But we're not going to worry about that kind of detailed optimization.
Putting it all together: We can now put all these ideas together to form a complete convolutional neural network. It's similar to the architecture we were just looking at, but has the addition of a layer of 10 output neurons, corresponding to the 10 possible values for MNIST digits ('0', '1', '2', etc):
The network begins with 28×28 input neurons, which are used to encode the pixel intensities for the MNIST image. This is then followed by a convolutional layer using a 5×5 local receptive field and 3 feature maps. The result is a layer of 3×24×24 hidden feature neurons. The next step is a max-pooling layer, applied to 2×2 regions, across each of the 3 feature maps. The result is a layer of 3×12×12 hidden feature neurons.
The final layer of connections in the network is a fully-connected layer. That is, this layer connects every neuron from the max-pooled layer to every one of the 10 output neurons. This fully-connected architecture is the same as we used in earlier chapters. Note, however, that in the diagram above, I've used a single arrow, for simplicity, rather than showing all the connections. Of course, you can easily imagine the connections.
This convolutional architecture is quite different to the architectures used in earlier chapters. But the overall picture is similar: a network made of many simple units, whose behaviors are determined by their weights and biases. And the overall goal is still the same: to use training data to train the network's weights and biases so that the network does a good job classifying input digits.
In particular, just as earlier in the book, we will train our network using stochastic gradient descent and backpropagation. This mostly proceeds in exactly the same way as in earlier chapters. However, we do need to make a few modifications to the backpropagation procedure. The reason is that our earlier derivation of backpropagation was for networks with fully-connected layers. Fortunately, it's straightforward to modify the derivation for convolutional and max-pooling layers. If you'd like to understand the details, then I invite you to work through the following problem. Be warned that the problem will take some time to work through, unless you've really internalized the earlier derivation of backpropagation (in which case it's easy).
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,44 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{c+c1}{\PYGdefaultZsh{} import necessary packages}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{numpy} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{np}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{matplotlib.pyplot} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{plt}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{sklearn} \PYGdefault{k+kn}{import} \PYGdefault{n}{datasets}
\PYGdefault{c+c1}{\PYGdefaultZsh{} ensure the same random numbers appear every time}
\PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{seed}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} display images in notebook}
\PYGdefault{o}{\PYGdefaultZpc{}}\PYGdefault{n}{matplotlib} \PYGdefault{n}{inline}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{rcParams}\PYGdefault{p}{[}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}figure.figsize\PYGdefaultZsq{}}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{12}\PYGdefault{p}{,}\PYGdefault{l+m+mi}{12}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} download MNIST dataset}
\PYGdefault{n}{digits} \PYGdefault{o}{=} \PYGdefault{n}{datasets}\PYGdefault{o}{.}\PYGdefault{n}{load\PYGdefaultZus{}digits}\PYGdefault{p}{()}
\PYGdefault{c+c1}{\PYGdefaultZsh{} define inputs and labels}
\PYGdefault{n}{inputs} \PYGdefault{o}{=} \PYGdefault{n}{digits}\PYGdefault{o}{.}\PYGdefault{n}{images}
\PYGdefault{n}{labels} \PYGdefault{o}{=} \PYGdefault{n}{digits}\PYGdefault{o}{.}\PYGdefault{n}{target}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}inputs = (n\PYGdefaultZus{}inputs, pixel\PYGdefaultZus{}width, pixel\PYGdefaultZus{}height) = \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{inputs}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{))}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}labels = (n\PYGdefaultZus{}inputs) = \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{labels}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{))}
\PYGdefault{c+c1}{\PYGdefaultZsh{} flatten the image}
\PYGdefault{c+c1}{\PYGdefaultZsh{} the value \PYGdefaultZhy{}1 means dimension is inferred from the remaining dimensions: 8x8 = 64}
\PYGdefault{n}{n\PYGdefaultZus{}inputs} \PYGdefault{o}{=} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{inputs}\PYGdefault{p}{)}
\PYGdefault{n}{inputs} \PYGdefault{o}{=} \PYGdefault{n}{inputs}\PYGdefault{o}{.}\PYGdefault{n}{reshape}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}inputs}\PYGdefault{p}{,} \PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}X = (n\PYGdefaultZus{}inputs, n\PYGdefaultZus{}features) = \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{inputs}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{))}
\PYGdefault{c+c1}{\PYGdefaultZsh{} choose some random images to display}
\PYGdefault{n}{indices} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{arange}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}inputs}\PYGdefault{p}{)}
\PYGdefault{n}{random\PYGdefaultZus{}indices} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{choice}\PYGdefault{p}{(}\PYGdefault{n}{indices}\PYGdefault{p}{,} \PYGdefault{n}{size}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{)}
\PYGdefault{k}{for} \PYGdefault{n}{i}\PYGdefault{p}{,} \PYGdefault{n}{image} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{digits}\PYGdefault{o}{.}\PYGdefault{n}{images}\PYGdefault{p}{[}\PYGdefault{n}{random\PYGdefaultZus{}indices}\PYGdefault{p}{]):}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplot}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{n}{i}\PYGdefault{o}{+}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{axis}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}off\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{imshow}\PYGdefault{p}{(}\PYGdefault{n}{image}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{cm}\PYGdefault{o}{.}\PYGdefault{n}{gray\PYGdefaultZus{}r}\PYGdefault{p}{,} \PYGdefault{n}{interpolation}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}nearest\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Label: }\PYGdefault{l+s+si}{\PYGdefaultZpc{}d}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}} \PYGdefault{o}{\PYGdefaultZpc{}} \PYGdefault{n}{digits}\PYGdefault{o}{.}\PYGdefault{n}{target}\PYGdefault{p}{[}\PYGdefault{n}{random\PYGdefaultZus{}indices}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{]])}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,3 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{n}{pip3} \PYGdefault{n}{install} \PYGdefault{n}{keras}
\end{Verbatim}
@@ -0,0 +1,32 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{c+c1}{\PYGdefaultZsh{} visual representation of grid search}
\PYGdefault{c+c1}{\PYGdefaultZsh{} uses seaborn heatmap, could probably do this in matplotlib}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{seaborn} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{sns}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{set}\PYGdefault{p}{()}
\PYGdefault{n}{train\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)))}
\PYGdefault{n}{test\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)))}
\PYGdefault{k}{for} \PYGdefault{n}{i} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{)):}
\PYGdefault{k}{for} \PYGdefault{n}{j} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)):}
\PYGdefault{n}{CNN} \PYGdefault{o}{=} \PYGdefault{n}{CNN\PYGdefaultZus{}tf}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]}
\PYGdefault{n}{train\PYGdefaultZus{}accuracy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{CNN}\PYGdefault{o}{.}\PYGdefault{n}{train\PYGdefaultZus{}accuracy}
\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{CNN}\PYGdefault{o}{.}\PYGdefault{n}{test\PYGdefaultZus{}accuracy}
\PYGdefault{n}{fig}\PYGdefault{p}{,} \PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplots}\PYGdefault{p}{(}\PYGdefault{n}{figsize} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{10}\PYGdefault{p}{))}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{heatmap}\PYGdefault{p}{(}\PYGdefault{n}{train\PYGdefaultZus{}accuracy}\PYGdefault{p}{,} \PYGdefault{n}{annot}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{,} \PYGdefault{n}{ax}\PYGdefault{o}{=}\PYGdefault{n}{ax}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}viridis\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Training Accuracy\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}eta\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}lambda\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\PYGdefault{n}{fig}\PYGdefault{p}{,} \PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplots}\PYGdefault{p}{(}\PYGdefault{n}{figsize} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{10}\PYGdefault{p}{))}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{heatmap}\PYGdefault{p}{(}\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{,} \PYGdefault{n}{annot}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{,} \PYGdefault{n}{ax}\PYGdefault{o}{=}\PYGdefault{n}{ax}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}viridis\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Test Accuracy\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}eta\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}lambda\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,17 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.models} \PYGdefault{k+kn}{import} \PYGdefault{n}{Sequential}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.layers} \PYGdefault{k+kn}{import} \PYGdefault{n}{Dense}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.regularizers} \PYGdefault{k+kn}{import} \PYGdefault{n}{l2}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.optimizers} \PYGdefault{k+kn}{import} \PYGdefault{n}{SGD}
\PYGdefault{k}{def} \PYGdefault{n+nf}{create\PYGdefaultZus{}neural\PYGdefaultZus{}network\PYGdefaultZus{}keras}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer1}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer2}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{,} \PYGdefault{n}{eta}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{p}{):}
\PYGdefault{n}{model} \PYGdefault{o}{=} \PYGdefault{n}{Sequential}\PYGdefault{p}{()}
\PYGdefault{n}{model}\PYGdefault{o}{.}\PYGdefault{n}{add}\PYGdefault{p}{(}\PYGdefault{n}{Dense}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer1}\PYGdefault{p}{,} \PYGdefault{n}{activation}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}sigmoid\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{kernel\PYGdefaultZus{}regularizer}\PYGdefault{o}{=}\PYGdefault{n}{l2}\PYGdefault{p}{(}\PYGdefault{n}{lmbd}\PYGdefault{p}{)))}
\PYGdefault{n}{model}\PYGdefault{o}{.}\PYGdefault{n}{add}\PYGdefault{p}{(}\PYGdefault{n}{Dense}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer2}\PYGdefault{p}{,} \PYGdefault{n}{activation}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}sigmoid\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{kernel\PYGdefaultZus{}regularizer}\PYGdefault{o}{=}\PYGdefault{n}{l2}\PYGdefault{p}{(}\PYGdefault{n}{lmbd}\PYGdefault{p}{)))}
\PYGdefault{n}{model}\PYGdefault{o}{.}\PYGdefault{n}{add}\PYGdefault{p}{(}\PYGdefault{n}{Dense}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{,} \PYGdefault{n}{activation}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}softmax\PYGdefaultZsq{}}\PYGdefault{p}{))}
\PYGdefault{n}{sgd} \PYGdefault{o}{=} \PYGdefault{n}{SGD}\PYGdefault{p}{(}\PYGdefault{n}{lr}\PYGdefault{o}{=}\PYGdefault{n}{eta}\PYGdefault{p}{)}
\PYGdefault{n}{model}\PYGdefault{o}{.}\PYGdefault{n}{compile}\PYGdefault{p}{(}\PYGdefault{n}{loss}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}categorical\PYGdefaultZus{}crossentropy\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{optimizer}\PYGdefault{o}{=}\PYGdefault{n}{sgd}\PYGdefault{p}{,} \PYGdefault{n}{metrics}\PYGdefault{o}{=}\PYGdefault{p}{[}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}accuracy\PYGdefaultZsq{}}\PYGdefault{p}{])}
\PYGdefault{k}{return} \PYGdefault{n}{model}
\end{Verbatim}
@@ -0,0 +1,102 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{k}{class} \PYGdefault{n+nc}{NeuralNetwork}\PYGdefault{p}{:}
\PYGdefault{k}{def} \PYGdefault{n+nf+fm}{\PYGdefaultZus{}\PYGdefaultZus{}init\PYGdefaultZus{}\PYGdefaultZus{}}\PYGdefault{p}{(}
\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{,}
\PYGdefault{n}{X\PYGdefaultZus{}data}\PYGdefault{p}{,}
\PYGdefault{n}{Y\PYGdefaultZus{}data}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{50}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,}
\PYGdefault{n}{epochs}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,}
\PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{100}\PYGdefault{p}{,}
\PYGdefault{n}{eta}\PYGdefault{o}{=}\PYGdefault{l+m+mf}{0.1}\PYGdefault{p}{,}
\PYGdefault{n}{lmbd}\PYGdefault{o}{=}\PYGdefault{l+m+mf}{0.0}\PYGdefault{p}{,}
\PYGdefault{p}{):}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X\PYGdefaultZus{}data\PYGdefaultZus{}full} \PYGdefault{o}{=} \PYGdefault{n}{X\PYGdefaultZus{}data}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y\PYGdefaultZus{}data\PYGdefaultZus{}full} \PYGdefault{o}{=} \PYGdefault{n}{Y\PYGdefaultZus{}data}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}inputs} \PYGdefault{o}{=} \PYGdefault{n}{X\PYGdefaultZus{}data}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{[}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{]}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}features} \PYGdefault{o}{=} \PYGdefault{n}{X\PYGdefaultZus{}data}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{[}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{]}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons} \PYGdefault{o}{=} \PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}categories} \PYGdefault{o}{=} \PYGdefault{n}{n\PYGdefaultZus{}categories}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{epochs} \PYGdefault{o}{=} \PYGdefault{n}{epochs}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{batch\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{n}{batch\PYGdefaultZus{}size}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{iterations} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}inputs} \PYGdefault{o}{//} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{batch\PYGdefaultZus{}size}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{eta} \PYGdefault{o}{=} \PYGdefault{n}{eta}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{lmbd} \PYGdefault{o}{=} \PYGdefault{n}{lmbd}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{create\PYGdefaultZus{}biases\PYGdefaultZus{}and\PYGdefaultZus{}weights}\PYGdefault{p}{()}
\PYGdefault{k}{def} \PYGdefault{n+nf}{create\PYGdefaultZus{}biases\PYGdefaultZus{}and\PYGdefaultZus{}weights}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{):}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}weights} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{randn}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}features}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}bias} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{l+m+mf}{0.01}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}weights} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{randn}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}bias} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{l+m+mf}{0.01}
\PYGdefault{k}{def} \PYGdefault{n+nf}{feed\PYGdefaultZus{}forward}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{):}
\PYGdefault{c+c1}{\PYGdefaultZsh{} feed\PYGdefaultZhy{}forward for training}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{z\PYGdefaultZus{}h} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X\PYGdefaultZus{}data}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}weights}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}bias}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{a\PYGdefaultZus{}h} \PYGdefault{o}{=} \PYGdefault{n}{sigmoid}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{z\PYGdefaultZus{}h}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{z\PYGdefaultZus{}o} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{a\PYGdefaultZus{}h}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}weights}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}bias}
\PYGdefault{n}{exp\PYGdefaultZus{}term} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{exp}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{z\PYGdefaultZus{}o}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{probabilities} \PYGdefault{o}{=} \PYGdefault{n}{exp\PYGdefaultZus{}term} \PYGdefault{o}{/} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{sum}\PYGdefault{p}{(}\PYGdefault{n}{exp\PYGdefaultZus{}term}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{n}{keepdims}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{)}
\PYGdefault{k}{def} \PYGdefault{n+nf}{feed\PYGdefaultZus{}forward\PYGdefaultZus{}out}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{,} \PYGdefault{n}{X}\PYGdefault{p}{):}
\PYGdefault{c+c1}{\PYGdefaultZsh{} feed\PYGdefaultZhy{}forward for output}
\PYGdefault{n}{z\PYGdefaultZus{}h} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}weights}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}bias}
\PYGdefault{n}{a\PYGdefaultZus{}h} \PYGdefault{o}{=} \PYGdefault{n}{sigmoid}\PYGdefault{p}{(}\PYGdefault{n}{z\PYGdefaultZus{}h}\PYGdefault{p}{)}
\PYGdefault{n}{z\PYGdefaultZus{}o} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{a\PYGdefaultZus{}h}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}weights}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}bias}
\PYGdefault{n}{exp\PYGdefaultZus{}term} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{exp}\PYGdefault{p}{(}\PYGdefault{n}{z\PYGdefaultZus{}o}\PYGdefault{p}{)}
\PYGdefault{n}{probabilities} \PYGdefault{o}{=} \PYGdefault{n}{exp\PYGdefaultZus{}term} \PYGdefault{o}{/} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{sum}\PYGdefault{p}{(}\PYGdefault{n}{exp\PYGdefaultZus{}term}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{n}{keepdims}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{)}
\PYGdefault{k}{return} \PYGdefault{n}{probabilities}
\PYGdefault{k}{def} \PYGdefault{n+nf}{backpropagation}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{):}
\PYGdefault{n}{error\PYGdefaultZus{}output} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{probabilities} \PYGdefault{o}{\PYGdefaultZhy{}} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y\PYGdefaultZus{}data}
\PYGdefault{n}{error\PYGdefaultZus{}hidden} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{error\PYGdefaultZus{}output}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}weights}\PYGdefault{o}{.}\PYGdefault{n}{T}\PYGdefault{p}{)} \PYGdefault{o}{*} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{a\PYGdefaultZus{}h} \PYGdefault{o}{*} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{1} \PYGdefault{o}{\PYGdefaultZhy{}} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{a\PYGdefaultZus{}h}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}weights\PYGdefaultZus{}gradient} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{a\PYGdefaultZus{}h}\PYGdefault{o}{.}\PYGdefault{n}{T}\PYGdefault{p}{,} \PYGdefault{n}{error\PYGdefaultZus{}output}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}bias\PYGdefaultZus{}gradient} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{sum}\PYGdefault{p}{(}\PYGdefault{n}{error\PYGdefaultZus{}output}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}weights\PYGdefaultZus{}gradient} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X\PYGdefaultZus{}data}\PYGdefault{o}{.}\PYGdefault{n}{T}\PYGdefault{p}{,} \PYGdefault{n}{error\PYGdefaultZus{}hidden}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}bias\PYGdefaultZus{}gradient} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{sum}\PYGdefault{p}{(}\PYGdefault{n}{error\PYGdefaultZus{}hidden}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{)}
\PYGdefault{k}{if} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{lmbd} \PYGdefault{o}{\PYGdefaultZgt{}} \PYGdefault{l+m+mf}{0.0}\PYGdefault{p}{:}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}weights\PYGdefaultZus{}gradient} \PYGdefault{o}{+=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{lmbd} \PYGdefault{o}{*} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}weights}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}weights\PYGdefaultZus{}gradient} \PYGdefault{o}{+=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{lmbd} \PYGdefault{o}{*} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}weights}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}weights} \PYGdefault{o}{\PYGdefaultZhy{}=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{eta} \PYGdefault{o}{*} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}weights\PYGdefaultZus{}gradient}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}bias} \PYGdefault{o}{\PYGdefaultZhy{}=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{eta} \PYGdefault{o}{*} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{output\PYGdefaultZus{}bias\PYGdefaultZus{}gradient}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}weights} \PYGdefault{o}{\PYGdefaultZhy{}=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{eta} \PYGdefault{o}{*} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}weights\PYGdefaultZus{}gradient}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}bias} \PYGdefault{o}{\PYGdefaultZhy{}=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{eta} \PYGdefault{o}{*} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{hidden\PYGdefaultZus{}bias\PYGdefaultZus{}gradient}
\PYGdefault{k}{def} \PYGdefault{n+nf}{predict}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{,} \PYGdefault{n}{X}\PYGdefault{p}{):}
\PYGdefault{n}{probabilities} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{feed\PYGdefaultZus{}forward\PYGdefaultZus{}out}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{p}{)}
\PYGdefault{k}{return} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{argmax}\PYGdefault{p}{(}\PYGdefault{n}{probabilities}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{)}
\PYGdefault{k}{def} \PYGdefault{n+nf}{predict\PYGdefaultZus{}probabilities}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{,} \PYGdefault{n}{X}\PYGdefault{p}{):}
\PYGdefault{n}{probabilities} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{feed\PYGdefaultZus{}forward\PYGdefaultZus{}out}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{p}{)}
\PYGdefault{k}{return} \PYGdefault{n}{probabilities}
\PYGdefault{k}{def} \PYGdefault{n+nf}{train}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{):}
\PYGdefault{n}{data\PYGdefaultZus{}indices} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{arange}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}inputs}\PYGdefault{p}{)}
\PYGdefault{k}{for} \PYGdefault{n}{i} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{epochs}\PYGdefault{p}{):}
\PYGdefault{k}{for} \PYGdefault{n}{j} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{iterations}\PYGdefault{p}{):}
\PYGdefault{c+c1}{\PYGdefaultZsh{} pick datapoints with replacement}
\PYGdefault{n}{chosen\PYGdefaultZus{}datapoints} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{choice}\PYGdefault{p}{(}
\PYGdefault{n}{data\PYGdefaultZus{}indices}\PYGdefault{p}{,} \PYGdefault{n}{size}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{p}{,} \PYGdefault{n}{replace}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{False}
\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} minibatch training data}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X\PYGdefaultZus{}data} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X\PYGdefaultZus{}data\PYGdefaultZus{}full}\PYGdefault{p}{[}\PYGdefault{n}{chosen\PYGdefaultZus{}datapoints}\PYGdefault{p}{]}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y\PYGdefaultZus{}data} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y\PYGdefaultZus{}data\PYGdefaultZus{}full}\PYGdefault{p}{[}\PYGdefault{n}{chosen\PYGdefaultZus{}datapoints}\PYGdefault{p}{]}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{feed\PYGdefaultZus{}forward}\PYGdefault{p}{()}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{backpropagation}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,13 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.utils} \PYGdefault{k+kn}{import} \PYGdefault{n}{to\PYGdefaultZus{}categorical}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{sklearn.model\PYGdefaultZus{}selection} \PYGdefault{k+kn}{import} \PYGdefault{n}{train\PYGdefaultZus{}test\PYGdefaultZus{}split}
\PYGdefault{c+c1}{\PYGdefaultZsh{} one\PYGdefaultZhy{}hot representation of labels}
\PYGdefault{n}{labels} \PYGdefault{o}{=} \PYGdefault{n}{to\PYGdefaultZus{}categorical}\PYGdefault{p}{(}\PYGdefault{n}{labels}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} split into train and test data}
\PYGdefault{n}{train\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{l+m+mf}{0.8}
\PYGdefault{n}{test\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{1} \PYGdefault{o}{\PYGdefaultZhy{}} \PYGdefault{n}{train\PYGdefaultZus{}size}
\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test} \PYGdefault{o}{=} \PYGdefault{n}{train\PYGdefaultZus{}test\PYGdefaultZus{}split}\PYGdefault{p}{(}\PYGdefault{n}{inputs}\PYGdefault{p}{,} \PYGdefault{n}{labels}\PYGdefault{p}{,} \PYGdefault{n}{train\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{train\PYGdefaultZus{}size}\PYGdefault{p}{,}
\PYGdefault{n}{test\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{test\PYGdefaultZus{}size}\PYGdefault{p}{)}
\end{Verbatim}
@@ -0,0 +1,18 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{n}{CNN\PYGdefaultZus{}keras} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)),} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n+nb}{object}\PYGdefault{p}{)}
\PYGdefault{k}{for} \PYGdefault{n}{i}\PYGdefault{p}{,} \PYGdefault{n}{eta} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{k}{for} \PYGdefault{n}{j}\PYGdefault{p}{,} \PYGdefault{n}{lmbd} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{n}{CNN} \PYGdefault{o}{=} \PYGdefault{n}{create\PYGdefaultZus{}convolutional\PYGdefaultZus{}neural\PYGdefaultZus{}network\PYGdefaultZus{}keras}\PYGdefault{p}{(}\PYGdefault{n}{input\PYGdefaultZus{}shape}\PYGdefault{p}{,} \PYGdefault{n}{receptive\PYGdefaultZus{}field}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}filters}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}connected}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{,}
\PYGdefault{n}{eta}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{p}{)}
\PYGdefault{n}{CNN}\PYGdefault{o}{.}\PYGdefault{n}{fit}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{epochs}\PYGdefault{o}{=}\PYGdefault{n}{epochs}\PYGdefault{p}{,} \PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{p}{,} \PYGdefault{n}{verbose}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{)}
\PYGdefault{n}{scores} \PYGdefault{o}{=} \PYGdefault{n}{CNN}\PYGdefault{o}{.}\PYGdefault{n}{evaluate}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{)}
\PYGdefault{n}{CNN\PYGdefaultZus{}keras}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{CNN}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Learning rate = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{eta}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Lambda = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Test accuracy: }\PYGdefault{l+s+si}{\PYGdefaultZpc{}.3f}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}} \PYGdefault{o}{\PYGdefaultZpc{}} \PYGdefault{n}{scores}\PYGdefault{p}{[}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{])}
\PYGdefault{k}{print}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,70 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{c+c1}{\PYGdefaultZsh{} to categorical turns our integer vector into a onehot representation}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{sklearn.metrics} \PYGdefault{k+kn}{import} \PYGdefault{n}{accuracy\PYGdefaultZus{}score}
\PYGdefault{c+c1}{\PYGdefaultZsh{} one\PYGdefaultZhy{}hot in numpy}
\PYGdefault{k}{def} \PYGdefault{n+nf}{to\PYGdefaultZus{}categorical\PYGdefaultZus{}numpy}\PYGdefault{p}{(}\PYGdefault{n}{integer\PYGdefaultZus{}vector}\PYGdefault{p}{):}
\PYGdefault{n}{n\PYGdefaultZus{}inputs} \PYGdefault{o}{=} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{integer\PYGdefaultZus{}vector}\PYGdefault{p}{)}
\PYGdefault{n}{n\PYGdefaultZus{}categories} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{max}\PYGdefault{p}{(}\PYGdefault{n}{integer\PYGdefaultZus{}vector}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{l+m+mi}{1}
\PYGdefault{n}{onehot\PYGdefaultZus{}vector} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n}{n\PYGdefaultZus{}inputs}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{))}
\PYGdefault{n}{onehot\PYGdefaultZus{}vector}\PYGdefault{p}{[}\PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}inputs}\PYGdefault{p}{),} \PYGdefault{n}{integer\PYGdefaultZus{}vector}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{1}
\PYGdefault{k}{return} \PYGdefault{n}{onehot\PYGdefaultZus{}vector}
\PYGdefault{c+c1}{\PYGdefaultZsh{}Y\PYGdefaultZus{}train\PYGdefaultZus{}onehot, Y\PYGdefaultZus{}test\PYGdefaultZus{}onehot = to\PYGdefaultZus{}categorical(Y\PYGdefaultZus{}train), to\PYGdefaultZus{}categorical(Y\PYGdefaultZus{}test)}
\PYGdefault{n}{Y\PYGdefaultZus{}train\PYGdefaultZus{}onehot}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test\PYGdefaultZus{}onehot} \PYGdefault{o}{=} \PYGdefault{n}{to\PYGdefaultZus{}categorical\PYGdefaultZus{}numpy}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{),} \PYGdefault{n}{to\PYGdefaultZus{}categorical\PYGdefaultZus{}numpy}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{)}
\PYGdefault{k}{def} \PYGdefault{n+nf}{feed\PYGdefaultZus{}forward\PYGdefaultZus{}train}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{p}{):}
\PYGdefault{c+c1}{\PYGdefaultZsh{} weighted sum of inputs to the hidden layer}
\PYGdefault{n}{z\PYGdefaultZus{}h} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{p}{,} \PYGdefault{n}{hidden\PYGdefaultZus{}weights}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{n}{hidden\PYGdefaultZus{}bias}
\PYGdefault{c+c1}{\PYGdefaultZsh{} activation in the hidden layer}
\PYGdefault{n}{a\PYGdefaultZus{}h} \PYGdefault{o}{=} \PYGdefault{n}{sigmoid}\PYGdefault{p}{(}\PYGdefault{n}{z\PYGdefaultZus{}h}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} weighted sum of inputs to the output layer}
\PYGdefault{n}{z\PYGdefaultZus{}o} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{a\PYGdefaultZus{}h}\PYGdefault{p}{,} \PYGdefault{n}{output\PYGdefaultZus{}weights}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{n}{output\PYGdefaultZus{}bias}
\PYGdefault{c+c1}{\PYGdefaultZsh{} softmax output}
\PYGdefault{c+c1}{\PYGdefaultZsh{} axis 0 holds each input and axis 1 the probabilities of each category}
\PYGdefault{n}{exp\PYGdefaultZus{}term} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{exp}\PYGdefault{p}{(}\PYGdefault{n}{z\PYGdefaultZus{}o}\PYGdefault{p}{)}
\PYGdefault{n}{probabilities} \PYGdefault{o}{=} \PYGdefault{n}{exp\PYGdefaultZus{}term} \PYGdefault{o}{/} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{sum}\PYGdefault{p}{(}\PYGdefault{n}{exp\PYGdefaultZus{}term}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{n}{keepdims}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} for backpropagation need activations in hidden and output layers}
\PYGdefault{k}{return} \PYGdefault{n}{a\PYGdefaultZus{}h}\PYGdefault{p}{,} \PYGdefault{n}{probabilities}
\PYGdefault{k}{def} \PYGdefault{n+nf}{backpropagation}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{p}{,} \PYGdefault{n}{Y}\PYGdefault{p}{):}
\PYGdefault{n}{a\PYGdefaultZus{}h}\PYGdefault{p}{,} \PYGdefault{n}{probabilities} \PYGdefault{o}{=} \PYGdefault{n}{feed\PYGdefaultZus{}forward\PYGdefaultZus{}train}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} error in the output layer}
\PYGdefault{n}{error\PYGdefaultZus{}output} \PYGdefault{o}{=} \PYGdefault{n}{probabilities} \PYGdefault{o}{\PYGdefaultZhy{}} \PYGdefault{n}{Y}
\PYGdefault{c+c1}{\PYGdefaultZsh{} error in the hidden layer}
\PYGdefault{n}{error\PYGdefaultZus{}hidden} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{error\PYGdefaultZus{}output}\PYGdefault{p}{,} \PYGdefault{n}{output\PYGdefaultZus{}weights}\PYGdefault{o}{.}\PYGdefault{n}{T}\PYGdefault{p}{)} \PYGdefault{o}{*} \PYGdefault{n}{a\PYGdefaultZus{}h} \PYGdefault{o}{*} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{1} \PYGdefault{o}{\PYGdefaultZhy{}} \PYGdefault{n}{a\PYGdefaultZus{}h}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} gradients for the output layer}
\PYGdefault{n}{output\PYGdefaultZus{}weights\PYGdefaultZus{}gradient} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{a\PYGdefaultZus{}h}\PYGdefault{o}{.}\PYGdefault{n}{T}\PYGdefault{p}{,} \PYGdefault{n}{error\PYGdefaultZus{}output}\PYGdefault{p}{)}
\PYGdefault{n}{output\PYGdefaultZus{}bias\PYGdefaultZus{}gradient} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{sum}\PYGdefault{p}{(}\PYGdefault{n}{error\PYGdefaultZus{}output}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} gradient for the hidden layer}
\PYGdefault{n}{hidden\PYGdefaultZus{}weights\PYGdefaultZus{}gradient} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{o}{.}\PYGdefault{n}{T}\PYGdefault{p}{,} \PYGdefault{n}{error\PYGdefaultZus{}hidden}\PYGdefault{p}{)}
\PYGdefault{n}{hidden\PYGdefaultZus{}bias\PYGdefaultZus{}gradient} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{sum}\PYGdefault{p}{(}\PYGdefault{n}{error\PYGdefaultZus{}hidden}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{)}
\PYGdefault{k}{return} \PYGdefault{n}{output\PYGdefaultZus{}weights\PYGdefaultZus{}gradient}\PYGdefault{p}{,} \PYGdefault{n}{output\PYGdefaultZus{}bias\PYGdefaultZus{}gradient}\PYGdefault{p}{,} \PYGdefault{n}{hidden\PYGdefaultZus{}weights\PYGdefaultZus{}gradient}\PYGdefault{p}{,} \PYGdefault{n}{hidden\PYGdefaultZus{}bias\PYGdefaultZus{}gradient}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Old accuracy on training data: \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{accuracy\PYGdefaultZus{}score}\PYGdefault{p}{(}\PYGdefault{n}{predict}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{),} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{)))}
\PYGdefault{n}{eta} \PYGdefault{o}{=} \PYGdefault{l+m+mf}{0.01}
\PYGdefault{n}{lmbd} \PYGdefault{o}{=} \PYGdefault{l+m+mf}{0.01}
\PYGdefault{k}{for} \PYGdefault{n}{i} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{1000}\PYGdefault{p}{):}
\PYGdefault{c+c1}{\PYGdefaultZsh{} calculate gradients}
\PYGdefault{n}{dWo}\PYGdefault{p}{,} \PYGdefault{n}{dBo}\PYGdefault{p}{,} \PYGdefault{n}{dWh}\PYGdefault{p}{,} \PYGdefault{n}{dBh} \PYGdefault{o}{=} \PYGdefault{n}{backpropagation}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train\PYGdefaultZus{}onehot}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} regularization term gradients}
\PYGdefault{n}{dWo} \PYGdefault{o}{+=} \PYGdefault{n}{lmbd} \PYGdefault{o}{*} \PYGdefault{n}{output\PYGdefaultZus{}weights}
\PYGdefault{n}{dWh} \PYGdefault{o}{+=} \PYGdefault{n}{lmbd} \PYGdefault{o}{*} \PYGdefault{n}{hidden\PYGdefaultZus{}weights}
\PYGdefault{c+c1}{\PYGdefaultZsh{} update weights and biases}
\PYGdefault{n}{output\PYGdefaultZus{}weights} \PYGdefault{o}{\PYGdefaultZhy{}=} \PYGdefault{n}{eta} \PYGdefault{o}{*} \PYGdefault{n}{dWo}
\PYGdefault{n}{output\PYGdefaultZus{}bias} \PYGdefault{o}{\PYGdefaultZhy{}=} \PYGdefault{n}{eta} \PYGdefault{o}{*} \PYGdefault{n}{dBo}
\PYGdefault{n}{hidden\PYGdefaultZus{}weights} \PYGdefault{o}{\PYGdefaultZhy{}=} \PYGdefault{n}{eta} \PYGdefault{o}{*} \PYGdefault{n}{dWh}
\PYGdefault{n}{hidden\PYGdefaultZus{}bias} \PYGdefault{o}{\PYGdefaultZhy{}=} \PYGdefault{n}{eta} \PYGdefault{o}{*} \PYGdefault{n}{dBh}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}New accuracy on training data: \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{accuracy\PYGdefaultZus{}score}\PYGdefault{p}{(}\PYGdefault{n}{predict}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{),} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{)))}
\end{Verbatim}
@@ -0,0 +1,29 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{sklearn.model\PYGdefaultZus{}selection} \PYGdefault{k+kn}{import} \PYGdefault{n}{train\PYGdefaultZus{}test\PYGdefaultZus{}split}
\PYGdefault{c+c1}{\PYGdefaultZsh{} one\PYGdefaultZhy{}liner from scikit\PYGdefaultZhy{}learn library}
\PYGdefault{n}{train\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{l+m+mf}{0.8}
\PYGdefault{n}{test\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{1} \PYGdefault{o}{\PYGdefaultZhy{}} \PYGdefault{n}{train\PYGdefaultZus{}size}
\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test} \PYGdefault{o}{=} \PYGdefault{n}{train\PYGdefaultZus{}test\PYGdefaultZus{}split}\PYGdefault{p}{(}\PYGdefault{n}{inputs}\PYGdefault{p}{,} \PYGdefault{n}{labels}\PYGdefault{p}{,} \PYGdefault{n}{train\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{train\PYGdefaultZus{}size}\PYGdefault{p}{,}
\PYGdefault{n}{test\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{test\PYGdefaultZus{}size}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} equivalently in numpy}
\PYGdefault{k}{def} \PYGdefault{n+nf}{train\PYGdefaultZus{}test\PYGdefaultZus{}split\PYGdefaultZus{}numpy}\PYGdefault{p}{(}\PYGdefault{n}{inputs}\PYGdefault{p}{,} \PYGdefault{n}{labels}\PYGdefault{p}{,} \PYGdefault{n}{train\PYGdefaultZus{}size}\PYGdefault{p}{,} \PYGdefault{n}{test\PYGdefaultZus{}size}\PYGdefault{p}{):}
\PYGdefault{n}{n\PYGdefaultZus{}inputs} \PYGdefault{o}{=} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{inputs}\PYGdefault{p}{)}
\PYGdefault{n}{inputs\PYGdefaultZus{}shuffled} \PYGdefault{o}{=} \PYGdefault{n}{inputs}\PYGdefault{o}{.}\PYGdefault{n}{copy}\PYGdefault{p}{()}
\PYGdefault{n}{labels\PYGdefaultZus{}shuffled} \PYGdefault{o}{=} \PYGdefault{n}{labels}\PYGdefault{o}{.}\PYGdefault{n}{copy}\PYGdefault{p}{()}
\PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{shuffle}\PYGdefault{p}{(}\PYGdefault{n}{inputs\PYGdefaultZus{}shuffled}\PYGdefault{p}{)}
\PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{shuffle}\PYGdefault{p}{(}\PYGdefault{n}{labels\PYGdefaultZus{}shuffled}\PYGdefault{p}{)}
\PYGdefault{n}{train\PYGdefaultZus{}end} \PYGdefault{o}{=} \PYGdefault{n+nb}{int}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}inputs}\PYGdefault{o}{*}\PYGdefault{n}{train\PYGdefaultZus{}size}\PYGdefault{p}{)}
\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{X\PYGdefaultZus{}test} \PYGdefault{o}{=} \PYGdefault{n}{inputs\PYGdefaultZus{}shuffled}\PYGdefault{p}{[:}\PYGdefault{n}{train\PYGdefaultZus{}end}\PYGdefault{p}{],} \PYGdefault{n}{inputs\PYGdefaultZus{}shuffled}\PYGdefault{p}{[}\PYGdefault{n}{train\PYGdefaultZus{}end}\PYGdefault{p}{:]}
\PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test} \PYGdefault{o}{=} \PYGdefault{n}{labels\PYGdefaultZus{}shuffled}\PYGdefault{p}{[:}\PYGdefault{n}{train\PYGdefaultZus{}end}\PYGdefault{p}{],} \PYGdefault{n}{labels\PYGdefaultZus{}shuffled}\PYGdefault{p}{[}\PYGdefault{n}{train\PYGdefaultZus{}end}\PYGdefault{p}{:]}
\PYGdefault{k}{return} \PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test}
\PYGdefault{c+c1}{\PYGdefaultZsh{}X\PYGdefaultZus{}train, X\PYGdefaultZus{}test, Y\PYGdefaultZus{}train, Y\PYGdefaultZus{}test = train\PYGdefaultZus{}test\PYGdefaultZus{}split\PYGdefaultZus{}numpy(inputs, labels, train\PYGdefaultZus{}size, test\PYGdefaultZus{}size)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Number of training images: \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{)))}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Number of test images: \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{)))}
\end{Verbatim}
@@ -0,0 +1,133 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{tensorflow} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{tf}
\PYGdefault{k}{class} \PYGdefault{n+nc}{NeuralNetworkTensorflow}\PYGdefault{p}{:}
\PYGdefault{k}{def} \PYGdefault{n+nf+fm}{\PYGdefaultZus{}\PYGdefaultZus{}init\PYGdefaultZus{}\PYGdefaultZus{}}\PYGdefault{p}{(}
\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{,}
\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,}
\PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,}
\PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,}
\PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer1}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{100}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer2}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{50}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{2}\PYGdefault{p}{,}
\PYGdefault{n}{epochs}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,}
\PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{100}\PYGdefault{p}{,}
\PYGdefault{n}{eta}\PYGdefault{o}{=}\PYGdefault{l+m+mf}{0.1}\PYGdefault{p}{,}
\PYGdefault{n}{lmbd}\PYGdefault{o}{=}\PYGdefault{l+m+mf}{0.0}\PYGdefault{p}{,}
\PYGdefault{p}{):}
\PYGdefault{c+c1}{\PYGdefaultZsh{} keep track of number of steps}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{global\PYGdefaultZus{}step} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{Variable}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{,} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{int32}\PYGdefault{p}{,} \PYGdefault{n}{trainable}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{False}\PYGdefault{p}{,} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}global\PYGdefaultZus{}step\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X\PYGdefaultZus{}train} \PYGdefault{o}{=} \PYGdefault{n}{X\PYGdefaultZus{}train}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y\PYGdefaultZus{}train} \PYGdefault{o}{=} \PYGdefault{n}{Y\PYGdefaultZus{}train}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X\PYGdefaultZus{}test} \PYGdefault{o}{=} \PYGdefault{n}{X\PYGdefaultZus{}test}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y\PYGdefaultZus{}test} \PYGdefault{o}{=} \PYGdefault{n}{Y\PYGdefaultZus{}test}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}inputs} \PYGdefault{o}{=} \PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{[}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{]}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}features} \PYGdefault{o}{=} \PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{[}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{]}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer1} \PYGdefault{o}{=} \PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer1}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer2} \PYGdefault{o}{=} \PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer2}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}categories} \PYGdefault{o}{=} \PYGdefault{n}{n\PYGdefaultZus{}categories}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{epochs} \PYGdefault{o}{=} \PYGdefault{n}{epochs}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{batch\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{n}{batch\PYGdefaultZus{}size}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{iterations} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}inputs} \PYGdefault{o}{//} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{batch\PYGdefaultZus{}size}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{eta} \PYGdefault{o}{=} \PYGdefault{n}{eta}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{lmbd} \PYGdefault{o}{=} \PYGdefault{n}{lmbd}
\PYGdefault{c+c1}{\PYGdefaultZsh{} build network piece by piece}
\PYGdefault{c+c1}{\PYGdefaultZsh{} name scopes (with) are used to enforce creation of new variables}
\PYGdefault{c+c1}{\PYGdefaultZsh{} https://www.tensorflow.org/guide/variables}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{create\PYGdefaultZus{}placeholders}\PYGdefault{p}{()}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{create\PYGdefaultZus{}DNN}\PYGdefault{p}{()}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{create\PYGdefaultZus{}loss}\PYGdefault{p}{()}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{create\PYGdefaultZus{}optimiser}\PYGdefault{p}{()}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{create\PYGdefaultZus{}accuracy}\PYGdefault{p}{()}
\PYGdefault{k}{def} \PYGdefault{n+nf}{create\PYGdefaultZus{}placeholders}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{):}
\PYGdefault{c+c1}{\PYGdefaultZsh{} placeholders are fine here, but \PYGdefaultZdq{}Datasets\PYGdefaultZdq{} are the preferred method}
\PYGdefault{c+c1}{\PYGdefaultZsh{} of streaming data into a model}
\PYGdefault{k}{with} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{name\PYGdefaultZus{}scope}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}data\PYGdefaultZsq{}}\PYGdefault{p}{):}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{placeholder}\PYGdefault{p}{(}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{float32}\PYGdefault{p}{,} \PYGdefault{n}{shape}\PYGdefault{o}{=}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{None}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}features}\PYGdefault{p}{),} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}X\PYGdefaultZus{}data\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{placeholder}\PYGdefault{p}{(}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{float32}\PYGdefault{p}{,} \PYGdefault{n}{shape}\PYGdefault{o}{=}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{None}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{),} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}Y\PYGdefaultZus{}data\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{k}{def} \PYGdefault{n+nf}{create\PYGdefaultZus{}DNN}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{):}
\PYGdefault{k}{with} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{name\PYGdefaultZus{}scope}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}DNN\PYGdefaultZsq{}}\PYGdefault{p}{):}
\PYGdefault{c+c1}{\PYGdefaultZsh{} the weights are stored to calculate regularization loss later}
\PYGdefault{c+c1}{\PYGdefaultZsh{} Fully connected layer 1}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{W\PYGdefaultZus{}fc1} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{weight\PYGdefaultZus{}variable}\PYGdefault{p}{([}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}features}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer1}\PYGdefault{p}{],} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}fc1\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{float32}\PYGdefault{p}{)}
\PYGdefault{n}{b\PYGdefaultZus{}fc1} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{bias\PYGdefaultZus{}variable}\PYGdefault{p}{([}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer1}\PYGdefault{p}{],} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}fc1\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{float32}\PYGdefault{p}{)}
\PYGdefault{n}{a\PYGdefaultZus{}fc1} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{nn}\PYGdefault{o}{.}\PYGdefault{n}{sigmoid}\PYGdefault{p}{(}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{W\PYGdefaultZus{}fc1}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{n}{b\PYGdefaultZus{}fc1}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} Fully connected layer 2}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{W\PYGdefaultZus{}fc2} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{weight\PYGdefaultZus{}variable}\PYGdefault{p}{([}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer1}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer2}\PYGdefault{p}{],} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}fc2\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{float32}\PYGdefault{p}{)}
\PYGdefault{n}{b\PYGdefaultZus{}fc2} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{bias\PYGdefaultZus{}variable}\PYGdefault{p}{([}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer2}\PYGdefault{p}{],} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}fc2\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{float32}\PYGdefault{p}{)}
\PYGdefault{n}{a\PYGdefaultZus{}fc2} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{nn}\PYGdefault{o}{.}\PYGdefault{n}{sigmoid}\PYGdefault{p}{(}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{a\PYGdefaultZus{}fc1}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{W\PYGdefaultZus{}fc2}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{n}{b\PYGdefaultZus{}fc2}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} Output layer}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{W\PYGdefaultZus{}out} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{weight\PYGdefaultZus{}variable}\PYGdefault{p}{([}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer2}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{],} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}out\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{float32}\PYGdefault{p}{)}
\PYGdefault{n}{b\PYGdefaultZus{}out} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{bias\PYGdefaultZus{}variable}\PYGdefault{p}{([}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{],} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}out\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{float32}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{z\PYGdefaultZus{}out} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{a\PYGdefaultZus{}fc2}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{W\PYGdefaultZus{}out}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{n}{b\PYGdefaultZus{}out}
\PYGdefault{k}{def} \PYGdefault{n+nf}{create\PYGdefaultZus{}loss}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{):}
\PYGdefault{k}{with} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{name\PYGdefaultZus{}scope}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}loss\PYGdefaultZsq{}}\PYGdefault{p}{):}
\PYGdefault{n}{softmax\PYGdefaultZus{}loss} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{reduce\PYGdefaultZus{}mean}\PYGdefault{p}{(}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{nn}\PYGdefault{o}{.}\PYGdefault{n}{softmax\PYGdefaultZus{}cross\PYGdefaultZus{}entropy\PYGdefaultZus{}with\PYGdefaultZus{}logits\PYGdefaultZus{}v2}\PYGdefault{p}{(}\PYGdefault{n}{labels}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y}\PYGdefault{p}{,} \PYGdefault{n}{logits}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{z\PYGdefaultZus{}out}\PYGdefault{p}{))}
\PYGdefault{n}{regularizer\PYGdefaultZus{}loss\PYGdefaultZus{}fc1} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{nn}\PYGdefault{o}{.}\PYGdefault{n}{l2\PYGdefaultZus{}loss}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{W\PYGdefaultZus{}fc1}\PYGdefault{p}{)}
\PYGdefault{n}{regularizer\PYGdefaultZus{}loss\PYGdefaultZus{}fc2} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{nn}\PYGdefault{o}{.}\PYGdefault{n}{l2\PYGdefaultZus{}loss}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{W\PYGdefaultZus{}fc2}\PYGdefault{p}{)}
\PYGdefault{n}{regularizer\PYGdefaultZus{}loss\PYGdefaultZus{}out} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{nn}\PYGdefault{o}{.}\PYGdefault{n}{l2\PYGdefaultZus{}loss}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{W\PYGdefaultZus{}out}\PYGdefault{p}{)}
\PYGdefault{n}{regularizer\PYGdefaultZus{}loss} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{lmbd}\PYGdefault{o}{*}\PYGdefault{p}{(}\PYGdefault{n}{regularizer\PYGdefaultZus{}loss\PYGdefaultZus{}fc1} \PYGdefault{o}{+} \PYGdefault{n}{regularizer\PYGdefaultZus{}loss\PYGdefaultZus{}fc2} \PYGdefault{o}{+} \PYGdefault{n}{regularizer\PYGdefaultZus{}loss\PYGdefaultZus{}out}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{loss} \PYGdefault{o}{=} \PYGdefault{n}{softmax\PYGdefaultZus{}loss} \PYGdefault{o}{+} \PYGdefault{n}{regularizer\PYGdefaultZus{}loss}
\PYGdefault{k}{def} \PYGdefault{n+nf}{create\PYGdefaultZus{}accuracy}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{):}
\PYGdefault{k}{with} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{name\PYGdefaultZus{}scope}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}accuracy\PYGdefaultZsq{}}\PYGdefault{p}{):}
\PYGdefault{n}{probabilities} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{nn}\PYGdefault{o}{.}\PYGdefault{n}{softmax}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{z\PYGdefaultZus{}out}\PYGdefault{p}{)}
\PYGdefault{n}{predictions} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{argmax}\PYGdefault{p}{(}\PYGdefault{n}{probabilities}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{)}
\PYGdefault{n}{labels} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{argmax}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{)}
\PYGdefault{n}{correct\PYGdefaultZus{}predictions} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{equal}\PYGdefault{p}{(}\PYGdefault{n}{predictions}\PYGdefault{p}{,} \PYGdefault{n}{labels}\PYGdefault{p}{)}
\PYGdefault{n}{correct\PYGdefaultZus{}predictions} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{cast}\PYGdefault{p}{(}\PYGdefault{n}{correct\PYGdefaultZus{}predictions}\PYGdefault{p}{,} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{float32}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{accuracy} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{reduce\PYGdefaultZus{}mean}\PYGdefault{p}{(}\PYGdefault{n}{correct\PYGdefaultZus{}predictions}\PYGdefault{p}{)}
\PYGdefault{k}{def} \PYGdefault{n+nf}{create\PYGdefaultZus{}optimiser}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{):}
\PYGdefault{k}{with} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{name\PYGdefaultZus{}scope}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}optimizer\PYGdefaultZsq{}}\PYGdefault{p}{):}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{optimizer} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{train}\PYGdefault{o}{.}\PYGdefault{n}{GradientDescentOptimizer}\PYGdefault{p}{(}\PYGdefault{n}{learning\PYGdefaultZus{}rate}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{eta}\PYGdefault{p}{)}\PYGdefault{o}{.}\PYGdefault{n}{minimize}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{loss}\PYGdefault{p}{,} \PYGdefault{n}{global\PYGdefaultZus{}step}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{global\PYGdefaultZus{}step}\PYGdefault{p}{)}
\PYGdefault{k}{def} \PYGdefault{n+nf}{weight\PYGdefaultZus{}variable}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{,} \PYGdefault{n}{shape}\PYGdefault{p}{,} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{float32}\PYGdefault{p}{):}
\PYGdefault{n}{initial} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{truncated\PYGdefaultZus{}normal}\PYGdefault{p}{(}\PYGdefault{n}{shape}\PYGdefault{p}{,} \PYGdefault{n}{stddev}\PYGdefault{o}{=}\PYGdefault{l+m+mf}{0.1}\PYGdefault{p}{)}
\PYGdefault{k}{return} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{Variable}\PYGdefault{p}{(}\PYGdefault{n}{initial}\PYGdefault{p}{,} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{n}{name}\PYGdefault{p}{,} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n}{dtype}\PYGdefault{p}{)}
\PYGdefault{k}{def} \PYGdefault{n+nf}{bias\PYGdefaultZus{}variable}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{,} \PYGdefault{n}{shape}\PYGdefault{p}{,} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{float32}\PYGdefault{p}{):}
\PYGdefault{n}{initial} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{constant}\PYGdefault{p}{(}\PYGdefault{l+m+mf}{0.1}\PYGdefault{p}{,} \PYGdefault{n}{shape}\PYGdefault{o}{=}\PYGdefault{n}{shape}\PYGdefault{p}{)}
\PYGdefault{k}{return} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{Variable}\PYGdefault{p}{(}\PYGdefault{n}{initial}\PYGdefault{p}{,} \PYGdefault{n}{name}\PYGdefault{o}{=}\PYGdefault{n}{name}\PYGdefault{p}{,} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n}{dtype}\PYGdefault{p}{)}
\PYGdefault{k}{def} \PYGdefault{n+nf}{fit}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{p}{):}
\PYGdefault{n}{data\PYGdefaultZus{}indices} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{arange}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{n\PYGdefaultZus{}inputs}\PYGdefault{p}{)}
\PYGdefault{k}{with} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{Session}\PYGdefault{p}{()} \PYGdefault{k}{as} \PYGdefault{n}{sess}\PYGdefault{p}{:}
\PYGdefault{n}{sess}\PYGdefault{o}{.}\PYGdefault{n}{run}\PYGdefault{p}{(}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{global\PYGdefaultZus{}variables\PYGdefaultZus{}initializer}\PYGdefault{p}{())}
\PYGdefault{k}{for} \PYGdefault{n}{i} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{epochs}\PYGdefault{p}{):}
\PYGdefault{k}{for} \PYGdefault{n}{j} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{iterations}\PYGdefault{p}{):}
\PYGdefault{n}{chosen\PYGdefaultZus{}datapoints} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{choice}\PYGdefault{p}{(}\PYGdefault{n}{data\PYGdefaultZus{}indices}\PYGdefault{p}{,} \PYGdefault{n}{size}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{p}{,} \PYGdefault{n}{replace}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{False}\PYGdefault{p}{)}
\PYGdefault{n}{batch\PYGdefaultZus{}X}\PYGdefault{p}{,} \PYGdefault{n}{batch\PYGdefaultZus{}Y} \PYGdefault{o}{=} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{[}\PYGdefault{n}{chosen\PYGdefaultZus{}datapoints}\PYGdefault{p}{],} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{[}\PYGdefault{n}{chosen\PYGdefaultZus{}datapoints}\PYGdefault{p}{]}
\PYGdefault{n}{sess}\PYGdefault{o}{.}\PYGdefault{n}{run}\PYGdefault{p}{([}\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{loss}\PYGdefault{p}{,} \PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{optimizer}\PYGdefault{p}{],}
\PYGdefault{n}{feed\PYGdefaultZus{}dict}\PYGdefault{o}{=}\PYGdefault{p}{\PYGdefaultZob{}}\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{X}\PYGdefault{p}{:} \PYGdefault{n}{batch\PYGdefaultZus{}X}\PYGdefault{p}{,}
\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{Y}\PYGdefault{p}{:} \PYGdefault{n}{batch\PYGdefaultZus{}Y}\PYGdefault{p}{\PYGdefaultZcb{})}
\PYGdefault{n}{accuracy} \PYGdefault{o}{=} \PYGdefault{n}{sess}\PYGdefault{o}{.}\PYGdefault{n}{run}\PYGdefault{p}{(}\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{accuracy}\PYGdefault{p}{,}
\PYGdefault{n}{feed\PYGdefaultZus{}dict}\PYGdefault{o}{=}\PYGdefault{p}{\PYGdefaultZob{}}\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{X}\PYGdefault{p}{:} \PYGdefault{n}{batch\PYGdefaultZus{}X}\PYGdefault{p}{,}
\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{Y}\PYGdefault{p}{:} \PYGdefault{n}{batch\PYGdefaultZus{}Y}\PYGdefault{p}{\PYGdefaultZcb{})}
\PYGdefault{n}{step} \PYGdefault{o}{=} \PYGdefault{n}{sess}\PYGdefault{o}{.}\PYGdefault{n}{run}\PYGdefault{p}{(}\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{global\PYGdefaultZus{}step}\PYGdefault{p}{)}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{train\PYGdefaultZus{}loss}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{train\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{sess}\PYGdefault{o}{.}\PYGdefault{n}{run}\PYGdefault{p}{([}\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{loss}\PYGdefault{p}{,} \PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{accuracy}\PYGdefault{p}{],}
\PYGdefault{n}{feed\PYGdefaultZus{}dict}\PYGdefault{o}{=}\PYGdefault{p}{\PYGdefaultZob{}}\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{X}\PYGdefault{p}{:} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,}
\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{Y}\PYGdefault{p}{:} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{\PYGdefaultZcb{})}
\PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{test\PYGdefaultZus{}loss}\PYGdefault{p}{,} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{test\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{sess}\PYGdefault{o}{.}\PYGdefault{n}{run}\PYGdefault{p}{([}\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{loss}\PYGdefault{p}{,} \PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{accuracy}\PYGdefault{p}{],}
\PYGdefault{n}{feed\PYGdefaultZus{}dict}\PYGdefault{o}{=}\PYGdefault{p}{\PYGdefaultZob{}}\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{X}\PYGdefault{p}{:} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,}
\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{Y}\PYGdefault{p}{:} \PYGdefault{n+nb+bp}{self}\PYGdefault{o}{.}\PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{\PYGdefaultZcb{})}
\end{Verbatim}
@@ -0,0 +1,9 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{n}{epochs} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{100}
\PYGdefault{n}{batch\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{100}
\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer1} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{100}
\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer2} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{50}
\PYGdefault{n}{n\PYGdefaultZus{}categories} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{10}
\PYGdefault{n}{eta\PYGdefaultZus{}vals} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{logspace}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{7}\PYGdefault{p}{)}
\PYGdefault{n}{lmbd\PYGdefaultZus{}vals} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{logspace}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{7}\PYGdefault{p}{)}
\end{Verbatim}
@@ -0,0 +1,17 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{n}{DNN\PYGdefaultZus{}tf} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)),} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n+nb}{object}\PYGdefault{p}{)}
\PYGdefault{k}{for} \PYGdefault{n}{i}\PYGdefault{p}{,} \PYGdefault{n}{eta} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{k}{for} \PYGdefault{n}{j}\PYGdefault{p}{,} \PYGdefault{n}{lmbd} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{n}{DNN} \PYGdefault{o}{=} \PYGdefault{n}{NeuralNetworkTensorflow}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer1}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer2}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{,}
\PYGdefault{n}{epochs}\PYGdefault{o}{=}\PYGdefault{n}{epochs}\PYGdefault{p}{,} \PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{p}{,} \PYGdefault{n}{eta}\PYGdefault{o}{=}\PYGdefault{n}{eta}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{o}{=}\PYGdefault{n}{lmbd}\PYGdefault{p}{)}
\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{fit}\PYGdefault{p}{()}
\PYGdefault{n}{DNN\PYGdefaultZus{}tf}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{DNN}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Learning rate = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{eta}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Lambda = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Test accuracy: }\PYGdefault{l+s+si}{\PYGdefaultZpc{}.3f}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}} \PYGdefault{o}{\PYGdefaultZpc{}} \PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,35 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{c+c1}{\PYGdefaultZsh{} visual representation of grid search}
\PYGdefault{c+c1}{\PYGdefaultZsh{} uses seaborn heatmap, you can also do this with matplotlib imshow}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{seaborn} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{sns}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{set}\PYGdefault{p}{()}
\PYGdefault{n}{train\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)))}
\PYGdefault{n}{test\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)))}
\PYGdefault{k}{for} \PYGdefault{n}{i} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{)):}
\PYGdefault{k}{for} \PYGdefault{n}{j} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)):}
\PYGdefault{n}{dnn} \PYGdefault{o}{=} \PYGdefault{n}{DNN\PYGdefaultZus{}numpy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]}
\PYGdefault{n}{train\PYGdefaultZus{}pred} \PYGdefault{o}{=} \PYGdefault{n}{dnn}\PYGdefault{o}{.}\PYGdefault{n}{predict}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{)}
\PYGdefault{n}{test\PYGdefaultZus{}pred} \PYGdefault{o}{=} \PYGdefault{n}{dnn}\PYGdefault{o}{.}\PYGdefault{n}{predict}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{)}
\PYGdefault{n}{train\PYGdefaultZus{}accuracy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{accuracy\PYGdefaultZus{}score}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{train\PYGdefaultZus{}pred}\PYGdefault{p}{)}
\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{accuracy\PYGdefaultZus{}score}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{test\PYGdefaultZus{}pred}\PYGdefault{p}{)}
\PYGdefault{n}{fig}\PYGdefault{p}{,} \PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplots}\PYGdefault{p}{(}\PYGdefault{n}{figsize} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{10}\PYGdefault{p}{))}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{heatmap}\PYGdefault{p}{(}\PYGdefault{n}{train\PYGdefaultZus{}accuracy}\PYGdefault{p}{,} \PYGdefault{n}{annot}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{,} \PYGdefault{n}{ax}\PYGdefault{o}{=}\PYGdefault{n}{ax}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}viridis\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Training Accuracy\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}eta\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}lambda\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\PYGdefault{n}{fig}\PYGdefault{p}{,} \PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplots}\PYGdefault{p}{(}\PYGdefault{n}{figsize} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{10}\PYGdefault{p}{))}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{heatmap}\PYGdefault{p}{(}\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{,} \PYGdefault{n}{annot}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{,} \PYGdefault{n}{ax}\PYGdefault{o}{=}\PYGdefault{n}{ax}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}viridis\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Test Accuracy\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}eta\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}lambda\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,3 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{n}{pip3} \PYGdefault{n}{install} \PYGdefault{n}{tensorflow}
\end{Verbatim}
@@ -0,0 +1,18 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{sklearn.neural\PYGdefaultZus{}network} \PYGdefault{k+kn}{import} \PYGdefault{n}{MLPClassifier}
\PYGdefault{c+c1}{\PYGdefaultZsh{} store models for later use}
\PYGdefault{n}{DNN\PYGdefaultZus{}scikit} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)),} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n+nb}{object}\PYGdefault{p}{)}
\PYGdefault{k}{for} \PYGdefault{n}{i}\PYGdefault{p}{,} \PYGdefault{n}{eta} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{k}{for} \PYGdefault{n}{j}\PYGdefault{p}{,} \PYGdefault{n}{lmbd} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{n}{dnn} \PYGdefault{o}{=} \PYGdefault{n}{MLPClassifier}\PYGdefault{p}{(}\PYGdefault{n}{hidden\PYGdefaultZus{}layer\PYGdefaultZus{}sizes}\PYGdefault{o}{=}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{p}{),} \PYGdefault{n}{activation}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}logistic\PYGdefaultZsq{}}\PYGdefault{p}{,}
\PYGdefault{n}{alpha}\PYGdefault{o}{=}\PYGdefault{n}{lmbd}\PYGdefault{p}{,} \PYGdefault{n}{learning\PYGdefaultZus{}rate\PYGdefaultZus{}init}\PYGdefault{o}{=}\PYGdefault{n}{eta}\PYGdefault{p}{,} \PYGdefault{n}{max\PYGdefaultZus{}iter}\PYGdefault{o}{=}\PYGdefault{n}{epochs}\PYGdefault{p}{)}
\PYGdefault{n}{dnn}\PYGdefault{o}{.}\PYGdefault{n}{fit}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{)}
\PYGdefault{n}{DNN\PYGdefaultZus{}scikit}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{dnn}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Learning rate = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{eta}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Lambda = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Accuracy score on test set: \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{dnn}\PYGdefault{o}{.}\PYGdefault{n}{score}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{))}
\PYGdefault{k}{print}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,14 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.utils} \PYGdefault{k+kn}{import} \PYGdefault{n}{to\PYGdefaultZus{}categorical}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{sklearn.model\PYGdefaultZus{}selection} \PYGdefault{k+kn}{import} \PYGdefault{n}{train\PYGdefaultZus{}test\PYGdefaultZus{}split}
\PYGdefault{c+c1}{\PYGdefaultZsh{} representation of labels}
\PYGdefault{n}{labels} \PYGdefault{o}{=} \PYGdefault{n}{to\PYGdefaultZus{}categorical}\PYGdefault{p}{(}\PYGdefault{n}{labels}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} split into train and test data}
\PYGdefault{c+c1}{\PYGdefaultZsh{} one\PYGdefaultZhy{}liner from scikit\PYGdefaultZhy{}learn library}
\PYGdefault{n}{train\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{l+m+mf}{0.8}
\PYGdefault{n}{test\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{1} \PYGdefault{o}{\PYGdefaultZhy{}} \PYGdefault{n}{train\PYGdefaultZus{}size}
\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test} \PYGdefault{o}{=} \PYGdefault{n}{train\PYGdefaultZus{}test\PYGdefaultZus{}split}\PYGdefault{p}{(}\PYGdefault{n}{inputs}\PYGdefault{p}{,} \PYGdefault{n}{labels}\PYGdefault{p}{,} \PYGdefault{n}{train\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{train\PYGdefaultZus{}size}\PYGdefault{p}{,}
\PYGdefault{n}{test\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{test\PYGdefaultZus{}size}\PYGdefault{p}{)}
\end{Verbatim}
@@ -0,0 +1,22 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{n}{eta\PYGdefaultZus{}vals} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{logspace}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{7}\PYGdefault{p}{)}
\PYGdefault{n}{lmbd\PYGdefaultZus{}vals} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{logspace}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{7}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} store the models for later use}
\PYGdefault{n}{DNN\PYGdefaultZus{}numpy} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)),} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n+nb}{object}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} grid search}
\PYGdefault{k}{for} \PYGdefault{n}{i}\PYGdefault{p}{,} \PYGdefault{n}{eta} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{k}{for} \PYGdefault{n}{j}\PYGdefault{p}{,} \PYGdefault{n}{lmbd} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{n}{dnn} \PYGdefault{o}{=} \PYGdefault{n}{NeuralNetwork}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train\PYGdefaultZus{}onehot}\PYGdefault{p}{,} \PYGdefault{n}{eta}\PYGdefault{o}{=}\PYGdefault{n}{eta}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{o}{=}\PYGdefault{n}{lmbd}\PYGdefault{p}{,} \PYGdefault{n}{epochs}\PYGdefault{o}{=}\PYGdefault{n}{epochs}\PYGdefault{p}{,} \PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{o}{=}\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{o}{=}\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{)}
\PYGdefault{n}{dnn}\PYGdefault{o}{.}\PYGdefault{n}{train}\PYGdefault{p}{()}
\PYGdefault{n}{DNN\PYGdefaultZus{}numpy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{dnn}
\PYGdefault{n}{test\PYGdefaultZus{}predict} \PYGdefault{o}{=} \PYGdefault{n}{dnn}\PYGdefault{o}{.}\PYGdefault{n}{predict}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Learning rate = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{eta}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Lambda = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Accuracy score on test set: \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{accuracy\PYGdefaultZus{}score}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{test\PYGdefaultZus{}predict}\PYGdefault{p}{))}
\PYGdefault{k}{print}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,73 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{l+s+sd}{\PYGdefaultZdq{}\PYGdefaultZdq{}\PYGdefaultZdq{}The sigmoid function (or the logistic curve) is a}
\PYGdefault{l+s+sd}{function that takes any real number, z, and outputs a number (0,1).}
\PYGdefault{l+s+sd}{It is useful in neural networks for assigning weights on a relative scale.}
\PYGdefault{l+s+sd}{The value z is the weighted sum of parameters involved in the learning algorithm.\PYGdefaultZdq{}\PYGdefaultZdq{}\PYGdefaultZdq{}}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{numpy}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{matplotlib.pyplot} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{plt}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{math} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{mt}
\PYGdefault{n}{z} \PYGdefault{o}{=} \PYGdefault{n}{numpy}\PYGdefault{o}{.}\PYGdefault{n}{arange}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{o}{.}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{)}
\PYGdefault{n}{sigma\PYGdefaultZus{}fn} \PYGdefault{o}{=} \PYGdefault{n}{numpy}\PYGdefault{o}{.}\PYGdefault{n}{vectorize}\PYGdefault{p}{(}\PYGdefault{k}{lambda} \PYGdefault{n}{z}\PYGdefault{p}{:} \PYGdefault{l+m+mi}{1}\PYGdefault{o}{/}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{1}\PYGdefault{o}{+}\PYGdefault{n}{numpy}\PYGdefault{o}{.}\PYGdefault{n}{exp}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{n}{z}\PYGdefault{p}{)))}
\PYGdefault{n}{sigma} \PYGdefault{o}{=} \PYGdefault{n}{sigma\PYGdefaultZus{}fn}\PYGdefault{p}{(}\PYGdefault{n}{z}\PYGdefault{p}{)}
\PYGdefault{n}{fig} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{figure}\PYGdefault{p}{()}
\PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{fig}\PYGdefault{o}{.}\PYGdefault{n}{add\PYGdefaultZus{}subplot}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{111}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{plot}\PYGdefault{p}{(}\PYGdefault{n}{z}\PYGdefault{p}{,} \PYGdefault{n}{sigma}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylim}\PYGdefault{p}{([}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mf}{0.1}\PYGdefault{p}{,} \PYGdefault{l+m+mf}{1.1}\PYGdefault{p}{])}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlim}\PYGdefault{p}{([}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{])}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{grid}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}z\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}sigmoid function\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\PYGdefault{l+s+sd}{\PYGdefaultZdq{}\PYGdefaultZdq{}\PYGdefaultZdq{}Step Function\PYGdefaultZdq{}\PYGdefaultZdq{}\PYGdefaultZdq{}}
\PYGdefault{n}{z} \PYGdefault{o}{=} \PYGdefault{n}{numpy}\PYGdefault{o}{.}\PYGdefault{n}{arange}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{o}{.}\PYGdefault{l+m+mo}{02}\PYGdefault{p}{)}
\PYGdefault{n}{step\PYGdefaultZus{}fn} \PYGdefault{o}{=} \PYGdefault{n}{numpy}\PYGdefault{o}{.}\PYGdefault{n}{vectorize}\PYGdefault{p}{(}\PYGdefault{k}{lambda} \PYGdefault{n}{z}\PYGdefault{p}{:} \PYGdefault{l+m+mf}{1.0} \PYGdefault{k}{if} \PYGdefault{n}{z} \PYGdefault{o}{\PYGdefaultZgt{}=} \PYGdefault{l+m+mf}{0.0} \PYGdefault{k}{else} \PYGdefault{l+m+mf}{0.0}\PYGdefault{p}{)}
\PYGdefault{n}{step} \PYGdefault{o}{=} \PYGdefault{n}{step\PYGdefaultZus{}fn}\PYGdefault{p}{(}\PYGdefault{n}{z}\PYGdefault{p}{)}
\PYGdefault{n}{fig} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{figure}\PYGdefault{p}{()}
\PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{fig}\PYGdefault{o}{.}\PYGdefault{n}{add\PYGdefaultZus{}subplot}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{111}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{plot}\PYGdefault{p}{(}\PYGdefault{n}{z}\PYGdefault{p}{,} \PYGdefault{n}{step}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylim}\PYGdefault{p}{([}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mf}{0.5}\PYGdefault{p}{,} \PYGdefault{l+m+mf}{1.5}\PYGdefault{p}{])}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlim}\PYGdefault{p}{([}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{])}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{grid}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}z\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}step function\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\PYGdefault{l+s+sd}{\PYGdefaultZdq{}\PYGdefaultZdq{}\PYGdefaultZdq{}Sine Function\PYGdefaultZdq{}\PYGdefaultZdq{}\PYGdefaultZdq{}}
\PYGdefault{n}{z} \PYGdefault{o}{=} \PYGdefault{n}{numpy}\PYGdefault{o}{.}\PYGdefault{n}{arange}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{2}\PYGdefault{o}{*}\PYGdefault{n}{mt}\PYGdefault{o}{.}\PYGdefault{n}{pi}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{2}\PYGdefault{o}{*}\PYGdefault{n}{mt}\PYGdefault{o}{.}\PYGdefault{n}{pi}\PYGdefault{p}{,} \PYGdefault{l+m+mf}{0.1}\PYGdefault{p}{)}
\PYGdefault{n}{t} \PYGdefault{o}{=} \PYGdefault{n}{numpy}\PYGdefault{o}{.}\PYGdefault{n}{sin}\PYGdefault{p}{(}\PYGdefault{n}{z}\PYGdefault{p}{)}
\PYGdefault{n}{fig} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{figure}\PYGdefault{p}{()}
\PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{fig}\PYGdefault{o}{.}\PYGdefault{n}{add\PYGdefaultZus{}subplot}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{111}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{plot}\PYGdefault{p}{(}\PYGdefault{n}{z}\PYGdefault{p}{,} \PYGdefault{n}{t}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylim}\PYGdefault{p}{([}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mf}{1.0}\PYGdefault{p}{,} \PYGdefault{l+m+mf}{1.0}\PYGdefault{p}{])}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlim}\PYGdefault{p}{([}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{2}\PYGdefault{o}{*}\PYGdefault{n}{mt}\PYGdefault{o}{.}\PYGdefault{n}{pi}\PYGdefault{p}{,}\PYGdefault{l+m+mi}{2}\PYGdefault{o}{*}\PYGdefault{n}{mt}\PYGdefault{o}{.}\PYGdefault{n}{pi}\PYGdefault{p}{])}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{grid}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}z\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}sine function\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\PYGdefault{l+s+sd}{\PYGdefaultZdq{}\PYGdefaultZdq{}\PYGdefaultZdq{}Plots a graph of the squashing function used by a rectified linear}
\PYGdefault{l+s+sd}{unit\PYGdefaultZdq{}\PYGdefaultZdq{}\PYGdefaultZdq{}}
\PYGdefault{n}{z} \PYGdefault{o}{=} \PYGdefault{n}{numpy}\PYGdefault{o}{.}\PYGdefault{n}{arange}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{2}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{2}\PYGdefault{p}{,} \PYGdefault{o}{.}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{)}
\PYGdefault{n}{zero} \PYGdefault{o}{=} \PYGdefault{n}{numpy}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{z}\PYGdefault{p}{))}
\PYGdefault{n}{y} \PYGdefault{o}{=} \PYGdefault{n}{numpy}\PYGdefault{o}{.}\PYGdefault{n}{max}\PYGdefault{p}{([}\PYGdefault{n}{zero}\PYGdefault{p}{,} \PYGdefault{n}{z}\PYGdefault{p}{],} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{)}
\PYGdefault{n}{fig} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{figure}\PYGdefault{p}{()}
\PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{fig}\PYGdefault{o}{.}\PYGdefault{n}{add\PYGdefaultZus{}subplot}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{111}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{plot}\PYGdefault{p}{(}\PYGdefault{n}{z}\PYGdefault{p}{,} \PYGdefault{n}{y}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylim}\PYGdefault{p}{([}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mf}{2.0}\PYGdefault{p}{,} \PYGdefault{l+m+mf}{2.0}\PYGdefault{p}{])}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlim}\PYGdefault{p}{([}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mf}{2.0}\PYGdefault{p}{,} \PYGdefault{l+m+mf}{2.0}\PYGdefault{p}{])}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{grid}\PYGdefault{p}{(}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}z\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}Rectified linear unit\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,33 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{c+c1}{\PYGdefaultZsh{} optional}
\PYGdefault{c+c1}{\PYGdefaultZsh{} visual representation of grid search}
\PYGdefault{c+c1}{\PYGdefaultZsh{} uses seaborn heatmap, could probably do this in matplotlib}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{seaborn} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{sns}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{set}\PYGdefault{p}{()}
\PYGdefault{n}{train\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)))}
\PYGdefault{n}{test\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)))}
\PYGdefault{k}{for} \PYGdefault{n}{i} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{)):}
\PYGdefault{k}{for} \PYGdefault{n}{j} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)):}
\PYGdefault{n}{DNN} \PYGdefault{o}{=} \PYGdefault{n}{DNN\PYGdefaultZus{}keras}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]}
\PYGdefault{n}{train\PYGdefaultZus{}accuracy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{evaluate}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{)[}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{]}
\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{evaluate}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{)[}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{]}
\PYGdefault{n}{fig}\PYGdefault{p}{,} \PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplots}\PYGdefault{p}{(}\PYGdefault{n}{figsize} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{10}\PYGdefault{p}{))}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{heatmap}\PYGdefault{p}{(}\PYGdefault{n}{train\PYGdefaultZus{}accuracy}\PYGdefault{p}{,} \PYGdefault{n}{annot}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{,} \PYGdefault{n}{ax}\PYGdefault{o}{=}\PYGdefault{n}{ax}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}viridis\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Training Accuracy\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}eta\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}lambda\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\PYGdefault{n}{fig}\PYGdefault{p}{,} \PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplots}\PYGdefault{p}{(}\PYGdefault{n}{figsize} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{10}\PYGdefault{p}{))}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{heatmap}\PYGdefault{p}{(}\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{,} \PYGdefault{n}{annot}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{,} \PYGdefault{n}{ax}\PYGdefault{o}{=}\PYGdefault{n}{ax}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}viridis\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Test Accuracy\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}eta\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}lambda\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,36 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.models} \PYGdefault{k+kn}{import} \PYGdefault{n}{Sequential}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.layers.convolutional} \PYGdefault{k+kn}{import} \PYGdefault{n}{Conv2D}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.layers.convolutional} \PYGdefault{k+kn}{import} \PYGdefault{n}{MaxPooling2D}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.layers} \PYGdefault{k+kn}{import} \PYGdefault{n}{Flatten}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.layers} \PYGdefault{k+kn}{import} \PYGdefault{n}{Dense}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.regularizers} \PYGdefault{k+kn}{import} \PYGdefault{n}{l2}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{keras.optimizers} \PYGdefault{k+kn}{import} \PYGdefault{n}{SGD}
\PYGdefault{k}{def} \PYGdefault{n+nf}{create\PYGdefaultZus{}convolutional\PYGdefaultZus{}neural\PYGdefaultZus{}network\PYGdefaultZus{}keras}\PYGdefault{p}{(}\PYGdefault{n}{input\PYGdefaultZus{}shape}\PYGdefault{p}{,} \PYGdefault{n}{receptive\PYGdefaultZus{}field}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}filters}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}connected}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{,}
\PYGdefault{n}{eta}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{p}{):}
\PYGdefault{n}{model} \PYGdefault{o}{=} \PYGdefault{n}{Sequential}\PYGdefault{p}{()}
\PYGdefault{n}{model}\PYGdefault{o}{.}\PYGdefault{n}{add}\PYGdefault{p}{(}\PYGdefault{n}{Conv2D}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}filters}\PYGdefault{p}{,} \PYGdefault{p}{(}\PYGdefault{n}{receptive\PYGdefaultZus{}field}\PYGdefault{p}{,} \PYGdefault{n}{receptive\PYGdefaultZus{}field}\PYGdefault{p}{),} \PYGdefault{n}{input\PYGdefaultZus{}shape}\PYGdefault{o}{=}\PYGdefault{n}{input\PYGdefaultZus{}shape}\PYGdefault{p}{,} \PYGdefault{n}{padding}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}same\PYGdefaultZsq{}}\PYGdefault{p}{,}
\PYGdefault{n}{activation}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}relu\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{kernel\PYGdefaultZus{}regularizer}\PYGdefault{o}{=}\PYGdefault{n}{l2}\PYGdefault{p}{(}\PYGdefault{n}{lmbd}\PYGdefault{p}{)))}
\PYGdefault{n}{model}\PYGdefault{o}{.}\PYGdefault{n}{add}\PYGdefault{p}{(}\PYGdefault{n}{MaxPooling2D}\PYGdefault{p}{(}\PYGdefault{n}{pool\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{2}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{2}\PYGdefault{p}{)))}
\PYGdefault{n}{model}\PYGdefault{o}{.}\PYGdefault{n}{add}\PYGdefault{p}{(}\PYGdefault{n}{Flatten}\PYGdefault{p}{())}
\PYGdefault{n}{model}\PYGdefault{o}{.}\PYGdefault{n}{add}\PYGdefault{p}{(}\PYGdefault{n}{Dense}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}connected}\PYGdefault{p}{,} \PYGdefault{n}{activation}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}relu\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{kernel\PYGdefaultZus{}regularizer}\PYGdefault{o}{=}\PYGdefault{n}{l2}\PYGdefault{p}{(}\PYGdefault{n}{lmbd}\PYGdefault{p}{)))}
\PYGdefault{n}{model}\PYGdefault{o}{.}\PYGdefault{n}{add}\PYGdefault{p}{(}\PYGdefault{n}{Dense}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{,} \PYGdefault{n}{activation}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}softmax\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{kernel\PYGdefaultZus{}regularizer}\PYGdefault{o}{=}\PYGdefault{n}{l2}\PYGdefault{p}{(}\PYGdefault{n}{lmbd}\PYGdefault{p}{)))}
\PYGdefault{n}{sgd} \PYGdefault{o}{=} \PYGdefault{n}{SGD}\PYGdefault{p}{(}\PYGdefault{n}{lr}\PYGdefault{o}{=}\PYGdefault{n}{eta}\PYGdefault{p}{)}
\PYGdefault{n}{model}\PYGdefault{o}{.}\PYGdefault{n}{compile}\PYGdefault{p}{(}\PYGdefault{n}{loss}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}categorical\PYGdefaultZus{}crossentropy\PYGdefaultZsq{}}\PYGdefault{p}{,} \PYGdefault{n}{optimizer}\PYGdefault{o}{=}\PYGdefault{n}{sgd}\PYGdefault{p}{,} \PYGdefault{n}{metrics}\PYGdefault{o}{=}\PYGdefault{p}{[}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}accuracy\PYGdefaultZsq{}}\PYGdefault{p}{])}
\PYGdefault{k}{return} \PYGdefault{n}{model}
\PYGdefault{n}{epochs} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{100}
\PYGdefault{n}{batch\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{100}
\PYGdefault{n}{input\PYGdefaultZus{}shape} \PYGdefault{o}{=} \PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{[}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{:}\PYGdefault{l+m+mi}{4}\PYGdefault{p}{]}
\PYGdefault{n}{receptive\PYGdefaultZus{}field} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{3}
\PYGdefault{n}{n\PYGdefaultZus{}filters} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{10}
\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}connected} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{50}
\PYGdefault{n}{n\PYGdefaultZus{}categories} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{10}
\PYGdefault{n}{eta\PYGdefaultZus{}vals} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{logspace}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{7}\PYGdefault{p}{)}
\PYGdefault{n}{lmbd\PYGdefaultZus{}vals} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{logspace}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{7}\PYGdefault{p}{)}
\end{Verbatim}
@@ -0,0 +1,3 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{n}{conda} \PYGdefault{n}{install} \PYGdefault{n}{keras}
\end{Verbatim}
@@ -0,0 +1,37 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{c+c1}{\PYGdefaultZsh{} setup the feed\PYGdefaultZhy{}forward pass, subscript h = hidden layer}
\PYGdefault{k}{def} \PYGdefault{n+nf}{sigmoid}\PYGdefault{p}{(}\PYGdefault{n}{x}\PYGdefault{p}{):}
\PYGdefault{k}{return} \PYGdefault{l+m+mi}{1}\PYGdefault{o}{/}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{1} \PYGdefault{o}{+} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{exp}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{n}{x}\PYGdefault{p}{))}
\PYGdefault{k}{def} \PYGdefault{n+nf}{feed\PYGdefaultZus{}forward}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{p}{):}
\PYGdefault{c+c1}{\PYGdefaultZsh{} weighted sum of inputs to the hidden layer}
\PYGdefault{n}{z\PYGdefaultZus{}h} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{p}{,} \PYGdefault{n}{hidden\PYGdefaultZus{}weights}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{n}{hidden\PYGdefaultZus{}bias}
\PYGdefault{c+c1}{\PYGdefaultZsh{} activation in the hidden layer}
\PYGdefault{n}{a\PYGdefaultZus{}h} \PYGdefault{o}{=} \PYGdefault{n}{sigmoid}\PYGdefault{p}{(}\PYGdefault{n}{z\PYGdefaultZus{}h}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} weighted sum of inputs to the output layer}
\PYGdefault{n}{z\PYGdefaultZus{}o} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{matmul}\PYGdefault{p}{(}\PYGdefault{n}{a\PYGdefaultZus{}h}\PYGdefault{p}{,} \PYGdefault{n}{output\PYGdefaultZus{}weights}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{n}{output\PYGdefaultZus{}bias}
\PYGdefault{c+c1}{\PYGdefaultZsh{} softmax output}
\PYGdefault{c+c1}{\PYGdefaultZsh{} axis 0 holds each input and axis 1 the probabilities of each category}
\PYGdefault{n}{exp\PYGdefaultZus{}term} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{exp}\PYGdefault{p}{(}\PYGdefault{n}{z\PYGdefaultZus{}o}\PYGdefault{p}{)}
\PYGdefault{n}{probabilities} \PYGdefault{o}{=} \PYGdefault{n}{exp\PYGdefaultZus{}term} \PYGdefault{o}{/} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{sum}\PYGdefault{p}{(}\PYGdefault{n}{exp\PYGdefaultZus{}term}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{n}{keepdims}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{)}
\PYGdefault{k}{return} \PYGdefault{n}{probabilities}
\PYGdefault{n}{probabilities} \PYGdefault{o}{=} \PYGdefault{n}{feed\PYGdefaultZus{}forward}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}probabilities = (n\PYGdefaultZus{}inputs, n\PYGdefaultZus{}categories) = \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{probabilities}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{))}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}probability that image 0 is in category 0,1,2,...,9 = }\PYGdefault{l+s+se}{\PYGdefaultZbs{}n}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{probabilities}\PYGdefault{p}{[}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{]))}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}probabilities sum up to: \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{probabilities}\PYGdefault{p}{[}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{]}\PYGdefault{o}{.}\PYGdefault{n}{sum}\PYGdefault{p}{()))}
\PYGdefault{k}{print}\PYGdefault{p}{()}
\PYGdefault{c+c1}{\PYGdefaultZsh{} we obtain a prediction by taking the class with the highest likelihood}
\PYGdefault{k}{def} \PYGdefault{n+nf}{predict}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{p}{):}
\PYGdefault{n}{probabilities} \PYGdefault{o}{=} \PYGdefault{n}{feed\PYGdefaultZus{}forward}\PYGdefault{p}{(}\PYGdefault{n}{X}\PYGdefault{p}{)}
\PYGdefault{k}{return} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{argmax}\PYGdefault{p}{(}\PYGdefault{n}{probabilities}\PYGdefault{p}{,} \PYGdefault{n}{axis}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{)}
\PYGdefault{n}{predictions} \PYGdefault{o}{=} \PYGdefault{n}{predict}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}predictions = (n\PYGdefaultZus{}inputs) = \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{predictions}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{))}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}prediction for image 0: \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{predictions}\PYGdefault{p}{[}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{]))}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}correct label for image 0: \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{[}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{]))}
\end{Verbatim}
@@ -0,0 +1,26 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{n}{epochs} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{100}
\PYGdefault{n}{batch\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{100}
\PYGdefault{n}{n\PYGdefaultZus{}filters} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{10}
\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}connected} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{50}
\PYGdefault{n}{n\PYGdefaultZus{}categories} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{10}
\PYGdefault{n}{eta\PYGdefaultZus{}vals} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{logspace}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{7}\PYGdefault{p}{)}
\PYGdefault{n}{lmbd\PYGdefaultZus{}vals} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{logspace}\PYGdefault{p}{(}\PYGdefault{o}{\PYGdefaultZhy{}}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{7}\PYGdefault{p}{)}
\PYGdefault{n}{CNN\PYGdefaultZus{}tf} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)),} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n+nb}{object}\PYGdefault{p}{)}
\PYGdefault{k}{for} \PYGdefault{n}{i}\PYGdefault{p}{,} \PYGdefault{n}{eta} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{k}{for} \PYGdefault{n}{j}\PYGdefault{p}{,} \PYGdefault{n}{lmbd} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{n}{CNN} \PYGdefault{o}{=} \PYGdefault{n}{ConvolutionalNeuralNetworkTensorflow}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}filters}\PYGdefault{o}{=}\PYGdefault{n}{n\PYGdefaultZus{}filters}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}connected}\PYGdefault{o}{=}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}connected}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{o}{=}\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{,} \PYGdefault{n}{epochs}\PYGdefault{o}{=}\PYGdefault{n}{epochs}\PYGdefault{p}{,} \PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{p}{,}
\PYGdefault{n}{eta}\PYGdefault{o}{=}\PYGdefault{n}{eta}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{o}{=}\PYGdefault{n}{lmbd}\PYGdefault{p}{)}
\PYGdefault{n}{CNN}\PYGdefault{o}{.}\PYGdefault{n}{fit}\PYGdefault{p}{()}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Learning rate = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{eta}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Lambda = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Test accuracy: }\PYGdefault{l+s+si}{\PYGdefaultZpc{}.3f}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}} \PYGdefault{o}{\PYGdefaultZpc{}} \PYGdefault{n}{CNN}\PYGdefault{o}{.}\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{()}
\PYGdefault{n}{CNN\PYGdefaultZus{}tf}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{CNN}
\end{Verbatim}
@@ -0,0 +1,17 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{n}{DNN\PYGdefaultZus{}keras} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)),} \PYGdefault{n}{dtype}\PYGdefault{o}{=}\PYGdefault{n+nb}{object}\PYGdefault{p}{)}
\PYGdefault{k}{for} \PYGdefault{n}{i}\PYGdefault{p}{,} \PYGdefault{n}{eta} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{k}{for} \PYGdefault{n}{j}\PYGdefault{p}{,} \PYGdefault{n}{lmbd} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{):}
\PYGdefault{n}{DNN} \PYGdefault{o}{=} \PYGdefault{n}{create\PYGdefaultZus{}neural\PYGdefaultZus{}network\PYGdefaultZus{}keras}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer1}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}neurons\PYGdefaultZus{}layer2}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{,}
\PYGdefault{n}{eta}\PYGdefault{o}{=}\PYGdefault{n}{eta}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{o}{=}\PYGdefault{n}{lmbd}\PYGdefault{p}{)}
\PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{fit}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{epochs}\PYGdefault{o}{=}\PYGdefault{n}{epochs}\PYGdefault{p}{,} \PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{p}{,} \PYGdefault{n}{verbose}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{)}
\PYGdefault{n}{scores} \PYGdefault{o}{=} \PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{evaluate}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{)}
\PYGdefault{n}{DNN\PYGdefaultZus{}keras}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{DNN}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Learning rate = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{eta}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Lambda = \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{p}{)}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Test accuracy: }\PYGdefault{l+s+si}{\PYGdefaultZpc{}.3f}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}} \PYGdefault{o}{\PYGdefaultZpc{}} \PYGdefault{n}{scores}\PYGdefault{p}{[}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{])}
\PYGdefault{k}{print}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,17 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{c+c1}{\PYGdefaultZsh{} building our neural network}
\PYGdefault{n}{n\PYGdefaultZus{}inputs}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}features} \PYGdefault{o}{=} \PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{o}{.}\PYGdefault{n}{shape}
\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{50}
\PYGdefault{n}{n\PYGdefaultZus{}categories} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{10}
\PYGdefault{c+c1}{\PYGdefaultZsh{} we make the weights normally distributed using numpy.random.randn}
\PYGdefault{c+c1}{\PYGdefaultZsh{} weights and bias in the hidden layer}
\PYGdefault{n}{hidden\PYGdefaultZus{}weights} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{randn}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}features}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{p}{)}
\PYGdefault{n}{hidden\PYGdefaultZus{}bias} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{l+m+mf}{0.01}
\PYGdefault{c+c1}{\PYGdefaultZsh{} weights and bias in the output layer}
\PYGdefault{n}{output\PYGdefaultZus{}weights} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{randn}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{)}
\PYGdefault{n}{output\PYGdefaultZus{}bias} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{)} \PYGdefault{o}{+} \PYGdefault{l+m+mf}{0.01}
\end{Verbatim}
@@ -0,0 +1,3 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{n}{conda} \PYGdefault{n}{install} \PYGdefault{n}{tensorflow}
\end{Verbatim}
@@ -0,0 +1,36 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{c+c1}{\PYGdefaultZsh{} optional}
\PYGdefault{c+c1}{\PYGdefaultZsh{} visual representation of grid search}
\PYGdefault{c+c1}{\PYGdefaultZsh{} uses seaborn heatmap, could probably do this in matplotlib}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{seaborn} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{sns}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{set}\PYGdefault{p}{()}
\PYGdefault{n}{train\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)))}
\PYGdefault{n}{test\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)))}
\PYGdefault{k}{for} \PYGdefault{n}{i} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{)):}
\PYGdefault{k}{for} \PYGdefault{n}{j} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)):}
\PYGdefault{n}{dnn} \PYGdefault{o}{=} \PYGdefault{n}{DNN\PYGdefaultZus{}scikit}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]}
\PYGdefault{n}{train\PYGdefaultZus{}pred} \PYGdefault{o}{=} \PYGdefault{n}{dnn}\PYGdefault{o}{.}\PYGdefault{n}{predict}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{)}
\PYGdefault{n}{test\PYGdefaultZus{}pred} \PYGdefault{o}{=} \PYGdefault{n}{dnn}\PYGdefault{o}{.}\PYGdefault{n}{predict}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{)}
\PYGdefault{n}{train\PYGdefaultZus{}accuracy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{accuracy\PYGdefaultZus{}score}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{train\PYGdefaultZus{}pred}\PYGdefault{p}{)}
\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{accuracy\PYGdefaultZus{}score}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{test\PYGdefaultZus{}pred}\PYGdefault{p}{)}
\PYGdefault{n}{fig}\PYGdefault{p}{,} \PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplots}\PYGdefault{p}{(}\PYGdefault{n}{figsize} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{10}\PYGdefault{p}{))}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{heatmap}\PYGdefault{p}{(}\PYGdefault{n}{train\PYGdefaultZus{}accuracy}\PYGdefault{p}{,} \PYGdefault{n}{annot}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{,} \PYGdefault{n}{ax}\PYGdefault{o}{=}\PYGdefault{n}{ax}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}viridis\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Training Accuracy\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}eta\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}lambda\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\PYGdefault{n}{fig}\PYGdefault{p}{,} \PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplots}\PYGdefault{p}{(}\PYGdefault{n}{figsize} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{10}\PYGdefault{p}{))}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{heatmap}\PYGdefault{p}{(}\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{,} \PYGdefault{n}{annot}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{,} \PYGdefault{n}{ax}\PYGdefault{o}{=}\PYGdefault{n}{ax}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}viridis\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Test Accuracy\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}eta\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}lambda\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,42 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{c+c1}{\PYGdefaultZsh{} import necessary packages}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{numpy} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{np}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{matplotlib.pyplot} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{plt}
\PYGdefault{k+kn}{from} \PYGdefault{n+nn}{sklearn} \PYGdefault{k+kn}{import} \PYGdefault{n}{datasets}
\PYGdefault{c+c1}{\PYGdefaultZsh{} ensure the same random numbers appear every time}
\PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{seed}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{0}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} display images in notebook}
\PYGdefault{o}{\PYGdefaultZpc{}}\PYGdefault{n}{matplotlib} \PYGdefault{n}{inline}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{rcParams}\PYGdefault{p}{[}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}figure.figsize\PYGdefaultZsq{}}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{12}\PYGdefault{p}{,}\PYGdefault{l+m+mi}{12}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} download MNIST dataset}
\PYGdefault{n}{digits} \PYGdefault{o}{=} \PYGdefault{n}{datasets}\PYGdefault{o}{.}\PYGdefault{n}{load\PYGdefaultZus{}digits}\PYGdefault{p}{()}
\PYGdefault{c+c1}{\PYGdefaultZsh{} define inputs and labels}
\PYGdefault{n}{inputs} \PYGdefault{o}{=} \PYGdefault{n}{digits}\PYGdefault{o}{.}\PYGdefault{n}{images}
\PYGdefault{n}{labels} \PYGdefault{o}{=} \PYGdefault{n}{digits}\PYGdefault{o}{.}\PYGdefault{n}{target}
\PYGdefault{c+c1}{\PYGdefaultZsh{} RGB images have a depth of 3}
\PYGdefault{c+c1}{\PYGdefaultZsh{} our images are grayscale so they should have a depth of 1}
\PYGdefault{n}{inputs} \PYGdefault{o}{=} \PYGdefault{n}{inputs}\PYGdefault{p}{[:,:,:,}\PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{newaxis}\PYGdefault{p}{]}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}inputs = (n\PYGdefaultZus{}inputs, pixel\PYGdefaultZus{}width, pixel\PYGdefaultZus{}height, depth) = \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{inputs}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{))}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}labels = (n\PYGdefaultZus{}inputs) = \PYGdefaultZdq{}} \PYGdefault{o}{+} \PYGdefault{n+nb}{str}\PYGdefault{p}{(}\PYGdefault{n}{labels}\PYGdefault{o}{.}\PYGdefault{n}{shape}\PYGdefault{p}{))}
\PYGdefault{c+c1}{\PYGdefaultZsh{} choose some random images to display}
\PYGdefault{n}{n\PYGdefaultZus{}inputs} \PYGdefault{o}{=} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{inputs}\PYGdefault{p}{)}
\PYGdefault{n}{indices} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{arange}\PYGdefault{p}{(}\PYGdefault{n}{n\PYGdefaultZus{}inputs}\PYGdefault{p}{)}
\PYGdefault{n}{random\PYGdefaultZus{}indices} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{random}\PYGdefault{o}{.}\PYGdefault{n}{choice}\PYGdefault{p}{(}\PYGdefault{n}{indices}\PYGdefault{p}{,} \PYGdefault{n}{size}\PYGdefault{o}{=}\PYGdefault{l+m+mi}{5}\PYGdefault{p}{)}
\PYGdefault{k}{for} \PYGdefault{n}{i}\PYGdefault{p}{,} \PYGdefault{n}{image} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{enumerate}\PYGdefault{p}{(}\PYGdefault{n}{digits}\PYGdefault{o}{.}\PYGdefault{n}{images}\PYGdefault{p}{[}\PYGdefault{n}{random\PYGdefaultZus{}indices}\PYGdefault{p}{]):}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplot}\PYGdefault{p}{(}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{5}\PYGdefault{p}{,} \PYGdefault{n}{i}\PYGdefault{o}{+}\PYGdefault{l+m+mi}{1}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{axis}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}off\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{imshow}\PYGdefault{p}{(}\PYGdefault{n}{image}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{cm}\PYGdefault{o}{.}\PYGdefault{n}{gray\PYGdefaultZus{}r}\PYGdefault{p}{,} \PYGdefault{n}{interpolation}\PYGdefault{o}{=}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}nearest\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Label: }\PYGdefault{l+s+si}{\PYGdefaultZpc{}d}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}} \PYGdefault{o}{\PYGdefaultZpc{}} \PYGdefault{n}{digits}\PYGdefault{o}{.}\PYGdefault{n}{target}\PYGdefault{p}{[}\PYGdefault{n}{random\PYGdefaultZus{}indices}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{]])}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,18 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{n}{epochs} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{100}
\PYGdefault{n}{batch\PYGdefaultZus{}size} \PYGdefault{o}{=} \PYGdefault{l+m+mi}{100}
\PYGdefault{n}{dnn} \PYGdefault{o}{=} \PYGdefault{n}{NeuralNetwork}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}train}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}train\PYGdefaultZus{}onehot}\PYGdefault{p}{,} \PYGdefault{n}{eta}\PYGdefault{o}{=}\PYGdefault{n}{eta}\PYGdefault{p}{,} \PYGdefault{n}{lmbd}\PYGdefault{o}{=}\PYGdefault{n}{lmbd}\PYGdefault{p}{,} \PYGdefault{n}{epochs}\PYGdefault{o}{=}\PYGdefault{n}{epochs}\PYGdefault{p}{,} \PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{o}{=}\PYGdefault{n}{batch\PYGdefaultZus{}size}\PYGdefault{p}{,}
\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{o}{=}\PYGdefault{n}{n\PYGdefaultZus{}hidden\PYGdefaultZus{}neurons}\PYGdefault{p}{,} \PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{o}{=}\PYGdefault{n}{n\PYGdefaultZus{}categories}\PYGdefault{p}{)}
\PYGdefault{n}{dnn}\PYGdefault{o}{.}\PYGdefault{n}{train}\PYGdefault{p}{()}
\PYGdefault{n}{test\PYGdefaultZus{}predict} \PYGdefault{o}{=} \PYGdefault{n}{dnn}\PYGdefault{o}{.}\PYGdefault{n}{predict}\PYGdefault{p}{(}\PYGdefault{n}{X\PYGdefaultZus{}test}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{} accuracy score from scikit library}
\PYGdefault{k}{print}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Accuracy score on test set: \PYGdefaultZdq{}}\PYGdefault{p}{,} \PYGdefault{n}{accuracy\PYGdefaultZus{}score}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{test\PYGdefaultZus{}predict}\PYGdefault{p}{))}
\PYGdefault{c+c1}{\PYGdefaultZsh{} equivalent in numpy}
\PYGdefault{k}{def} \PYGdefault{n+nf}{accuracy\PYGdefaultZus{}score\PYGdefaultZus{}numpy}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{,} \PYGdefault{n}{Y\PYGdefaultZus{}pred}\PYGdefault{p}{):}
\PYGdefault{k}{return} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{sum}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}test} \PYGdefault{o}{==} \PYGdefault{n}{Y\PYGdefaultZus{}pred}\PYGdefault{p}{)} \PYGdefault{o}{/} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{Y\PYGdefaultZus{}test}\PYGdefault{p}{)}
\PYGdefault{c+c1}{\PYGdefaultZsh{}print(\PYGdefaultZdq{}Accuracy score on test set: \PYGdefaultZdq{}, accuracy\PYGdefaultZus{}score\PYGdefaultZus{}numpy(Y\PYGdefaultZus{}test, test\PYGdefaultZus{}predict))}
\end{Verbatim}
@@ -0,0 +1,6 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{c+c1}{\PYGdefaultZsh{} optional}
\PYGdefault{c+c1}{\PYGdefaultZsh{} we can use log files to visualize our graph in Tensorboard}
\PYGdefault{n}{writer} \PYGdefault{o}{=} \PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{summary}\PYGdefault{o}{.}\PYGdefault{n}{FileWriter}\PYGdefault{p}{(}\PYGdefault{l+s+s1}{\PYGdefaultZsq{}logs/\PYGdefaultZsq{}}\PYGdefault{p}{)}
\PYGdefault{n}{writer}\PYGdefault{o}{.}\PYGdefault{n}{add\PYGdefaultZus{}graph}\PYGdefault{p}{(}\PYGdefault{n}{tf}\PYGdefault{o}{.}\PYGdefault{n}{get\PYGdefaultZus{}default\PYGdefaultZus{}graph}\PYGdefault{p}{())}
\end{Verbatim}
@@ -0,0 +1,33 @@
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PYGdefault{c+c1}{\PYGdefaultZsh{} optional}
\PYGdefault{c+c1}{\PYGdefaultZsh{} visual representation of grid search}
\PYGdefault{c+c1}{\PYGdefaultZsh{} uses seaborn heatmap, could probably do this in matplotlib}
\PYGdefault{k+kn}{import} \PYGdefault{n+nn}{seaborn} \PYGdefault{k+kn}{as} \PYGdefault{n+nn}{sns}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{set}\PYGdefault{p}{()}
\PYGdefault{n}{train\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)))}
\PYGdefault{n}{test\PYGdefaultZus{}accuracy} \PYGdefault{o}{=} \PYGdefault{n}{np}\PYGdefault{o}{.}\PYGdefault{n}{zeros}\PYGdefault{p}{((}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{),} \PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)))}
\PYGdefault{k}{for} \PYGdefault{n}{i} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{eta\PYGdefaultZus{}vals}\PYGdefault{p}{)):}
\PYGdefault{k}{for} \PYGdefault{n}{j} \PYGdefault{o+ow}{in} \PYGdefault{n+nb}{range}\PYGdefault{p}{(}\PYGdefault{n+nb}{len}\PYGdefault{p}{(}\PYGdefault{n}{lmbd\PYGdefaultZus{}vals}\PYGdefault{p}{)):}
\PYGdefault{n}{DNN} \PYGdefault{o}{=} \PYGdefault{n}{DNN\PYGdefaultZus{}tf}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]}
\PYGdefault{n}{train\PYGdefaultZus{}accuracy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{train\PYGdefaultZus{}accuracy}
\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{[}\PYGdefault{n}{i}\PYGdefault{p}{][}\PYGdefault{n}{j}\PYGdefault{p}{]} \PYGdefault{o}{=} \PYGdefault{n}{DNN}\PYGdefault{o}{.}\PYGdefault{n}{test\PYGdefaultZus{}accuracy}
\PYGdefault{n}{fig}\PYGdefault{p}{,} \PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplots}\PYGdefault{p}{(}\PYGdefault{n}{figsize} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{10}\PYGdefault{p}{))}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{heatmap}\PYGdefault{p}{(}\PYGdefault{n}{train\PYGdefaultZus{}accuracy}\PYGdefault{p}{,} \PYGdefault{n}{annot}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{,} \PYGdefault{n}{ax}\PYGdefault{o}{=}\PYGdefault{n}{ax}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}viridis\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Training Accuracy\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}eta\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}lambda\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\PYGdefault{n}{fig}\PYGdefault{p}{,} \PYGdefault{n}{ax} \PYGdefault{o}{=} \PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{subplots}\PYGdefault{p}{(}\PYGdefault{n}{figsize} \PYGdefault{o}{=} \PYGdefault{p}{(}\PYGdefault{l+m+mi}{10}\PYGdefault{p}{,} \PYGdefault{l+m+mi}{10}\PYGdefault{p}{))}
\PYGdefault{n}{sns}\PYGdefault{o}{.}\PYGdefault{n}{heatmap}\PYGdefault{p}{(}\PYGdefault{n}{test\PYGdefaultZus{}accuracy}\PYGdefault{p}{,} \PYGdefault{n}{annot}\PYGdefault{o}{=}\PYGdefault{n+nb+bp}{True}\PYGdefault{p}{,} \PYGdefault{n}{ax}\PYGdefault{o}{=}\PYGdefault{n}{ax}\PYGdefault{p}{,} \PYGdefault{n}{cmap}\PYGdefault{o}{=}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}viridis\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}title}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}Test Accuracy\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}ylabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}eta\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{ax}\PYGdefault{o}{.}\PYGdefault{n}{set\PYGdefaultZus{}xlabel}\PYGdefault{p}{(}\PYGdefault{l+s+s2}{\PYGdefaultZdq{}\PYGdefaultZdl{}\PYGdefaultZbs{}lambda\PYGdefaultZdl{}\PYGdefaultZdq{}}\PYGdefault{p}{)}
\PYGdefault{n}{plt}\PYGdefault{o}{.}\PYGdefault{n}{show}\PYGdefault{p}{()}
\end{Verbatim}
@@ -0,0 +1,101 @@
\makeatletter
\def\PYGdefault@reset{\let\PYGdefault@it=\relax \let\PYGdefault@bf=\relax%
\let\PYGdefault@ul=\relax \let\PYGdefault@tc=\relax%
\let\PYGdefault@bc=\relax \let\PYGdefault@ff=\relax}
\def\PYGdefault@tok#1{\csname PYGdefault@tok@#1\endcsname}
\def\PYGdefault@toks#1+{\ifx\relax#1\empty\else%
\PYGdefault@tok{#1}\expandafter\PYGdefault@toks\fi}
\def\PYGdefault@do#1{\PYGdefault@bc{\PYGdefault@tc{\PYGdefault@ul{%
\PYGdefault@it{\PYGdefault@bf{\PYGdefault@ff{#1}}}}}}}
\def\PYGdefault#1#2{\PYGdefault@reset\PYGdefault@toks#1+\relax+\PYGdefault@do{#2}}
\expandafter\def\csname PYGdefault@tok@w\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
\expandafter\def\csname PYGdefault@tok@c\endcsname{\let\PYGdefault@it=\textit\def\PYGdefault@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\expandafter\def\csname PYGdefault@tok@cp\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@k\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@kp\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@kt\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
\expandafter\def\csname PYGdefault@tok@o\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PYGdefault@tok@ow\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@nb\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@nf\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@nc\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@nn\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@ne\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}}
\expandafter\def\csname PYGdefault@tok@nv\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PYGdefault@tok@no\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@nl\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@ni\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}}
\expandafter\def\csname PYGdefault@tok@na\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}}
\expandafter\def\csname PYGdefault@tok@nt\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@nd\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@s\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PYGdefault@tok@sd\endcsname{\let\PYGdefault@it=\textit\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PYGdefault@tok@si\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
\expandafter\def\csname PYGdefault@tok@se\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}}
\expandafter\def\csname PYGdefault@tok@sr\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
\expandafter\def\csname PYGdefault@tok@ss\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PYGdefault@tok@sx\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@m\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PYGdefault@tok@gh\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\expandafter\def\csname PYGdefault@tok@gu\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
\expandafter\def\csname PYGdefault@tok@gd\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@gi\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@gr\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@ge\endcsname{\let\PYGdefault@it=\textit}
\expandafter\def\csname PYGdefault@tok@gs\endcsname{\let\PYGdefault@bf=\textbf}
\expandafter\def\csname PYGdefault@tok@gp\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\expandafter\def\csname PYGdefault@tok@go\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\expandafter\def\csname PYGdefault@tok@gt\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
\expandafter\def\csname PYGdefault@tok@err\endcsname{\def\PYGdefault@bc##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}
\expandafter\def\csname PYGdefault@tok@kc\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@kd\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@kn\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@kr\endcsname{\let\PYGdefault@bf=\textbf\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@bp\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@fm\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\expandafter\def\csname PYGdefault@tok@vc\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PYGdefault@tok@vg\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PYGdefault@tok@vi\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PYGdefault@tok@vm\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PYGdefault@tok@sa\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PYGdefault@tok@sb\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PYGdefault@tok@sc\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PYGdefault@tok@dl\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PYGdefault@tok@s2\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PYGdefault@tok@sh\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PYGdefault@tok@s1\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PYGdefault@tok@mb\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PYGdefault@tok@mf\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PYGdefault@tok@mh\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PYGdefault@tok@mi\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PYGdefault@tok@il\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PYGdefault@tok@mo\endcsname{\def\PYGdefault@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PYGdefault@tok@ch\endcsname{\let\PYGdefault@it=\textit\def\PYGdefault@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\expandafter\def\csname PYGdefault@tok@cm\endcsname{\let\PYGdefault@it=\textit\def\PYGdefault@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\expandafter\def\csname PYGdefault@tok@cpf\endcsname{\let\PYGdefault@it=\textit\def\PYGdefault@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\expandafter\def\csname PYGdefault@tok@c1\endcsname{\let\PYGdefault@it=\textit\def\PYGdefault@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\expandafter\def\csname PYGdefault@tok@cs\endcsname{\let\PYGdefault@it=\textit\def\PYGdefault@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\def\PYGdefaultZbs{\char`\\}
\def\PYGdefaultZus{\char`\_}
\def\PYGdefaultZob{\char`\{}
\def\PYGdefaultZcb{\char`\}}
\def\PYGdefaultZca{\char`\^}
\def\PYGdefaultZam{\char`\&}
\def\PYGdefaultZlt{\char`\<}
\def\PYGdefaultZgt{\char`\>}
\def\PYGdefaultZsh{\char`\#}
\def\PYGdefaultZpc{\char`\%}
\def\PYGdefaultZdl{\char`\$}
\def\PYGdefaultZhy{\char`\-}
\def\PYGdefaultZsq{\char`\'}
\def\PYGdefaultZdq{\char`\"}
\def\PYGdefaultZti{\char`\~}
% for compatibility with earlier versions
\def\PYGdefaultZat{@}
\def\PYGdefaultZlb{[}
\def\PYGdefaultZrb{]}
\makeatother
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
.idea/
*.iml
*.iws
*.eml
out/
.DS_Store
.svn
log/*.log
tmp/**
node_modules/
.sass-cache
css/reveal.min.css
js/reveal.min.js
+7
View File
@@ -0,0 +1,7 @@
language: node_js
node_js:
- 4
before_script:
- npm install -g grunt-cli
after_script:
- grunt retire
@@ -0,0 +1,23 @@
## Contributing
Please keep the [issue tracker](http://github.com/hakimel/reveal.js/issues) limited to **bug reports**, **feature requests** and **pull requests**.
### Personal Support
If you have personal support or setup questions the best place to ask those are [StackOverflow](http://stackoverflow.com/questions/tagged/reveal.js).
### Bug Reports
When reporting a bug make sure to include information about which browser and operating system you are on as well as the necessary steps to reproduce the issue. If possible please include a link to a sample presentation where the bug can be tested.
### Pull Requests
- Should follow the coding style of the file you work in, most importantly:
- Tabs to indent
- Single-quoted strings
- Should be made towards the **dev branch**
- Should be submitted from a feature/topic branch (not your master)
### Plugins
Please do not submit plugins as pull requests. They should be maintained in their own separate repository. More information here: https://github.com/hakimel/reveal.js/wiki/Plugin-Guidelines
+140
View File
@@ -0,0 +1,140 @@
/* global module:false */
module.exports = function(grunt) {
var port = grunt.option('port') || 8000;
// Project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
banner:
'/*!\n' +
' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
' * http://lab.hakim.se/reveal-js\n' +
' * MIT licensed\n' +
' *\n' +
' * Copyright (C) 2014 Hakim El Hattab, http://hakim.se\n' +
' */'
},
qunit: {
files: [ 'test/*.html' ]
},
uglify: {
options: {
banner: '<%= meta.banner %>\n'
},
build: {
src: 'js/reveal.js',
dest: 'js/reveal.min.js'
}
},
cssmin: {
compress: {
files: {
'css/reveal.min.css': [ 'css/reveal.css' ]
}
}
},
sass: {
main: {
files: {
'css/theme/darkgray.css': 'css/theme/source/darkgray.scss',
'css/theme/beigesmall.css': 'css/theme/source/beigesmall.scss',
'css/theme/cbc.css': 'css/theme/source/cbc.scss',
'css/theme/default.css': 'css/theme/source/default.scss',
'css/theme/beige.css': 'css/theme/source/beige.scss',
'css/theme/night.css': 'css/theme/source/night.scss',
'css/theme/serif.css': 'css/theme/source/serif.scss',
'css/theme/simple.css': 'css/theme/source/simple.scss',
'css/theme/sky.css': 'css/theme/source/sky.scss',
'css/theme/moon.css': 'css/theme/source/moon.scss',
'css/theme/solarized.css': 'css/theme/source/solarized.scss',
'css/theme/blood.css': 'css/theme/source/blood.scss'
}
}
},
jshint: {
options: {
curly: false,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
eqnull: true,
browser: true,
expr: true,
globals: {
head: false,
module: false,
console: false,
unescape: false
}
},
files: [ 'Gruntfile.js', 'js/reveal.js' ]
},
connect: {
server: {
options: {
port: port,
base: '.'
}
}
},
zip: {
'reveal-js-presentation.zip': [
'index.html',
'css/**',
'js/**',
'lib/**',
'images/**',
'plugin/**'
]
},
watch: {
main: {
files: [ 'Gruntfile.js', 'js/reveal.js', 'css/reveal.css' ],
tasks: 'default'
},
theme: {
files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
tasks: 'themes'
}
}
});
// Dependencies
grunt.loadNpmTasks( 'grunt-contrib-qunit' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-sass' );
grunt.loadNpmTasks( 'grunt-contrib-connect' );
grunt.loadNpmTasks( 'grunt-zip' );
// Default task
grunt.registerTask( 'default', [ 'jshint', 'cssmin', 'uglify', 'qunit' ] );
// Theme task
grunt.registerTask( 'themes', [ 'sass' ] );
// Package presentation to archive
grunt.registerTask( 'package', [ 'default', 'zip' ] );
// Serve presentation locally
grunt.registerTask( 'serve', [ 'connect', 'watch' ] );
// Run tests
grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );
};
+19
View File
@@ -0,0 +1,19 @@
Copyright (C) 2017 Hakim El Hattab, http://hakim.se, and reveal.js contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
File diff suppressed because it is too large Load Diff
+27
View File
@@ -0,0 +1,27 @@
{
"name": "reveal.js",
"version": "3.6.0",
"main": [
"js/reveal.js",
"css/reveal.css"
],
"homepage": "http://revealjs.com",
"license": "MIT",
"description": "The HTML Presentation Framework",
"authors": [
"Hakim El Hattab <hakim.elhattab@gmail.com>"
],
"dependencies": {
"headjs": "~1.0.3"
},
"repository": {
"type": "git",
"url": "git://github.com/hakimel/reveal.js.git"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test"
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@@ -0,0 +1,203 @@
/* Default Print Stylesheet Template
by Rob Glazebrook of CSSnewbie.com
Last Updated: June 4, 2008
Feel free (nay, compelled) to edit, append, and
manipulate this file as you see fit. */
@media print {
/* SECTION 1: Set default width, margin, float, and
background. This prevents elements from extending
beyond the edge of the printed page, and prevents
unnecessary background images from printing */
html {
background: #fff;
width: auto;
height: auto;
overflow: visible;
}
body {
background: #fff;
font-size: 20pt;
width: auto;
height: auto;
border: 0;
margin: 0 5%;
padding: 0;
overflow: visible;
float: none !important;
}
/* SECTION 2: Remove any elements not needed in print.
This would include navigation, ads, sidebars, etc. */
.nestedarrow,
.controls,
.fork-reveal,
.share-reveal,
.state-background,
.reveal .progress,
.reveal .backgrounds,
.reveal .slide-number {
display: none !important;
}
/* SECTION 3: Set body font face, size, and color.
Consider using a serif font for readability. */
body, p, td, li, div {
font-size: 20pt!important;
font-family: Georgia, "Times New Roman", Times, serif !important;
color: #000;
}
/* SECTION 4: Set heading font face, sizes, and color.
Differentiate your headings from your body text.
Perhaps use a large sans-serif for distinction. */
h1,h2,h3,h4,h5,h6 {
color: #000!important;
height: auto;
line-height: normal;
font-family: Georgia, "Times New Roman", Times, serif !important;
text-shadow: 0 0 0 #000 !important;
text-align: left;
letter-spacing: normal;
}
/* Need to reduce the size of the fonts for printing */
h1 { font-size: 28pt !important; }
h2 { font-size: 24pt !important; }
h3 { font-size: 22pt !important; }
h4 { font-size: 22pt !important; font-variant: small-caps; }
h5 { font-size: 21pt !important; }
h6 { font-size: 20pt !important; font-style: italic; }
/* SECTION 5: Make hyperlinks more usable.
Ensure links are underlined, and consider appending
the URL to the end of the link for usability. */
a:link,
a:visited {
color: #000 !important;
font-weight: bold;
text-decoration: underline;
}
/*
.reveal a:link:after,
.reveal a:visited:after {
content: " (" attr(href) ") ";
color: #222 !important;
font-size: 90%;
}
*/
/* SECTION 6: more reveal.js specific additions by @skypanther */
ul, ol, div, p {
visibility: visible;
position: static;
width: auto;
height: auto;
display: block;
overflow: visible;
margin: 0;
text-align: left !important;
}
.reveal pre,
.reveal table {
margin-left: 0;
margin-right: 0;
}
.reveal pre code {
padding: 20px;
border: 1px solid #ddd;
}
.reveal blockquote {
margin: 20px 0;
}
.reveal .slides {
position: static !important;
width: auto !important;
height: auto !important;
left: 0 !important;
top: 0 !important;
margin-left: 0 !important;
margin-top: 0 !important;
padding: 0 !important;
zoom: 1 !important;
overflow: visible !important;
display: block !important;
text-align: left !important;
-webkit-perspective: none;
-moz-perspective: none;
-ms-perspective: none;
perspective: none;
-webkit-perspective-origin: 50% 50%;
-moz-perspective-origin: 50% 50%;
-ms-perspective-origin: 50% 50%;
perspective-origin: 50% 50%;
}
.reveal .slides section {
visibility: visible !important;
position: static !important;
width: auto !important;
height: auto !important;
display: block !important;
overflow: visible !important;
left: 0 !important;
top: 0 !important;
margin-left: 0 !important;
margin-top: 0 !important;
padding: 60px 20px !important;
z-index: auto !important;
opacity: 1 !important;
page-break-after: always !important;
-webkit-transform-style: flat !important;
-moz-transform-style: flat !important;
-ms-transform-style: flat !important;
transform-style: flat !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
transform: none !important;
-webkit-transition: none !important;
-moz-transition: none !important;
-ms-transition: none !important;
transition: none !important;
}
.reveal .slides section.stack {
padding: 0 !important;
}
.reveal section:last-of-type {
page-break-after: avoid !important;
}
.reveal section .fragment {
opacity: 1 !important;
visibility: visible !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
transform: none !important;
}
.reveal section img {
display: block;
margin: 15px 0px;
background: rgba(255,255,255,1);
border: 1px solid #666;
box-shadow: none;
}
.reveal section small {
font-size: 0.8em;
}
}
@@ -0,0 +1,178 @@
/**
* This stylesheet is used to print reveal.js
* presentations to PDF.
*
* https://github.com/hakimel/reveal.js#pdf-export
*/
* {
-webkit-print-color-adjust: exact;
}
body {
margin: 0 auto !important;
border: 0;
padding: 0;
float: none !important;
overflow: visible;
}
html {
width: 100%;
height: 100%;
overflow: visible;
}
/* Remove any elements not needed in print. */
.nestedarrow,
.reveal .controls,
.reveal .progress,
.reveal .playback,
.reveal.overview,
.fork-reveal,
.share-reveal,
.state-background {
display: none !important;
}
h1, h2, h3, h4, h5, h6 {
text-shadow: 0 0 0 #000 !important;
}
.reveal pre code {
overflow: hidden !important;
font-family: Courier, 'Courier New', monospace !important;
}
ul, ol, div, p {
visibility: visible;
position: static;
width: auto;
height: auto;
display: block;
overflow: visible;
margin: auto;
}
.reveal {
width: auto !important;
height: auto !important;
overflow: hidden !important;
}
.reveal .slides {
position: static;
width: 100% !important;
height: auto !important;
zoom: 1 !important;
left: auto;
top: auto;
margin: 0 !important;
padding: 0 !important;
overflow: visible;
display: block;
-webkit-perspective: none;
-moz-perspective: none;
-ms-perspective: none;
perspective: none;
-webkit-perspective-origin: 50% 50%; /* there isn't a none/auto value but 50-50 is the default */
-moz-perspective-origin: 50% 50%;
-ms-perspective-origin: 50% 50%;
perspective-origin: 50% 50%;
}
.reveal .slides .pdf-page {
position: relative;
overflow: hidden;
z-index: 1;
page-break-after: always;
}
.reveal .slides section {
visibility: visible !important;
display: block !important;
position: absolute !important;
margin: 0 !important;
padding: 0 !important;
box-sizing: border-box !important;
min-height: 1px;
opacity: 1 !important;
-webkit-transform-style: flat !important;
-moz-transform-style: flat !important;
-ms-transform-style: flat !important;
transform-style: flat !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
transform: none !important;
}
.reveal section.stack {
position: relative !important;
margin: 0 !important;
padding: 0 !important;
page-break-after: avoid !important;
height: auto !important;
min-height: auto !important;
}
.reveal img {
box-shadow: none;
}
.reveal .roll {
overflow: visible;
line-height: 1em;
}
/* Slide backgrounds are placed inside of their slide when exporting to PDF */
.reveal .slide-background {
display: block !important;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: auto !important;
}
/* Display slide speaker notes when 'showNotes' is enabled */
.reveal.show-notes {
max-width: none;
max-height: none;
}
.reveal .speaker-notes-pdf {
display: block;
width: 100%;
height: auto;
max-height: none;
top: auto;
right: auto;
bottom: auto;
left: auto;
z-index: 100;
}
/* Layout option which makes notes appear on a separate page */
.reveal .speaker-notes-pdf[data-layout="separate-page"] {
position: relative;
color: inherit;
background-color: transparent;
padding: 20px;
page-break-after: always;
border: 0;
}
/* Display slide numbers when 'slideNumber' is enabled */
.reveal .slide-number-pdf {
display: block;
position: absolute;
font-size: 14px;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,21 @@
## Dependencies
Themes are written using Sass to keep things modular and reduce the need for repeated selectors across files. Make sure that you have the reveal.js development environment including the Grunt dependencies installed before proceeding: https://github.com/hakimel/reveal.js#full-setup
## Creating a Theme
To create your own theme, start by duplicating a ```.scss``` file in [/css/theme/source](https://github.com/hakimel/reveal.js/blob/master/css/theme/source). It will be automatically compiled by Grunt from Sass to CSS (see the [Gruntfile](https://github.com/hakimel/reveal.js/blob/master/Gruntfile.js)) when you run `npm run build -- css-themes`.
Each theme file does four things in the following order:
1. **Include [/css/theme/template/mixins.scss](https://github.com/hakimel/reveal.js/blob/master/css/theme/template/mixins.scss)**
Shared utility functions.
2. **Include [/css/theme/template/settings.scss](https://github.com/hakimel/reveal.js/blob/master/css/theme/template/settings.scss)**
Declares a set of custom variables that the template file (step 4) expects. Can be overridden in step 3.
3. **Override**
This is where you override the default theme. Either by specifying variables (see [settings.scss](https://github.com/hakimel/reveal.js/blob/master/css/theme/template/settings.scss) for reference) or by adding any selectors and styles you please.
4. **Include [/css/theme/template/theme.scss](https://github.com/hakimel/reveal.js/blob/master/css/theme/template/theme.scss)**
The template theme file which will generate final CSS output based on the currently defined variables.
@@ -0,0 +1,154 @@
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* Beige theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
@font-face {
font-family: 'League Gothic';
src: url("../../lib/font/league_gothic-webfont.eot");
src: url("../../lib/font/league_gothic-webfont.eot?#iefix") format("embedded-opentype"), url("../../lib/font/league_gothic-webfont.woff") format("woff"), url("../../lib/font/league_gothic-webfont.ttf") format("truetype"), url("../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular") format("svg");
font-weight: normal;
font-style: normal; }
/* changed (by hpl) from #333; */
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #f7f2d3;
background: -moz-radial-gradient(center, circle cover, white 0%, #f7f2d3 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, white), color-stop(100%, #f7f2d3));
background: -webkit-radial-gradient(center, circle cover, white 0%, #f7f2d3 100%);
background: -o-radial-gradient(center, circle cover, white 0%, #f7f2d3 100%);
background: -ms-radial-gradient(center, circle cover, white 0%, #f7f2d3 100%);
background: radial-gradient(center, circle cover, white 0%, #f7f2d3 100%);
background-color: #f7f3de; }
.reveal {
font-family: "Lato", sans-serif;
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: #333333; }
::selection {
color: white;
background: rgba(79, 64, 28, 0.99);
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #222222;
font-family: "Helvetica", Impact, sans-serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: 0.02em;
text-transform: none;
text-shadow: none; }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0 1px 0 #cccccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbbbbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaaaaa, 0 6px 1px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2), 0 5px 10px rgba(0, 0, 0, 0.25), 0 20px 20px rgba(0, 0, 0, 0.15); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #8b743d;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #c0a86e;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #564826; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #333333;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #8b743d;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #8b743d; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #8b743d; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #8b743d; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #8b743d; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #c0a86e; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #c0a86e; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #c0a86e; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #c0a86e; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #8b743d;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #8b743d; }
@@ -0,0 +1,155 @@
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* Beige theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
@font-face {
font-family: 'League Gothic';
src: url("../../lib/font/league_gothic-webfont.eot");
src: url("../../lib/font/league_gothic-webfont.eot?#iefix") format("embedded-opentype"), url("../../lib/font/league_gothic-webfont.woff") format("woff"), url("../../lib/font/league_gothic-webfont.ttf") format("truetype"), url("../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular") format("svg");
font-weight: normal;
font-style: normal; }
/* added/changed by hpl */
/* changed (by hpl) from #333; */
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #f7f2d3;
background: -moz-radial-gradient(center, circle cover, white 0%, #f7f2d3 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, white), color-stop(100%, #f7f2d3));
background: -webkit-radial-gradient(center, circle cover, white 0%, #f7f2d3 100%);
background: -o-radial-gradient(center, circle cover, white 0%, #f7f2d3 100%);
background: -ms-radial-gradient(center, circle cover, white 0%, #f7f2d3 100%);
background: radial-gradient(center, circle cover, white 0%, #f7f2d3 100%);
background-color: #f7f3de; }
.reveal {
font-family: "Lato", sans-serif;
font-size: 25px;
font-weight: normal;
letter-spacing: -0.02em;
color: #333333; }
::selection {
color: white;
background: rgba(79, 64, 28, 0.99);
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #222222;
font-family: "Helvetica", Impact, sans-serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: 0.02em;
text-transform: none;
text-shadow: none; }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0 1px 0 #cccccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbbbbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaaaaa, 0 6px 1px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2), 0 5px 10px rgba(0, 0, 0, 0.25), 0 20px 20px rgba(0, 0, 0, 0.15); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #8b743d;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #c0a86e;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #564826; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #333333;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #8b743d;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #8b743d; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #8b743d; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #8b743d; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #8b743d; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #c0a86e; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #c0a86e; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #c0a86e; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #c0a86e; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #8b743d;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #8b743d; }
@@ -0,0 +1,273 @@
@import url(../../lib/font/source-sans-pro/source-sans-pro.css);
/**
* Black theme for reveal.js. This is the opposite of the 'white' theme.
*
* Copyright (C) 2015 Hakim El Hattab, http://hakim.se
*/
section.has-light-background, section.has-light-background h1, section.has-light-background h2, section.has-light-background h3, section.has-light-background h4, section.has-light-background h5, section.has-light-background h6 {
color: #222; }
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #222;
background-color: #222; }
.reveal {
font-family: 'Source Sans Pro', Helvetica, sans-serif;
font-size: 30px; /* changed by hpl from 38px */
font-weight: normal;
color: #fff; }
::selection {
color: #fff;
background: #bee4fd;
text-shadow: none; }
.reveal .slides > section, .reveal .slides > section > section {
/* removed by hpl: line-height: 1.3; */
font-weight: inherit; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6 {
margin: 0 0 20px 0;
color: #fff;
font-family: 'Source Sans Pro', Helvetica, sans-serif;
font-weight: 600;
line-height: 1.1em; /* changed by hpl from 1.2; */
letter-spacing: normal;
/* text-transform: uppercase; removed by hpl */
text-shadow: none;
word-wrap: break-word; }
.reveal h1 {
line-height: 1.2em;
}
/* Removed by hpl
.reveal h1 {
font-size: 2.5em; }
.reveal h2 {
font-size: 1.6em; }
.reveal h3 {
font-size: 1.3em; }
.reveal h4 {
font-size: 1em; }
*/
.reveal h1 {
text-shadow: none; }
/*********************************************
* OTHER
*********************************************/
.reveal p {
margin: 20px 0;
line-height: 1.3; }
/* Ensure certain elements are never larger than the slide itself */
.reveal img, .reveal video, .reveal iframe {
max-width: 95%;
max-height: 95%; }
.reveal strong, .reveal b {
font-weight: bold; }
.reveal em {
font-style: italic; }
.reveal ol, .reveal dl, .reveal ul {
display: inline-block;
text-align: left;
margin: 0 0 0 1em; }
.reveal ol {
list-style-type: decimal; }
.reveal ul {
list-style-type: disc; }
.reveal ul ul {
list-style-type: square; }
.reveal ul ul ul {
list-style-type: circle; }
.reveal ul ul, .reveal ul ol, .reveal ol ol, .reveal ol ul {
display: block;
margin-left: 40px; }
.reveal dt {
font-weight: bold; }
.reveal dd {
margin-left: 40px; }
.reveal q, .reveal blockquote {
quotes: none; }
.reveal blockquote {
display: block;
position: relative;
width: 70%;
margin: 20px auto;
padding: 5px;
font-style: italic;
background: rgba(255, 255, 255, 0.05);
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.2); }
.reveal blockquote p:first-child, .reveal blockquote p:last-child {
display: inline-block; }
.reveal q {
font-style: italic; }
.reveal pre {
display: block;
position: relative;
width: 90%;
margin: 20px auto;
text-align: left;
font-size: 0.55em;
font-family: monospace;
line-height: 1.2em;
word-wrap: break-word;
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); }
.reveal code {
font-family: monospace; }
.reveal pre code {
display: block;
padding: 5px;
overflow: auto;
max-height: 400px;
word-wrap: normal;
background: #3F3F3F;
color: #DCDCDC; }
.reveal table {
margin: auto;
border-collapse: collapse;
border-spacing: 0; }
.reveal table th {
font-weight: bold; }
.reveal table th, .reveal table td {
/*text-align: left; */ /* hpl modification */
padding: 0.2em 0.5em 0.2em 0.5em;
border-bottom: 1px solid; }
.reveal table th[align="center"], .reveal table td[align="center"] {
text-align: center; }
.reveal table th[align="right"], .reveal table td[align="right"] {
text-align: right; }
.reveal table tr:last-child td {
border-bottom: none; }
.reveal sup {
vertical-align: super; }
.reveal sub {
vertical-align: sub; }
.reveal small {
display: inline-block;
font-size: 0.6em;
line-height: 1.2em;
vertical-align: top; }
.reveal small * {
vertical-align: top; }
/*********************************************
* LINKS
*********************************************/
.reveal a {
color: #42affa;
text-decoration: none;
-webkit-transition: color 0.15s ease;
-moz-transition: color 0.15s ease;
transition: color 0.15s ease; }
.reveal a:hover {
color: #8dcffc;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #068ee9; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); }
.reveal a img {
-webkit-transition: all 0.15s linear;
-moz-transition: all 0.15s linear;
transition: all 0.15s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #42affa;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left, .reveal .controls div.navigate-left.enabled {
border-right-color: #42affa; }
.reveal .controls div.navigate-right, .reveal .controls div.navigate-right.enabled {
border-left-color: #42affa; }
.reveal .controls div.navigate-up, .reveal .controls div.navigate-up.enabled {
border-bottom-color: #42affa; }
.reveal .controls div.navigate-down, .reveal .controls div.navigate-down.enabled {
border-top-color: #42affa; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #8dcffc; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #8dcffc; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #8dcffc; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #8dcffc; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #42affa;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #42affa; }
@@ -0,0 +1,180 @@
@import url(https://fonts.googleapis.com/css?family=Ubuntu:300,700,300italic,700italic);
/**
* Blood theme for reveal.js
* Author: Walther http://github.com/Walther
*
* Designed to be used with highlight.js theme
* "monokai_sublime.css" available from
* https://github.com/isagalaev/highlight.js/
*
* For other themes, change $codeBackground accordingly.
*
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #222222;
background: -moz-radial-gradient(center, circle cover, #626262 0%, #222222 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #626262), color-stop(100%, #222222));
background: -webkit-radial-gradient(center, circle cover, #626262 0%, #222222 100%);
background: -o-radial-gradient(center, circle cover, #626262 0%, #222222 100%);
background: -ms-radial-gradient(center, circle cover, #626262 0%, #222222 100%);
background: radial-gradient(center, circle cover, #626262 0%, #222222 100%);
background-color: #2b2b2b; }
.reveal {
font-family: Ubuntu, "sans-serif";
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: #eeeeee; }
::selection {
color: white;
background: #aa2233;
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #eeeeee;
font-family: Ubuntu, "sans-serif";
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: 0.02em;
text-transform: none;
text-shadow: 2px 2px 2px #222222; }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0 1px 0 #cccccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbbbbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaaaaa, 0 6px 1px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2), 0 5px 10px rgba(0, 0, 0, 0.25), 0 20px 20px rgba(0, 0, 0, 0.15); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #aa2233;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #dd5566;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #6a1520; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #eeeeee;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #aa2233;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #aa2233; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #aa2233; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #aa2233; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #aa2233; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #dd5566; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #dd5566; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #dd5566; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #dd5566; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #aa2233;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #aa2233; }
.reveal p {
font-weight: 300;
text-shadow: 1px 1px #222222; }
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
font-weight: 700; }
.reveal a:not(.image),
.reveal a:not(.image):hover {
text-shadow: 2px 2px 2px #000; }
.reveal small a:not(.image),
.reveal small a:not(.image):hover {
text-shadow: 1px 1px 1px #000; }
.reveal p code {
background-color: #23241f;
display: inline-block;
border-radius: 7px; }
.reveal small code {
vertical-align: baseline; }
@@ -0,0 +1,144 @@
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is darkblue.
*
* This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed.
* reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
* Center for Biomedical Computing theme made by Hans Petter Langtangen.
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: white;
background-color: white; }
.reveal {
font-family: "Lato", sans-serif;
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: #404040; }
::selection {
color: white;
background: rgba(0, 0, 0, 0.99);
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #8a0808;
font-family: "Helvetica", Impact, sans-serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: 0.02em;
text-transform: none;
text-shadow: none; }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #8a0808;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #ea0e0e;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #420404; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #404040;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #8a0808;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #8a0808; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #8a0808; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #8a0808; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #8a0808; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #ea0e0e; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #ea0e0e; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #ea0e0e; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #ea0e0e; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #8a0808;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #8a0808; }
@@ -0,0 +1,153 @@
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* Default theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
@font-face {
font-family: 'League Gothic';
src: url("../../lib/font/league_gothic-webfont.eot");
src: url("../../lib/font/league_gothic-webfont.eot?#iefix") format("embedded-opentype"), url("../../lib/font/league_gothic-webfont.woff") format("woff"), url("../../lib/font/league_gothic-webfont.ttf") format("truetype"), url("../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular") format("svg");
font-weight: normal;
font-style: normal; }
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #1c1e20;
background: -moz-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #555a5f), color-stop(100%, #1c1e20));
background: -webkit-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: -o-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: -ms-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background-color: #2b2b2b; }
.reveal {
font-family: "Lato", sans-serif;
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: #eeeeee; }
::selection {
color: white;
background: #ff5e99;
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #eeeeee;
font-family: "Helvetica", Impact, sans-serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: 0.02em;
text-transform: none;
text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0 1px 0 #cccccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbbbbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaaaaa, 0 6px 1px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2), 0 5px 10px rgba(0, 0, 0, 0.25), 0 20px 20px rgba(0, 0, 0, 0.15); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #13daec;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #71e9f4;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #0d99a5; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #eeeeee;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #13daec;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #13daec; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #13daec; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #13daec; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #13daec; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #71e9f4; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #71e9f4; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #71e9f4; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #71e9f4; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #13daec;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #13daec; }
@@ -0,0 +1,153 @@
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* Default theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
@font-face {
font-family: 'League Gothic';
src: url("../../lib/font/league_gothic-webfont.eot");
src: url("../../lib/font/league_gothic-webfont.eot?#iefix") format("embedded-opentype"), url("../../lib/font/league_gothic-webfont.woff") format("woff"), url("../../lib/font/league_gothic-webfont.ttf") format("truetype"), url("../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular") format("svg");
font-weight: normal;
font-style: normal; }
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #1c1e20;
background: -moz-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #555a5f), color-stop(100%, #1c1e20));
background: -webkit-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: -o-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: -ms-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background-color: #2b2b2b; }
.reveal {
font-family: "Lato", sans-serif;
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: #eeeeee; }
::selection {
color: white;
background: #ff5e99;
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #eeeeee;
font-family: "Helvetica", Impact, sans-serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: 0.02em;
text-transform: none;
text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0 1px 0 #cccccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbbbbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaaaaa, 0 6px 1px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2), 0 5px 10px rgba(0, 0, 0, 0.25), 0 20px 20px rgba(0, 0, 0, 0.15); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #13daec;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #71e9f4;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #0d99a5; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #eeeeee;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #13daec;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #13daec; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #13daec; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #13daec; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #13daec; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #71e9f4; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #71e9f4; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #71e9f4; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #71e9f4; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #13daec;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #13daec; }
@@ -0,0 +1,279 @@
@import url(../../lib/font/league-gothic/league-gothic.css);
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* League theme for reveal.js.
*
* This was the default theme pre-3.0.0.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #1c1e20;
background: -moz-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #555a5f), color-stop(100%, #1c1e20));
background: -webkit-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: -o-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: -ms-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background: radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%);
background-color: #2b2b2b; }
.reveal {
font-family: 'Lato', sans-serif;
font-size: 30px; /* changed by hpl from 36px */
font-weight: normal;
color: #eee; }
::selection {
color: #fff;
background: #FF5E99;
text-shadow: none; }
.reveal .slides > section, .reveal .slides > section > section {
/* removed by hpl: line-height: 1.3; */
font-weight: inherit; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6 {
margin: 0 0 20px 0;
color: #eee;
font-family: 'Helvetica', Impact, sans-serif;
font-weight: normal;
line-height: 1.1em; /* changed by hpl from 1.2; */
letter-spacing: normal;
/* text-transform: uppercase; removed by hpl */
text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2);
word-wrap: break-word; }
.reveal h1 {
line-height: 1.2em;
}
/* removed by hpl:
.reveal h1 {
font-size: 3.77em; }
.reveal h2 {
font-size: 2.11em; }
.reveal h3 {
font-size: 1.55em; }
.reveal h4 {
font-size: 1em; }
*/
.reveal h1 {
text-shadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2), 0 5px 10px rgba(0, 0, 0, 0.25), 0 20px 20px rgba(0, 0, 0, 0.15); }
/*********************************************
* OTHER
*********************************************/
.reveal p {
margin: 20px 0;
line-height: 1.3; }
/* Ensure certain elements are never larger than the slide itself */
.reveal img, .reveal video, .reveal iframe {
max-width: 95%;
max-height: 95%; }
.reveal strong, .reveal b {
font-weight: bold; }
.reveal em {
font-style: italic; }
.reveal ol, .reveal dl, .reveal ul {
display: inline-block;
text-align: left;
margin: 0 0 0 1em; }
.reveal ol {
list-style-type: decimal; }
.reveal ul {
list-style-type: disc; }
.reveal ul ul {
list-style-type: square; }
.reveal ul ul ul {
list-style-type: circle; }
.reveal ul ul, .reveal ul ol, .reveal ol ol, .reveal ol ul {
display: block;
margin-left: 40px; }
.reveal dt {
font-weight: bold; }
.reveal dd {
margin-left: 40px; }
.reveal q, .reveal blockquote {
quotes: none; }
.reveal blockquote {
display: block;
position: relative;
width: 70%;
margin: 20px auto;
padding: 5px;
font-style: italic;
background: rgba(255, 255, 255, 0.05);
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.2); }
.reveal blockquote p:first-child, .reveal blockquote p:last-child {
display: inline-block; }
.reveal q {
font-style: italic; }
.reveal pre {
display: block;
position: relative;
width: 90%;
margin: 20px auto;
text-align: left;
font-size: 0.55em;
font-family: monospace;
line-height: 1.2em;
word-wrap: break-word;
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); }
.reveal code {
font-family: monospace; }
.reveal pre code {
display: block;
padding: 5px;
overflow: auto;
max-height: 400px;
word-wrap: normal;
background: #3F3F3F;
color: #DCDCDC; }
.reveal table {
margin: auto;
border-collapse: collapse;
border-spacing: 0; }
.reveal table th {
font-weight: bold; }
.reveal table th, .reveal table td {
/* text-align: left; */ /* hpl modification */
padding: 0.2em 0.5em 0.2em 0.5em;
border-bottom: 1px solid; }
.reveal table th[align="center"], .reveal table td[align="center"] {
text-align: center; }
.reveal table th[align="right"], .reveal table td[align="right"] {
text-align: right; }
.reveal table tr:last-child td {
border-bottom: none; }
.reveal sup {
vertical-align: super; }
.reveal sub {
vertical-align: sub; }
.reveal small {
display: inline-block;
font-size: 0.6em;
line-height: 1.2em;
vertical-align: top; }
.reveal small * {
vertical-align: top; }
/*********************************************
* LINKS
*********************************************/
.reveal a {
color: #13DAEC;
text-decoration: none;
-webkit-transition: color 0.15s ease;
-moz-transition: color 0.15s ease;
transition: color 0.15s ease; }
.reveal a:hover {
color: #71ebf4;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #0d9ba5; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #eee;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); }
.reveal a img {
-webkit-transition: all 0.15s linear;
-moz-transition: all 0.15s linear;
transition: all 0.15s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #13DAEC;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left, .reveal .controls div.navigate-left.enabled {
border-right-color: #13DAEC; }
.reveal .controls div.navigate-right, .reveal .controls div.navigate-right.enabled {
border-left-color: #13DAEC; }
.reveal .controls div.navigate-up, .reveal .controls div.navigate-up.enabled {
border-bottom-color: #13DAEC; }
.reveal .controls div.navigate-down, .reveal .controls div.navigate-down.enabled {
border-top-color: #13DAEC; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #71ebf4; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #71ebf4; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #71ebf4; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #71ebf4; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #13DAEC;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #13DAEC; }
@@ -0,0 +1,153 @@
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* Solarized Dark theme for reveal.js.
* Author: Achim Staebler
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
@font-face {
font-family: 'League Gothic';
src: url("../../lib/font/league_gothic-webfont.eot");
src: url("../../lib/font/league_gothic-webfont.eot?#iefix") format("embedded-opentype"), url("../../lib/font/league_gothic-webfont.woff") format("woff"), url("../../lib/font/league_gothic-webfont.ttf") format("truetype"), url("../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular") format("svg");
font-weight: normal;
font-style: normal; }
/**
* Solarized colors by Ethan Schoonover
*/
html * {
color-profile: sRGB;
rendering-intent: auto; }
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #002b36;
background-color: #002b36; }
.reveal {
font-family: "Lato", sans-serif;
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: #93a1a1; }
::selection {
color: white;
background: #d33682;
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #eee8d5;
font-family: "Helvetica", Impact, sans-serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: 0.02em;
text-transform: none;
text-shadow: none; }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #268bd2;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #78b9e6;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #1a6091; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #93a1a1;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #268bd2;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #268bd2; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #268bd2; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #268bd2; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #268bd2; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #78b9e6; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #78b9e6; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #78b9e6; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #78b9e6; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #268bd2;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #268bd2; }
@@ -0,0 +1,141 @@
@import url(https://fonts.googleapis.com/css?family=Montserrat:700);
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic);
/**
* Black theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #111111;
background-color: #111111; }
.reveal {
font-family: "Open Sans", sans-serif;
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: #eeeeee; }
::selection {
color: white;
background: #e7ad52;
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #eeeeee;
font-family: "Montserrat", Impact, sans-serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: -0.03em;
text-transform: none;
text-shadow: none; }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #e7ad52;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #f3d7ac;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #d08a1d; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #eeeeee;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #e7ad52;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #e7ad52; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #e7ad52; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #e7ad52; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #e7ad52; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #f3d7ac; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #f3d7ac; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #f3d7ac; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #f3d7ac; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #e7ad52;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #e7ad52; }
@@ -0,0 +1,143 @@
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is brown.
*
* This theme is Copyright (C) 2012-2013 Owen Versteeg, http://owenversteeg.com - it is MIT licensed.
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
.reveal a:not(.image) {
line-height: 1.3em; }
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #f0f1eb;
background-color: #f0f1eb; }
.reveal {
font-family: "Palatino Linotype", "Book Antiqua", Palatino, FreeSerif, serif;
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: black; }
::selection {
color: white;
background: #26351c;
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #383d3d;
font-family: "Palatino Linotype", "Book Antiqua", Palatino, FreeSerif, serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: 0.02em;
text-transform: none;
text-shadow: none; }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #51483d;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #8b7c69;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #25211c; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid black;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #51483d;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #51483d; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #51483d; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #51483d; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #51483d; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #8b7c69; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #8b7c69; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #8b7c69; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #8b7c69; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #51483d;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #51483d; }
@@ -0,0 +1,144 @@
@import url(https://fonts.googleapis.com/css?family=News+Cycle:400,700);
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is darkblue.
*
* This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed.
* reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
/* changed (by hpl) from 'News Cycle', Impact, sans-serif; */
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: white;
background-color: white; }
.reveal {
font-family: "Lato", sans-serif;
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: black; }
::selection {
color: white;
background: rgba(0, 0, 0, 0.99);
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: black;
font-family: "Helvetica", Impact, sans-serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: 0.02em;
text-transform: none;
text-shadow: none; }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: darkblue;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #0000f1;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #00003f; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid black;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: darkblue;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: darkblue; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: darkblue; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: darkblue; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: darkblue; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #0000f1; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #0000f1; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #0000f1; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #0000f1; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: darkblue;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: darkblue; }
@@ -0,0 +1,144 @@
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is darkblue.
*
* This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed.
* reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
* Simula theme made by Hans Petter Langtangen.
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: white;
background-color: white; }
.reveal {
font-family: "Lato", sans-serif;
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: #404040; }
::selection {
color: white;
background: rgba(0, 0, 0, 0.99);
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #ff8800;
font-family: "Helvetica", Impact, sans-serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: 0.02em;
text-transform: none;
text-shadow: none; }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #ff8800;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #ffb866;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #b35f00; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #404040;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #ff8800;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #ff8800; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #ff8800; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #ff8800; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #ff8800; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #ffb866; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #ffb866; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #ffb866; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #ffb866; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #ff8800;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #ff8800; }
@@ -0,0 +1,150 @@
@import url(https://fonts.googleapis.com/css?family=Quicksand:400,700,400italic,700italic);
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700);
/**
* Sky theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
.reveal a:not(.image) {
line-height: 1.3em; }
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #add9e4;
background: -moz-radial-gradient(center, circle cover, #f7fbfc 0%, #add9e4 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #f7fbfc), color-stop(100%, #add9e4));
background: -webkit-radial-gradient(center, circle cover, #f7fbfc 0%, #add9e4 100%);
background: -o-radial-gradient(center, circle cover, #f7fbfc 0%, #add9e4 100%);
background: -ms-radial-gradient(center, circle cover, #f7fbfc 0%, #add9e4 100%);
background: radial-gradient(center, circle cover, #f7fbfc 0%, #add9e4 100%);
background-color: #f7fbfc; }
.reveal {
font-family: "Open Sans", sans-serif;
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: #333333; }
::selection {
color: white;
background: #134674;
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #333333;
font-family: "Quicksand", sans-serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: -0.08em;
text-transform: none;
text-shadow: none; }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #3b759e;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #74a7cb;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #264c66; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #333333;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #3b759e;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #3b759e; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #3b759e; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #3b759e; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #3b759e; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #74a7cb; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #74a7cb; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #74a7cb; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #74a7cb; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #3b759e;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #3b759e; }
@@ -0,0 +1,153 @@
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* Solarized Light theme for reveal.js.
* Author: Achim Staebler
*/
/* changed by hpl from 36px; */
/* changed by hpl from 'League Gothic', Impact, sans-serif; */
/* changed by hpl from uppercase; */
@font-face {
font-family: 'League Gothic';
src: url("../../lib/font/league_gothic-webfont.eot");
src: url("../../lib/font/league_gothic-webfont.eot?#iefix") format("embedded-opentype"), url("../../lib/font/league_gothic-webfont.woff") format("woff"), url("../../lib/font/league_gothic-webfont.ttf") format("truetype"), url("../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular") format("svg");
font-weight: normal;
font-style: normal; }
/**
* Solarized colors by Ethan Schoonover
*/
html * {
color-profile: sRGB;
rendering-intent: auto; }
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #fdf6e3;
background-color: #fdf6e3; }
.reveal {
font-family: "Lato", sans-serif;
font-size: 30px;
font-weight: normal;
letter-spacing: -0.02em;
color: #657b83; }
::selection {
color: white;
background: #d33682;
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: 0 0 20px 0;
color: #586e75;
font-family: "Helvetica", Impact, sans-serif;
line-height: 1.1em; /* changed (by hpl) from 0.9em */
letter-spacing: 0.02em;
text-transform: none;
text-shadow: none; }
.reveal h1 {
line-height: 1.2em;
/* added by hpl */
text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); }
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #268bd2;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #78b9e6;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #1a6091; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #657b83;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #268bd2;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left,
.reveal .controls div.navigate-left.enabled {
border-right-color: #268bd2; }
.reveal .controls div.navigate-right,
.reveal .controls div.navigate-right.enabled {
border-left-color: #268bd2; }
.reveal .controls div.navigate-up,
.reveal .controls div.navigate-up.enabled {
border-bottom-color: #268bd2; }
.reveal .controls div.navigate-down,
.reveal .controls div.navigate-down.enabled {
border-top-color: #268bd2; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #78b9e6; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #78b9e6; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #78b9e6; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #78b9e6; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #268bd2;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #268bd2; }
@@ -0,0 +1,50 @@
/**
* Beige theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@font-face {
font-family: 'League Gothic';
src: url('../../lib/font/league_gothic-webfont.eot');
src: url('../../lib/font/league_gothic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../lib/font/league_gothic-webfont.woff') format('woff'),
url('../../lib/font/league_gothic-webfont.ttf') format('truetype'),
url('../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
// Override theme settings (see ../template/settings.scss)
$mainColor: #333;
$headingColor: #222; /* changed (by hpl) from #333; */
$headingTextShadow: none;
$backgroundColor: #f7f3de;
$linkColor: #8b743d;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: rgba(79, 64, 28, 0.99);
$heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15);
// Background generator
@mixin bodyBackground() {
@include radial-gradient( rgba(247,242,211,1), rgba(255,255,255,1) );
}
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,51 @@
/**
* Beige theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@font-face {
font-family: 'League Gothic';
src: url('../../lib/font/league_gothic-webfont.eot');
src: url('../../lib/font/league_gothic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../lib/font/league_gothic-webfont.woff') format('woff'),
url('../../lib/font/league_gothic-webfont.ttf') format('truetype'),
url('../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
// Override theme settings (see ../template/settings.scss)
$mainColor: #333;
$mainFontSize: 25px; /* added/changed by hpl */
$headingColor: #222; /* changed (by hpl) from #333; */
$headingTextShadow: none;
$backgroundColor: #f7f3de;
$linkColor: #8b743d;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: rgba(79, 64, 28, 0.99);
$heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15);
// Background generator
@mixin bodyBackground() {
@include radial-gradient( rgba(247,242,211,1), rgba(255,255,255,1) );
}
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,49 @@
/**
* Black theme for reveal.js. This is the opposite of the 'white' theme.
*
* By Hakim El Hattab, http://hakim.se
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@import url(../../lib/font/source-sans-pro/source-sans-pro.css);
// Override theme settings (see ../template/settings.scss)
$backgroundColor: #222;
$mainColor: #fff;
$headingColor: #fff;
$mainFontSize: 42px;
$mainFont: 'Source Sans Pro', Helvetica, sans-serif;
$headingFont: 'Source Sans Pro', Helvetica, sans-serif;
$headingTextShadow: none;
$headingLetterSpacing: normal;
$headingTextTransform: uppercase;
$headingFontWeight: 600;
$linkColor: #42affa;
$linkColorHover: lighten( $linkColor, 15% );
$selectionBackgroundColor: lighten( $linkColor, 25% );
$heading1Size: 2.5em;
$heading2Size: 1.6em;
$heading3Size: 1.3em;
$heading4Size: 1.0em;
section.has-light-background {
&, h1, h2, h3, h4, h5, h6 {
color: #222;
}
}
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,91 @@
/**
* Blood theme for reveal.js
* Author: Walther http://github.com/Walther
*
* Designed to be used with highlight.js theme
* "monokai_sublime.css" available from
* https://github.com/isagalaev/highlight.js/
*
* For other themes, change $codeBackground accordingly.
*
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@import url(https://fonts.googleapis.com/css?family=Ubuntu:300,700,300italic,700italic);
// Colors used in the theme
$blood: #a23;
$coal: #222;
$codeBackground: #23241f;
// Main text
$mainFont: Ubuntu, 'sans-serif';
$mainFontSize: 30px;
$mainColor: #eee;
// Headings
$headingFont: Ubuntu, 'sans-serif';
$headingTextShadow: 2px 2px 2px $coal;
// h1 shadow, borrowed humbly from
// (c) Default theme by Hakim El Hattab
$heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15);
// Links
$linkColor: $blood;
$linkColorHover: lighten( $linkColor, 20% );
// Text selection
$selectionBackgroundColor: $blood;
$selectionColor: #fff;
// Background generator
@mixin bodyBackground() {
@include radial-gradient( $coal, lighten( $coal, 25% ) );
}
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
// some overrides after theme template import
.reveal p {
font-weight: 300;
text-shadow: 1px 1px $coal;
}
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
font-weight: 700;
}
.reveal a:not(.image),
.reveal a:not(.image):hover {
text-shadow: 2px 2px 2px #000;
}
.reveal small a:not(.image),
.reveal small a:not(.image):hover {
text-shadow: 1px 1px 1px #000;
}
.reveal p code {
background-color: $codeBackground;
display: inline-block;
border-radius: 7px;
}
.reveal small code {
vertical-align: baseline;
}
@@ -0,0 +1,39 @@
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is darkblue.
*
* This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed.
* reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
* Center for Biomedical Computing theme made by Hans Petter Langtangen.
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
// Override theme settings (see ../template/settings.scss)
$mainFont: 'Lato', sans-serif;
$mainColor: #404040;
$headingFont: 'Helvetica', Impact, sans-serif;
$headingColor: #8A0808;
$headingTextShadow: none;
$headingTextTransform: none;
$backgroundColor: #fff;
$linkColor: #8A0808;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: rgba(0, 0, 0, 0.99);
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,42 @@
/**
* Default theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@font-face {
font-family: 'League Gothic';
src: url('../../lib/font/league_gothic-webfont.eot');
src: url('../../lib/font/league_gothic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../lib/font/league_gothic-webfont.woff') format('woff'),
url('../../lib/font/league_gothic-webfont.ttf') format('truetype'),
url('../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
// Override theme settings (see ../template/settings.scss)
$heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15);
// Background generator
@mixin bodyBackground() {
@include radial-gradient( rgba(28,30,32,1), rgba(85,90,95,1) );
}
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,42 @@
/**
* Default theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@font-face {
font-family: 'League Gothic';
src: url('../../lib/font/league_gothic-webfont.eot');
src: url('../../lib/font/league_gothic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../lib/font/league_gothic-webfont.woff') format('woff'),
url('../../lib/font/league_gothic-webfont.ttf') format('truetype'),
url('../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
// Override theme settings (see ../template/settings.scss)
$heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15);
// Background generator
@mixin bodyBackground() {
@include radial-gradient( rgba(28,30,32,1), rgba(85,90,95,1) );
}
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,34 @@
/**
* League theme for reveal.js.
*
* This was the default theme pre-3.0.0.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@import url(../../lib/font/league-gothic/league-gothic.css);
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
// Override theme settings (see ../template/settings.scss)
$headingTextShadow: 0px 0px 6px rgba(0,0,0,0.2);
$heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15);
// Background generator
@mixin bodyBackground() {
@include radial-gradient( rgba(28,30,32,1), rgba(85,90,95,1) );
}
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,68 @@
/**
* Solarized Dark theme for reveal.js.
* Author: Achim Staebler
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@font-face {
font-family: 'League Gothic';
src: url('../../lib/font/league_gothic-webfont.eot');
src: url('../../lib/font/league_gothic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../lib/font/league_gothic-webfont.woff') format('woff'),
url('../../lib/font/league_gothic-webfont.ttf') format('truetype'),
url('../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* Solarized colors by Ethan Schoonover
*/
html * {
color-profile: sRGB;
rendering-intent: auto;
}
// Solarized colors
$base03: #002b36;
$base02: #073642;
$base01: #586e75;
$base00: #657b83;
$base0: #839496;
$base1: #93a1a1;
$base2: #eee8d5;
$base3: #fdf6e3;
$yellow: #b58900;
$orange: #cb4b16;
$red: #dc322f;
$magenta: #d33682;
$violet: #6c71c4;
$blue: #268bd2;
$cyan: #2aa198;
$green: #859900;
// Override theme settings (see ../template/settings.scss)
$mainColor: $base1;
$headingColor: $base2;
$headingTextShadow: none;
$backgroundColor: $base03;
$linkColor: $blue;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: $magenta;
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,35 @@
/**
* Black theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@import url(https://fonts.googleapis.com/css?family=Montserrat:700);
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic);
// Override theme settings (see ../template/settings.scss)
$backgroundColor: #111;
$mainFont: 'Open Sans', sans-serif;
$linkColor: #e7ad52;
$linkColorHover: lighten( $linkColor, 20% );
$headingFont: 'Montserrat', Impact, sans-serif;
$headingTextShadow: none;
$headingLetterSpacing: -0.03em;
$headingTextTransform: none;
$selectionBackgroundColor: #e7ad52;
$mainFontSize: 30px;
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,35 @@
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is brown.
*
* This theme is Copyright (C) 2012-2013 Owen Versteeg, http://owenversteeg.com - it is MIT licensed.
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Override theme settings (see ../template/settings.scss)
$mainFont: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
$mainColor: #000;
$headingFont: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
$headingColor: #383D3D;
$headingTextShadow: none;
$headingTextTransform: none;
$backgroundColor: #F0F1EB;
$linkColor: #51483D;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: #26351C;
.reveal a:not(.image) {
line-height: 1.3em;
}
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,38 @@
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is darkblue.
*
* This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed.
* reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@import url(https://fonts.googleapis.com/css?family=News+Cycle:400,700);
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
// Override theme settings (see ../template/settings.scss)
$mainFont: 'Lato', sans-serif;
$mainColor: #000;
$headingFont: 'Helvetica', Impact, sans-serif; /* changed (by hpl) from 'News Cycle', Impact, sans-serif; */
$headingColor: #000;
$headingTextShadow: none;
$headingTextTransform: none;
$backgroundColor: #fff;
$linkColor: #00008B;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: rgba(0, 0, 0, 0.99);
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,39 @@
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is darkblue.
*
* This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed.
* reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
* Simula theme made by Hans Petter Langtangen.
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
// Override theme settings (see ../template/settings.scss)
$mainFont: 'Lato', sans-serif;
$mainColor: #404040;
$headingFont: 'Helvetica', Impact, sans-serif;
$headingColor: #ff8800;
$headingTextShadow: none;
$headingTextTransform: none;
$backgroundColor: #fff;
$linkColor: #ff8800;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: rgba(0, 0, 0, 0.99);
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,46 @@
/**
* Sky theme for reveal.js.
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@import url(https://fonts.googleapis.com/css?family=Quicksand:400,700,400italic,700italic);
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700);
// Override theme settings (see ../template/settings.scss)
$mainFont: 'Open Sans', sans-serif;
$mainColor: #333;
$headingFont: 'Quicksand', sans-serif;
$headingColor: #333;
$headingLetterSpacing: -0.08em;
$headingTextShadow: none;
$backgroundColor: #f7fbfc;
$linkColor: #3b759e;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: #134674;
// Fix links so they are not cut off
.reveal a:not(.image) {
line-height: 1.3em;
}
// Background generator
@mixin bodyBackground() {
@include radial-gradient( #add9e4, #f7fbfc );
}
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,74 @@
/**
* Solarized Light theme for reveal.js.
* Author: Achim Staebler
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@font-face {
font-family: 'League Gothic';
src: url('../../lib/font/league_gothic-webfont.eot');
src: url('../../lib/font/league_gothic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../lib/font/league_gothic-webfont.woff') format('woff'),
url('../../lib/font/league_gothic-webfont.ttf') format('truetype'),
url('../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
/**
* Solarized colors by Ethan Schoonover
*/
html * {
color-profile: sRGB;
rendering-intent: auto;
}
// Solarized colors
$base03: #002b36;
$base02: #073642;
$base01: #586e75;
$base00: #657b83;
$base0: #839496;
$base1: #93a1a1;
$base2: #eee8d5;
$base3: #fdf6e3;
$yellow: #b58900;
$orange: #cb4b16;
$red: #dc322f;
$magenta: #d33682;
$violet: #6c71c4;
$blue: #268bd2;
$cyan: #2aa198;
$green: #859900;
// Override theme settings (see ../template/settings.scss)
$mainColor: $base00;
$headingColor: $base01;
$headingTextShadow: none;
$backgroundColor: $base3;
$linkColor: $blue;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: $magenta;
// Background generator
// @mixin bodyBackground() {
// @include radial-gradient( rgba($base3,1), rgba(lighten($base3, 20%),1) );
// }
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,49 @@
/**
* White theme for reveal.js. This is the opposite of the 'black' theme.
*
* By Hakim El Hattab, http://hakim.se
*/
// Default mixins and settings -----------------
@import "../template/mixins";
@import "../template/settings";
// ---------------------------------------------
// Include theme-specific fonts
@import url(../../lib/font/source-sans-pro/source-sans-pro.css);
// Override theme settings (see ../template/settings.scss)
$backgroundColor: #fff;
$mainColor: #222;
$headingColor: #222;
$mainFontSize: 42px;
$mainFont: 'Source Sans Pro', Helvetica, sans-serif;
$headingFont: 'Source Sans Pro', Helvetica, sans-serif;
$headingTextShadow: none;
$headingLetterSpacing: normal;
$headingTextTransform: uppercase;
$headingFontWeight: 600;
$linkColor: #2a76dd;
$linkColorHover: lighten( $linkColor, 15% );
$selectionBackgroundColor: lighten( $linkColor, 25% );
$heading1Size: 2.5em;
$heading2Size: 1.6em;
$heading3Size: 1.3em;
$heading4Size: 1.0em;
section.has-dark-background {
&, h1, h2, h3, h4, h5, h6 {
color: #fff;
}
}
// Theme template ------------------------------
@import "../template/theme";
// ---------------------------------------------
@@ -0,0 +1,273 @@
@import url(../../lib/font/source-sans-pro/source-sans-pro.css);
/**
* White theme for reveal.js. This is the opposite of the 'black' theme.
*
* Copyright (C) 2015 Hakim El Hattab, http://hakim.se
*/
section.has-dark-background, section.has-dark-background h1, section.has-dark-background h2, section.has-dark-background h3, section.has-dark-background h4, section.has-dark-background h5, section.has-dark-background h6 {
color: #fff; }
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #fff;
background-color: #fff; }
.reveal {
font-family: 'Source Sans Pro', Helvetica, sans-serif;
font-size: 30px; /* changed by hpl from 38px */
font-weight: normal;
color: #222; }
::selection {
color: #fff;
background: #98bdef;
text-shadow: none; }
.reveal .slides > section, .reveal .slides > section > section {
line-height: 1.1em; /* changed by hpl from 1.2; */
font-weight: inherit; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6 {
margin: 0 0 20px 0;
color: #222;
font-family: 'Source Sans Pro', Helvetica, sans-serif;
font-weight: 600;
line-height: 1.1em; /* changed by hpl from 1.2; */
letter-spacing: normal;
/* text-transform: uppercase; removed by hpl */
text-shadow: none;
word-wrap: break-word; }
.reveal h1 {
line-height: 1.2em;
}
/* removed by hpl
.reveal h1 {
font-size: 2.5em; }
.reveal h2 {
font-size: 1.6em; }
.reveal h3 {
font-size: 1.3em; }
.reveal h4 {
font-size: 1em; }
*/
.reveal h1 {
text-shadow: none; }
/*********************************************
* OTHER
*********************************************/
.reveal p {
margin: 20px 0;
line-height: 1.3; }
/* Ensure certain elements are never larger than the slide itself */
.reveal img, .reveal video, .reveal iframe {
max-width: 95%;
max-height: 95%; }
.reveal strong, .reveal b {
font-weight: bold; }
.reveal em {
font-style: italic; }
.reveal ol, .reveal dl, .reveal ul {
display: inline-block;
text-align: left;
margin: 0 0 0 1em; }
.reveal ol {
list-style-type: decimal; }
.reveal ul {
list-style-type: disc; }
.reveal ul ul {
list-style-type: square; }
.reveal ul ul ul {
list-style-type: circle; }
.reveal ul ul, .reveal ul ol, .reveal ol ol, .reveal ol ul {
display: block;
margin-left: 40px; }
.reveal dt {
font-weight: bold; }
.reveal dd {
margin-left: 40px; }
.reveal q, .reveal blockquote {
quotes: none; }
.reveal blockquote {
display: block;
position: relative;
width: 70%;
margin: 20px auto;
padding: 5px;
font-style: italic;
background: rgba(255, 255, 255, 0.05);
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.2); }
.reveal blockquote p:first-child, .reveal blockquote p:last-child {
display: inline-block; }
.reveal q {
font-style: italic; }
.reveal pre {
display: block;
position: relative;
width: 90%;
margin: 20px auto;
text-align: left;
font-size: 0.55em;
font-family: monospace;
line-height: 1.2em;
word-wrap: break-word;
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); }
.reveal code {
font-family: monospace; }
.reveal pre code {
display: block;
padding: 5px;
overflow: auto;
max-height: 400px;
word-wrap: normal;
background: #3F3F3F;
color: #DCDCDC; }
.reveal table {
margin: auto;
border-collapse: collapse;
border-spacing: 0; }
.reveal table th {
font-weight: bold; }
.reveal table th, .reveal table td {
/* text-align: left; */ /* hpl modification */
padding: 0.2em 0.5em 0.2em 0.5em;
border-bottom: 1px solid; }
.reveal table th[align="center"], .reveal table td[align="center"] {
text-align: center; }
.reveal table th[align="right"], .reveal table td[align="right"] {
text-align: right; }
.reveal table tr:last-child td {
border-bottom: none; }
.reveal sup {
vertical-align: super; }
.reveal sub {
vertical-align: sub; }
.reveal small {
display: inline-block;
font-size: 0.6em;
line-height: 1.2em;
vertical-align: top; }
.reveal small * {
vertical-align: top; }
/*********************************************
* LINKS
*********************************************/
.reveal a {
color: #2a76dd;
text-decoration: none;
-webkit-transition: color 0.15s ease;
-moz-transition: color 0.15s ease;
transition: color 0.15s ease; }
.reveal a:hover {
color: #6ca2e8;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: #1a54a1; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 15px 0px;
background: rgba(255, 255, 255, 0.12);
border: 4px solid #222;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); }
.reveal a img {
-webkit-transition: all 0.15s linear;
-moz-transition: all 0.15s linear;
transition: all 0.15s linear; }
.reveal a:hover img {
background: rgba(255, 255, 255, 0.2);
border-color: #2a76dd;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }
/*********************************************
* NAVIGATION CONTROLS
*********************************************/
.reveal .controls div.navigate-left, .reveal .controls div.navigate-left.enabled {
border-right-color: #2a76dd; }
.reveal .controls div.navigate-right, .reveal .controls div.navigate-right.enabled {
border-left-color: #2a76dd; }
.reveal .controls div.navigate-up, .reveal .controls div.navigate-up.enabled {
border-bottom-color: #2a76dd; }
.reveal .controls div.navigate-down, .reveal .controls div.navigate-down.enabled {
border-top-color: #2a76dd; }
.reveal .controls div.navigate-left.enabled:hover {
border-right-color: #6ca2e8; }
.reveal .controls div.navigate-right.enabled:hover {
border-left-color: #6ca2e8; }
.reveal .controls div.navigate-up.enabled:hover {
border-bottom-color: #6ca2e8; }
.reveal .controls div.navigate-down.enabled:hover {
border-top-color: #6ca2e8; }
/*********************************************
* PROGRESS BAR
*********************************************/
.reveal .progress {
background: rgba(0, 0, 0, 0.2); }
.reveal .progress span {
background: #2a76dd;
-webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
/*********************************************
* SLIDE NUMBER
*********************************************/
.reveal .slide-number {
color: #2a76dd; }
+410
View File
@@ -0,0 +1,410 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js The HTML Presentation Framework</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css" id="theme">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>Reveal.js</h1>
<h3>The HTML Presentation Framework</h3>
<p>
<small>Created by <a href="http://hakim.se">Hakim El Hattab</a> and <a href="https://github.com/hakimel/reveal.js/graphs/contributors">contributors</a></small>
</p>
</section>
<section>
<h2>Hello There</h2>
<p>
reveal.js enables you to create beautiful interactive slide decks using HTML. This presentation will show you examples of what it can do.
</p>
</section>
<!-- Example of nested vertical slides -->
<section>
<section>
<h2>Vertical Slides</h2>
<p>Slides can be nested inside of each other.</p>
<p>Use the <em>Space</em> key to navigate through all slides.</p>
<br>
<a href="#" class="navigate-down">
<img width="178" height="238" data-src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Down arrow">
</a>
</section>
<section>
<h2>Basement Level 1</h2>
<p>Nested slides are useful for adding additional detail underneath a high level horizontal slide.</p>
</section>
<section>
<h2>Basement Level 2</h2>
<p>That's it, time to go back up.</p>
<br>
<a href="#/2">
<img width="178" height="238" data-src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Up arrow" style="transform: rotate(180deg); -webkit-transform: rotate(180deg);">
</a>
</section>
</section>
<section>
<h2>Slides</h2>
<p>
Not a coder? Not a problem. There's a fully-featured visual editor for authoring these, try it out at <a href="https://slides.com" target="_blank">https://slides.com</a>.
</p>
</section>
<section>
<h2>Point of View</h2>
<p>
Press <strong>ESC</strong> to enter the slide overview.
</p>
<p>
Hold down alt and click on any element to zoom in on it using <a href="http://lab.hakim.se/zoom-js">zoom.js</a>. Alt + click anywhere to zoom back out.
</p>
</section>
<section>
<h2>Touch Optimized</h2>
<p>
Presentations look great on touch devices, like mobile phones and tablets. Simply swipe through your slides.
</p>
</section>
<section data-markdown>
<script type="text/template">
## Markdown support
Write content using inline or external Markdown.
Instructions and more info available in the [readme](https://github.com/hakimel/reveal.js#markdown).
```
<section data-markdown>
## Markdown support
Write content using inline or external Markdown.
Instructions and more info available in the [readme](https://github.com/hakimel/reveal.js#markdown).
</section>
```
</script>
</section>
<section>
<section id="fragments">
<h2>Fragments</h2>
<p>Hit the next arrow...</p>
<p class="fragment">... to step through ...</p>
<p><span class="fragment">... a</span> <span class="fragment">fragmented</span> <span class="fragment">slide.</span></p>
<aside class="notes">
This slide has fragments which are also stepped through in the notes window.
</aside>
</section>
<section>
<h2>Fragment Styles</h2>
<p>There's different types of fragments, like:</p>
<p class="fragment grow">grow</p>
<p class="fragment shrink">shrink</p>
<p class="fragment fade-out">fade-out</p>
<p class="fragment fade-up">fade-up (also down, left and right!)</p>
<p class="fragment current-visible">current-visible</p>
<p>Highlight <span class="fragment highlight-red">red</span> <span class="fragment highlight-blue">blue</span> <span class="fragment highlight-green">green</span></p>
</section>
</section>
<section id="transitions">
<h2>Transition Styles</h2>
<p>
You can select from different transitions, like: <br>
<a href="?transition=none#/transitions">None</a> -
<a href="?transition=fade#/transitions">Fade</a> -
<a href="?transition=slide#/transitions">Slide</a> -
<a href="?transition=convex#/transitions">Convex</a> -
<a href="?transition=concave#/transitions">Concave</a> -
<a href="?transition=zoom#/transitions">Zoom</a>
</p>
</section>
<section id="themes">
<h2>Themes</h2>
<p>
reveal.js comes with a few themes built in: <br>
<!-- Hacks to swap themes after the page has loaded. Not flexible and only intended for the reveal.js demo deck. -->
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/black.css'); return false;">Black (default)</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/white.css'); return false;">White</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/league.css'); return false;">League</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/sky.css'); return false;">Sky</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/beige.css'); return false;">Beige</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/simple.css'); return false;">Simple</a> <br>
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/serif.css'); return false;">Serif</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/blood.css'); return false;">Blood</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/night.css'); return false;">Night</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/moon.css'); return false;">Moon</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/solarized.css'); return false;">Solarized</a>
</p>
</section>
<section>
<section data-background="#dddddd">
<h2>Slide Backgrounds</h2>
<p>
Set <code>data-background="#dddddd"</code> on a slide to change the background color. All CSS color formats are supported.
</p>
<a href="#" class="navigate-down">
<img width="178" height="238" data-src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Down arrow">
</a>
</section>
<section data-background="https://s3.amazonaws.com/hakim-static/reveal-js/image-placeholder.png">
<h2>Image Backgrounds</h2>
<pre><code class="hljs">&lt;section data-background="image.png"&gt;</code></pre>
</section>
<section data-background="https://s3.amazonaws.com/hakim-static/reveal-js/image-placeholder.png" data-background-repeat="repeat" data-background-size="100px">
<h2>Tiled Backgrounds</h2>
<pre><code class="hljs" style="word-wrap: break-word;">&lt;section data-background="image.png" data-background-repeat="repeat" data-background-size="100px"&gt;</code></pre>
</section>
<section data-background-video="https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.mp4,https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.webm" data-background-color="#000000">
<div style="background-color: rgba(0, 0, 0, 0.9); color: #fff; padding: 20px;">
<h2>Video Backgrounds</h2>
<pre><code class="hljs" style="word-wrap: break-word;">&lt;section data-background-video="video.mp4,video.webm"&gt;</code></pre>
</div>
</section>
<section data-background="http://i.giphy.com/90F8aUepslB84.gif">
<h2>... and GIFs!</h2>
</section>
</section>
<section data-transition="slide" data-background="#4d7e65" data-background-transition="zoom">
<h2>Background Transitions</h2>
<p>
Different background transitions are available via the backgroundTransition option. This one's called "zoom".
</p>
<pre><code class="hljs">Reveal.configure({ backgroundTransition: 'zoom' })</code></pre>
</section>
<section data-transition="slide" data-background="#b5533c" data-background-transition="zoom">
<h2>Background Transitions</h2>
<p>
You can override background transitions per-slide.
</p>
<pre><code class="hljs" style="word-wrap: break-word;">&lt;section data-background-transition="zoom"&gt;</code></pre>
</section>
<section>
<h2>Pretty Code</h2>
<pre><code class="hljs" data-trim contenteditable>
function linkify( selector ) {
if( supports3DTransforms ) {
var nodes = document.querySelectorAll( selector );
for( var i = 0, len = nodes.length; i &lt; len; i++ ) {
var node = nodes[i];
if( !node.className ) {
node.className += ' roll';
}
}
}
}
</code></pre>
<p>Code syntax highlighting courtesy of <a href="http://softwaremaniacs.org/soft/highlight/en/description/">highlight.js</a>.</p>
</section>
<section>
<h2>Marvelous List</h2>
<ul>
<li>No order here</li>
<li>Or here</li>
<li>Or here</li>
<li>Or here</li>
</ul>
</section>
<section>
<h2>Fantastic Ordered List</h2>
<ol>
<li>One is smaller than...</li>
<li>Two is smaller than...</li>
<li>Three!</li>
</ol>
</section>
<section>
<h2>Tabular Tables</h2>
<table>
<thead>
<tr>
<th>Item</th>
<th>Value</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<tr>
<td>Apples</td>
<td>$1</td>
<td>7</td>
</tr>
<tr>
<td>Lemonade</td>
<td>$2</td>
<td>18</td>
</tr>
<tr>
<td>Bread</td>
<td>$3</td>
<td>2</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>Clever Quotes</h2>
<p>
These guys come in two forms, inline: <q cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">The nice thing about standards is that there are so many to choose from</q> and block:
</p>
<blockquote cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">
&ldquo;For years there has been a theory that millions of monkeys typing at random on millions of typewriters would
reproduce the entire works of Shakespeare. The Internet has proven this theory to be untrue.&rdquo;
</blockquote>
</section>
<section>
<h2>Intergalactic Interconnections</h2>
<p>
You can link between slides internally,
<a href="#/2/3">like this</a>.
</p>
</section>
<section>
<h2>Speaker View</h2>
<p>There's a <a href="https://github.com/hakimel/reveal.js#speaker-notes">speaker view</a>. It includes a timer, preview of the upcoming slide as well as your speaker notes.</p>
<p>Press the <em>S</em> key to try it out.</p>
<aside class="notes">
Oh hey, these are some notes. They'll be hidden in your presentation, but you can see them if you open the speaker notes window (hit 's' on your keyboard).
</aside>
</section>
<section>
<h2>Export to PDF</h2>
<p>Presentations can be <a href="https://github.com/hakimel/reveal.js#pdf-export">exported to PDF</a>, here's an example:</p>
<iframe data-src="https://www.slideshare.net/slideshow/embed_code/42840540" width="445" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:3px solid #666; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe>
</section>
<section>
<h2>Global State</h2>
<p>
Set <code>data-state="something"</code> on a slide and <code>"something"</code>
will be added as a class to the document element when the slide is open. This lets you
apply broader style changes, like switching the page background.
</p>
</section>
<section data-state="customevent">
<h2>State Events</h2>
<p>
Additionally custom events can be triggered on a per slide basis by binding to the <code>data-state</code> name.
</p>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
Reveal.addEventListener( 'customevent', function() {
console.log( '"customevent" has fired' );
} );
</code></pre>
</section>
<section>
<h2>Take a Moment</h2>
<p>
Press B or . on your keyboard to pause the presentation. This is helpful when you're on stage and want to take distracting slides off the screen.
</p>
</section>
<section>
<h2>Much more</h2>
<ul>
<li>Right-to-left support</li>
<li><a href="https://github.com/hakimel/reveal.js#api">Extensive JavaScript API</a></li>
<li><a href="https://github.com/hakimel/reveal.js#auto-sliding">Auto-progression</a></li>
<li><a href="https://github.com/hakimel/reveal.js#parallax-background">Parallax backgrounds</a></li>
<li><a href="https://github.com/hakimel/reveal.js#keyboard-bindings">Custom keyboard bindings</a></li>
</ul>
</section>
<section style="text-align: left;">
<h1>THE END</h1>
<p>
- <a href="https://slides.com">Try the online editor</a> <br>
- <a href="https://github.com/hakimel/reveal.js">Source code &amp; documentation</a>
</p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/search/search.js', async: true },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>
+49
View File
@@ -0,0 +1,49 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>reveal.js</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>Slide 1</section>
<section>Slide 2</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,80 @@
/*
Zenburn style from voldmar.ru (c) Vladimir Epifanov <voldmar@voldmar.ru>
based on dark.css by Ivan Sagalaev
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #3f3f3f;
color: #dcdcdc;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-tag {
color: #e3ceab;
}
.hljs-template-tag {
color: #dcdcdc;
}
.hljs-number {
color: #8cd0d3;
}
.hljs-variable,
.hljs-template-variable,
.hljs-attribute {
color: #efdcbc;
}
.hljs-literal {
color: #efefaf;
}
.hljs-subst {
color: #8f8f8f;
}
.hljs-title,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-section,
.hljs-type {
color: #efef8f;
}
.hljs-symbol,
.hljs-bullet,
.hljs-link {
color: #dca3a3;
}
.hljs-deletion,
.hljs-string,
.hljs-built_in,
.hljs-builtin-name {
color: #cc9393;
}
.hljs-addition,
.hljs-comment,
.hljs-quote,
.hljs-meta {
color: #7f9f7f;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
@@ -0,0 +1,2 @@
SIL Open Font License (OFL)
http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL
@@ -0,0 +1,10 @@
@font-face {
font-family: 'League Gothic';
src: url('league-gothic.eot');
src: url('league-gothic.eot?#iefix') format('embedded-opentype'),
url('league-gothic.woff') format('woff'),
url('league-gothic.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}

Some files were not shown because too many files have changed in this diff Show More