<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Machine Learning &#8211; NN in XL</title>
	<atom:link href="https://www.richardmaddison.com/tag/machine-learning/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.richardmaddison.com</link>
	<description>Richard Maddison</description>
	<lastBuildDate>Sat, 12 Jan 2019 06:54:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.7</generator>
	<item>
		<title>A Neural Network in Excel learning the difference between fighting and dancing.</title>
		<link>https://www.richardmaddison.com/2018/06/16/neural-network-excel-learning-difference-fighting-dancing/</link>
					<comments>https://www.richardmaddison.com/2018/06/16/neural-network-excel-learning-difference-fighting-dancing/#comments</comments>
		
		<dc:creator><![CDATA[Richard Maddison]]></dc:creator>
		<pubDate>Sat, 16 Jun 2018 04:35:54 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AI in Excel]]></category>
		<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[Machine Learning in Excel]]></category>
		<category><![CDATA[Neural Networks in Excel]]></category>
		<guid isPermaLink="false">https://www.richardmaddison.com/?p=21488</guid>

					<description><![CDATA[<p>I’ve been building Neural Networks in Excel for a few months and have been looking for a data set that would capture something too hard for humans to explain but easy for us to identify. Basically, a classification that we can recognize instantly but can’t...</p>
<p>The post <a rel="nofollow" href="https://www.richardmaddison.com/2018/06/16/neural-network-excel-learning-difference-fighting-dancing/">A Neural Network in Excel learning the difference between fighting and dancing.</a> appeared first on <a rel="nofollow" href="https://www.richardmaddison.com">NN in XL</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I’ve been building Neural Networks in Excel for a few months and have been looking for a data set that would capture something too hard for humans to explain but easy for us to identify. Basically, a classification that we can recognize instantly but can’t easily explain. I also wanted as few dimensions in the data as possible to keep the Excel light. The slightly silly problem that I came up with was our ability to see a relationship between two randomly generated stick figures placed side by side. There are plenty of interpretations we can put on their relationship but the classes I came up with were fighting or dancing. For Example:</p>
<p>I think these are Dancing:</p>
<p><img loading="lazy" class="wp-image-21489 aligncenter" src="https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-1-Dancing-Images-300x63.png" alt="" width="872" height="183" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-1-Dancing-Images-300x63.png 300w, https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-1-Dancing-Images-768x162.png 768w, https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-1-Dancing-Images-700x148.png 700w, https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-1-Dancing-Images.png 1008w" sizes="(max-width: 872px) 100vw, 872px" /></p>
<p>I think these are Fighting:</p>
<p><img loading="lazy" class="wp-image-21490 aligncenter" src="https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-2-Fighting-Images-300x74.png" alt="" width="872" height="215" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-2-Fighting-Images-300x74.png 300w, https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-2-Fighting-Images-768x189.png 768w, https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-2-Fighting-Images-700x172.png 700w, https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-2-Fighting-Images.png 1017w" sizes="(max-width: 872px) 100vw, 872px" /></p>
<p>The plots are interesting because there are many different ways that people dance or fight and our brains can usually see these, but can you describe the general difference.</p>
<p>I thought no but given the unreasonable effectiveness of neural networks to recognize patterns, maybe they could figure out what that difference was.</p>
<p><img loading="lazy" class="wp-image-21491 aligncenter" src="https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-3-Fighting-Dancing-Patterns-300x156.jpg" alt="" width="677" height="352" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-3-Fighting-Dancing-Patterns-300x156.jpg 300w, https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-3-Fighting-Dancing-Patterns-768x399.jpg 768w, https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-3-Fighting-Dancing-Patterns-700x364.jpg 700w, https://www.richardmaddison.com/wp-content/uploads/2018/06/Figure-3-Fighting-Dancing-Patterns.jpg 850w" sizes="(max-width: 677px) 100vw, 677px" /></p>
<p>These plots show how the cases differ for those labelled by me as dancing and separately, to the right, as fighting. There really is nothing obvious here.</p>
<p>The spreadsheet generates stick figure couples with 10 dots per figure and I’ve laboriously picked out and labelled 600 cases where they appear to me to be either fighting or dancing. The spreadsheet contains two on-sheet fully connected neural networks with 2 layers of 15 and 10 neurons ending in a sigmoid binary classifier and looking at 24 XY coordinates in a flat 48-dimensional vector (there are 2 repeated dots; the neck and the pelvis – wasteful but I was lazy). The first Neural Net runs 5 batches of 100 cases each and learns the difference between Fighting and Dancing and the second runs stochastic gradient descent on a single case at a time using the learned parameters of the first but looking at a separate test dataset of 100 fresh, unseen labelled cases.</p>
<p>Excel lends itself well to building and understanding Neural Networks because it requires an explicit physical layout for the layers within the model, they are not hidden in virtual arrays defined by for-loops but displayed as actual blocks of numbers. The plot below shows the core of the model’s “brain”, the hidden layers and the parameter weights that, once trained, capture the function that we humans each develope to distinguish between aggression and joy. The Momentum and Gradient layers give you a view of how the spreadsheet learns. The gradients of the function are derived directly from a case (or 100 cases for this vectorized model) run through the current learned parameters. The gradients give the direction of travel required to update the parameters of each layer in order to reduce the loss function i.e. the difference between my classification of a particular case and the spreadsheet’s current understanding. If left to train for an hour or so with a small enough learning rate, the model will learn the training cases to an accuracy of 100%. However, this would be an example of overfitting and would not capture the essence of fighting or dancing and therefore not generalize well to new cases.</p>
<p><img loading="lazy" class=" wp-image-21499 aligncenter" src="https://www.richardmaddison.com/wp-content/uploads/2018/06/Layers-1-300x173.jpg" alt="" width="500" height="288" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/06/Layers-1-300x173.jpg 300w, https://www.richardmaddison.com/wp-content/uploads/2018/06/Layers-1-345x198.jpg 345w, https://www.richardmaddison.com/wp-content/uploads/2018/06/Layers-1.jpg 528w" sizes="(max-width: 500px) 100vw, 500px" /></p>
<p>Excel has some real advantages for coding neural nets, beyond the fact that for me it’s the tool I know and I’m still Python semi-literate. I think these advantages are as follows:</p>
<ul>
<li>They lay the structure bare. All layers, all neurons and all connection weights are exposed, no searching or displaying the results of nested For loops, just 2D blocks of numbers.</li>
<li>When coding you make fundamental wiring errors: This is not so helpful if you know where you&#8217;re going but at this stage, neural networks are still a black art. In all the training I’ve done to date the experts use the phrase “this works well but we don’t know why”.</li>
<li>It&#8217;s slow to train and you see it train in minute step by step detail. This gives you time to think and ponder what’s going on, what’s wrong and what’s just plain peculiar.</li>
</ul>
<p>If you’re interested in this, please let me know and I would be happy to share more with you. I’d certainly welcome any questions and queries you may have and will be releasing some of the base models on GitHub. Any expressions of interest prior to this would also be welcome.</p>
<p>I&#8217;ve uploaded a Youtube Video of the model running here: <a href="https://youtu.be/ua27l-nZ944">https://youtu.be/RsQp-5feqZQ</a> and you can see more related Neural Network in Excel stuff on my channel here: <a href="https://www.youtube.com/channel/UC44Q4IXVrU6qUtezNU9X_Uw?view_as=subscriber">https://www.youtube.com/</a></p>
<p>This videos and associated material if released are available to you under a Creative Commons Attribution-NonCommercial 4.0 International License the details of which can be found here: <a href="https://creativecommons.org/licenses/by-nc/4.0/legalcode">https://creativecommons.org/licenses/by-nc/4.0/legalcode</a></p>
<p>The post <a rel="nofollow" href="https://www.richardmaddison.com/2018/06/16/neural-network-excel-learning-difference-fighting-dancing/">A Neural Network in Excel learning the difference between fighting and dancing.</a> appeared first on <a rel="nofollow" href="https://www.richardmaddison.com">NN in XL</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.richardmaddison.com/2018/06/16/neural-network-excel-learning-difference-fighting-dancing/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Building Convolutional Neural Networks in Excel</title>
		<link>https://www.richardmaddison.com/2018/05/03/building-convolutional-neural-networks-excel/</link>
					<comments>https://www.richardmaddison.com/2018/05/03/building-convolutional-neural-networks-excel/#comments</comments>
		
		<dc:creator><![CDATA[Richard Maddison]]></dc:creator>
		<pubDate>Thu, 03 May 2018 16:31:01 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[AI in Excel]]></category>
		<category><![CDATA[Building Convolutional Neural Networks in Excel]]></category>
		<category><![CDATA[Convolutional Neural Networks in Excel]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[Machine Learning in Excel]]></category>
		<category><![CDATA[Neural Networks]]></category>
		<guid isPermaLink="false">https://www.richardmaddison.com/?p=21460</guid>

					<description><![CDATA[<p>This blog relates to work I’ve done in Excel to build a handwritten digit classifier; basically, a spreadsheet that can read handwriting up to human levels of accuracy. This required a convolutional neural network &#8211; the engine behind just about all machine learning related to...</p>
<p>The post <a rel="nofollow" href="https://www.richardmaddison.com/2018/05/03/building-convolutional-neural-networks-excel/">Building Convolutional Neural Networks in Excel</a> appeared first on <a rel="nofollow" href="https://www.richardmaddison.com">NN in XL</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This blog relates to work I’ve done in Excel to build a handwritten digit classifier; basically, a spreadsheet that can read handwriting up to human levels of accuracy. This required a convolutional neural network &#8211; the engine behind just about all machine learning related to images. I’m unaware of anyone else who has done this in Excel so please let me know if you come across others.</p>
<p>I have been deeply involved with financial analysis and mathematical models for most of my career but began re-tooling with machine learning over the last two years.  I’m currently working through Andrew Ng’s brilliant Deep Learning course on Coursera and I’ve reached Course 4, Week 3. Throughout the course, I’ve been building out the neural net architectures he describes in Excel.  Excel is not “yet” the right medium to build convolutional neural nets for real-world applications. However, I know Excel and find it easier to construct these on a spreadsheet rather than in a new language. I certainly hope this state won’t last long.</p>
<p>Building in Excel may be slow, but it makes neural nets very transparent, in that you are visually confronted with the layers, neurons and their associated parameters and related calculations. Excel gives a less abstract view of a neural net than vectorised Python code and it helped me immensely in developing an understanding of these fantastic new tools.</p>
<p>Excel lets you see inside the machine but for me, an even more useful element was the bugs and miss wiring that I introduced. Neural networks are very robust to bugs, in fact, they often continue to learn but fail in odd and interesting ways. Figuring out the failure based on the learning behaviour really forced me to think about the maths and the structure. I would also argue that the speed of Excel gives you time to think as the failures manifest themselves. For a deeper understanding of Neural Nets go to Andrew Ng. My intuitions are still weak but certainly improving.</p>
<p>The classic beginners exercise for deep learning is to build an MNIST digit classifier. This relates to Yann LeCun’s data set of 60,000 handwritten digits (0 to 9) with an associated 10,000-digit test set. Yann has made this data available to all and there are plenty of higher level language examples.</p>
<p>My initial attempts at classifiers using plain vanilla fully connected neural networks are on my YouTube channel below but Mike Pallister was faster off the mark than me and is also worth a look.</p>
<p>Single Digit Classification <a href="https://www.youtube.com/watch?v=4P5r0tT7Hsc&amp;t=33s">https://www.youtube.com/watch?v=4P5r0tT7Hsc&amp;t=33s</a></p>
<p>Batch Digit Classification <a href="https://www.youtube.com/watch?v=bJcv9vi4Gqg&amp;t=6s">https://www.youtube.com/watch?v=bJcv9vi4Gqg&amp;t=6s</a></p>
<p>However, this blog relates to last week’s modelling of a convolutional neural net; again with ADAM optimisation and Batch capability. After several silly but informative mistakes, I completed the model below last night and would welcome your thoughts.</p>
<div style="width: 1060px;" class="wp-video"><!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->
<video class="wp-video-shortcode" id="video-21460-1" width="1060" height="661" preload="metadata" controls="controls"><source type="video/mp4" src="https://www.richardmaddison.com/wp-content/uploads/2018/05/CNN-in-Excel-Maddison-1.mp4?_=1" /><a href="https://www.richardmaddison.com/wp-content/uploads/2018/05/CNN-in-Excel-Maddison-1.mp4">https://www.richardmaddison.com/wp-content/uploads/2018/05/CNN-in-Excel-Maddison-1.mp4</a></video></div>
<p>The model has very few layers, neurons and parameters, its tiny in comparison to real-world examples. By way of a full description, there are two convolutional layers with max pooling taking the images of the handwritten digits from 28h x 28w pixels to 24h x 24w x 4c (4 channels) and 12h x 12w x 4c after max pooling. Layer 2 condensed these to 8h x 8w x 8c and then 4h x 4w x 8c after max pooling. The final two fully connected layers had 15 and 10 neurons respectively. Giving a grand total of 936 convolutional parameters and 2,095 in the fully connected layers. This doesn’t sound like a lot of space to capture the vagaries of human handwriting, but it does. On its first 100k iterations I’m seeing 98.75% accuracy on the training data and 98% on the test data.  I would love to know what human accuracy levels on this data are but from my experience, it’s not much more than this.</p>
<p>I’d certainly welcome any questions and queries you may have and will be releasing some of the base models on GitHub. Any expressions of interest prior to this would also be welcome.</p>
<p>These videos and associated material if released are available to you under a Creative Commons Attribution-NonCommercial 4.0 International Licence the details of which can be found here: https://creativecommons.org/licenses/by-nc/4.0/legalcode</p>
<p>The post <a rel="nofollow" href="https://www.richardmaddison.com/2018/05/03/building-convolutional-neural-networks-excel/">Building Convolutional Neural Networks in Excel</a> appeared first on <a rel="nofollow" href="https://www.richardmaddison.com">NN in XL</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.richardmaddison.com/2018/05/03/building-convolutional-neural-networks-excel/feed/</wfw:commentRss>
			<slash:comments>14</slash:comments>
		
		<enclosure url="https://www.richardmaddison.com/wp-content/uploads/2018/05/CNN-in-Excel-Maddison-1.mp4" length="56876931" type="video/mp4" />

			</item>
	</channel>
</rss>
