<?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>Neural Network &#8211; NN in XL</title>
	<atom:link href="https://www.richardmaddison.com/tag/neural-network/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.richardmaddison.com</link>
	<description>Richard Maddison</description>
	<lastBuildDate>Mon, 08 Apr 2019 09:20:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.8</generator>
	<item>
		<title>Neural Networks in Excel – Finding Andrew Ng’s Hidden Circle</title>
		<link>https://www.richardmaddison.com/2018/03/29/neural-networks-in-excel-finding-andrew-ngs-hidden-circle/</link>
					<comments>https://www.richardmaddison.com/2018/03/29/neural-networks-in-excel-finding-andrew-ngs-hidden-circle/#comments</comments>
		
		<dc:creator><![CDATA[dil]]></dc:creator>
		<pubDate>Thu, 29 Mar 2018 11:53:09 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AI in Excel]]></category>
		<category><![CDATA[Neural Network]]></category>
		<guid isPermaLink="false">https://www.richardmaddison.com/?p=21379</guid>

					<description><![CDATA[<p>I’m currently re-tooling as a data scientist and am halfway through Andrew Ng’s brilliant course on Deep learning in Coursera. I’m a spreadsheet jockey and have been working with Excel for years, but this course is in Python, the lingua franca for deep learning. Hence,...</p>
<p>The post <a rel="nofollow" href="https://www.richardmaddison.com/2018/03/29/neural-networks-in-excel-finding-andrew-ngs-hidden-circle/">Neural Networks in Excel – Finding Andrew Ng’s Hidden Circle</a> appeared first on <a rel="nofollow" href="https://www.richardmaddison.com">NN in XL</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="font-weight: 400;">I’m currently re-tooling as a data scientist and am halfway through Andrew Ng’s brilliant course on Deep learning in Coursera. I’m a spreadsheet jockey and have been working with Excel for years, but this course is in Python, the lingua franca for deep learning. Hence, I found myself struggling not only with the new concepts associated with the subject, but also the syntax of Python – agony.</span></p>
<p><span style="font-weight: 400;">The first programming assignment of Andrew’s second course “Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization” was to build a basic neural network to identify a function that would separate a scatter of red and blue dots based on their X, Y coordinates. For a human this is simple, the red dots formed a circle inside the black dots with a bit of random scatter but for an algorithm in Excel, well, before Andrew’s course it was not so easy.</span></p>
<p><img loading="lazy" class="wp-image-21480 aligncenter" src="https://www.richardmaddison.com/wp-content/uploads/2018/03/Circle-Picture-300x296.png" alt="" width="401" height="396" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/03/Circle-Picture-300x296.png 300w, https://www.richardmaddison.com/wp-content/uploads/2018/03/Circle-Picture-768x757.png 768w, https://www.richardmaddison.com/wp-content/uploads/2018/03/Circle-Picture-700x690.png 700w, https://www.richardmaddison.com/wp-content/uploads/2018/03/Circle-Picture.png 908w" sizes="(max-width: 401px) 100vw, 401px" /></p>
<p>The assignment required the Neural Network to find a boundary between red and black dots. This diagram shows the neural nets final output as shaded orange &amp; blue areas.<span style="font-weight: 400;">I had struggled to visualise what was happening inside the neural network and desperately wanted to see something in ‘my’ language, Excel. I searched the net for examples and came up with nothing other than some single neuron examples and one rough MNIST digit classifier. This didn’t make sense to me as I would have thought that Excel was an ideal teaching medium; lots of native speakers and a 2D layout ideal for exploring the dimensions of the inner hidden layers. </span></p>
<p><b>Could Excel expose the mystery of Neural Networks?</b></p>
<p><span style="font-weight: 400;">So, one sunny afternoon at home in India, I set off on a mission. The first step was to grab Andrew’s Data – nightmare, I couldn’t lift it out of Python, I was illiterate. After 2 futile hours, I did the obvious and constructed it myself. This took 5 minutes and opened the possibility of interesting patterns, say a doughnut or a letter. With the data in hand I began construction under the assumption that at some point I’d encounter insurmountable barriers on the way, but to my delight, there weren’t any. After a couple of hours, and with some luck, I’d built it and was ready to start the iterations and learn the function. I hit the macro button, watched for a while, however, nothing happened, I restarted a few times, checked the code then headed off for a coffee. Now the joy of a neural network is that it programs itself which in Excel takes luck and time. I came back a couple of hours later. Wow! I had iterating patterns and a learning curve that was headed in the right direction. The slow speed of my code was, to some extent, a plus and allowed me to see the function develop and ultimately segregate the dots. With the spreadsheet working and through the process of building it, the mystery of basic neural networks and back-propagation was finally clear and exposed.</span></p>
<div id="attachment_21391" style="width: 1664px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-21391" loading="lazy" class="wp-image-21391 size-full" src="https://www.richardmaddison.com/wp-content/uploads/2018/03/27011244-e1522326081232.png" alt="" width="1654" height="743" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/03/27011244-e1522326081232.png 1654w, https://www.richardmaddison.com/wp-content/uploads/2018/03/27011244-e1522326081232-300x135.png 300w, https://www.richardmaddison.com/wp-content/uploads/2018/03/27011244-e1522326081232-768x345.png 768w, https://www.richardmaddison.com/wp-content/uploads/2018/03/27011244-e1522326081232-1024x460.png 1024w, https://www.richardmaddison.com/wp-content/uploads/2018/03/27011244-e1522326081232-700x314.png 700w, https://www.richardmaddison.com/wp-content/uploads/2018/03/27011244-e1522326081232-1100x494.png 1100w, https://www.richardmaddison.com/wp-content/uploads/2018/03/27011244-e1522326081232-600x270.png 600w" sizes="(max-width: 1654px) 100vw, 1654px" /><p id="caption-attachment-21391" class="wp-caption-text">The learning curve drops off at 400 iterations and by 1000 the neural network as learnt and represented the hidden function.</p></div>
<p><span style="font-weight: 400;">The first model was very slow but Andrew was covering momentum and regularisation that week in his course so I plugged the first in and attempted the second, regularisation, by making the random scatter change each iteration, this was probably more like data augmentation but it was all new to me. My thinking was that the base function behind the data was three circles and re-running the scatter on each iteration would help the model learn this underlying function rather than the training set &#8211; I got a huge increase in speed and some fascinating results on the boundary diagram.</span></p>
<p><img loading="lazy" class="alignnone wp-image-21403 size-thumbnail" src="https://www.richardmaddison.com/wp-content/uploads/2018/03/1-e1522327953453-150x150.png" alt="" width="150" height="150" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/03/1-e1522327953453-150x150.png 150w, https://www.richardmaddison.com/wp-content/uploads/2018/03/1-e1522327953453-100x100.png 100w" sizes="(max-width: 150px) 100vw, 150px" /><img loading="lazy" class="alignnone wp-image-21402 size-thumbnail" src="https://www.richardmaddison.com/wp-content/uploads/2018/03/2-e1522328102631-150x150.png" alt="" width="150" height="150" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/03/2-e1522328102631-150x150.png 150w, https://www.richardmaddison.com/wp-content/uploads/2018/03/2-e1522328102631-100x100.png 100w" sizes="(max-width: 150px) 100vw, 150px" /><img loading="lazy" class="alignnone wp-image-21401 size-thumbnail" src="https://www.richardmaddison.com/wp-content/uploads/2018/03/3-e1522328159761-150x150.png" alt="" width="150" height="150" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/03/3-e1522328159761-150x150.png 150w, https://www.richardmaddison.com/wp-content/uploads/2018/03/3-e1522328159761-100x100.png 100w, https://www.richardmaddison.com/wp-content/uploads/2018/03/3-e1522328159761.png 215w" sizes="(max-width: 150px) 100vw, 150px" /><img loading="lazy" class="alignnone wp-image-21400 size-thumbnail" src="https://www.richardmaddison.com/wp-content/uploads/2018/03/4-e1522328292433-150x150.png" alt="" width="150" height="150" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/03/4-e1522328292433-150x150.png 150w, https://www.richardmaddison.com/wp-content/uploads/2018/03/4-e1522328292433-100x100.png 100w" sizes="(max-width: 150px) 100vw, 150px" /><img loading="lazy" class="alignnone wp-image-21399 size-thumbnail" src="https://www.richardmaddison.com/wp-content/uploads/2018/03/5-e1522328423568-150x150.png" alt="" width="150" height="150" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/03/5-e1522328423568-150x150.png 150w, https://www.richardmaddison.com/wp-content/uploads/2018/03/5-e1522328423568-100x100.png 100w" sizes="(max-width: 150px) 100vw, 150px" /><img loading="lazy" class="alignnone wp-image-21398 size-thumbnail" src="https://www.richardmaddison.com/wp-content/uploads/2018/03/6-e1522328588822-150x150.png" alt="" width="150" height="150" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/03/6-e1522328588822-150x150.png 150w, https://www.richardmaddison.com/wp-content/uploads/2018/03/6-e1522328588822-100x100.png 100w" sizes="(max-width: 150px) 100vw, 150px" /></p>
<p><i><span style="font-weight: 400;">During the learning process (left to right) the boundary function shows weird patterns as it closes in on the red dots. </span></i></p>
<p><span style="font-weight: 400;">The Neural Net architecture and equations were more or less straight out of Andrew’s course but placed into an Excel sheet. The layout shown below is very much orientated towards an Excel instantiation, it allowed me to update the model&#8217;s Weights and Momentum in a single line of VBA for each iteration namely:  Parameters (T) = Parameters (T+1) .value. I subsequently built a fully recursive version with no VBA that made use of Excels inbuilt iteration functionality but this is less satisfying to run.</span></p>
<p>You can view a video of the model in operation here: <a href="https://www.youtube.com/watch?v=mIpJu-I13cc">https://www.youtube.com/watch?v=mIpJu-I13cc</a></p>
<div id="attachment_21390" style="width: 1034px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-21390" loading="lazy" class="wp-image-21390 size-large" src="https://www.richardmaddison.com/wp-content/uploads/2018/03/74227182-e1522328687951-1024x616.png" alt="" width="1024" height="616" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/03/74227182-e1522328687951-1024x616.png 1024w, https://www.richardmaddison.com/wp-content/uploads/2018/03/74227182-e1522328687951-300x181.png 300w, https://www.richardmaddison.com/wp-content/uploads/2018/03/74227182-e1522328687951-768x462.png 768w, https://www.richardmaddison.com/wp-content/uploads/2018/03/74227182-e1522328687951-700x421.png 700w, https://www.richardmaddison.com/wp-content/uploads/2018/03/74227182-e1522328687951-1100x662.png 1100w, https://www.richardmaddison.com/wp-content/uploads/2018/03/74227182-e1522328687951-600x361.png 600w, https://www.richardmaddison.com/wp-content/uploads/2018/03/74227182-e1522328687951.png 1444w" sizes="(max-width: 1024px) 100vw, 1024px" /><p id="caption-attachment-21390" class="wp-caption-text">This is the basic layout of the on-sheet Excel. It required approximately 30 separate excel formula</p></div>
<p>The boundary plot i.e. the orange and blue pixels that cover the X plot and represent the boundary function discovered by the neural network required a second neural net without back propagation<span style="font-weight: 400;"> (the learning bit) that looks as follows:</span></p>
<div id="attachment_21411" style="width: 909px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-21411" loading="lazy" class="wp-image-21411 size-full" src="https://www.richardmaddison.com/wp-content/uploads/2018/03/Webp.net-resizeimage-5.png" alt="" width="899" height="424" srcset="https://www.richardmaddison.com/wp-content/uploads/2018/03/Webp.net-resizeimage-5.png 899w, https://www.richardmaddison.com/wp-content/uploads/2018/03/Webp.net-resizeimage-5-300x141.png 300w, https://www.richardmaddison.com/wp-content/uploads/2018/03/Webp.net-resizeimage-5-768x362.png 768w, https://www.richardmaddison.com/wp-content/uploads/2018/03/Webp.net-resizeimage-5-700x330.png 700w, https://www.richardmaddison.com/wp-content/uploads/2018/03/Webp.net-resizeimage-5-600x283.png 600w" sizes="(max-width: 899px) 100vw, 899px" /><p id="caption-attachment-21411" class="wp-caption-text">The Neural network used for the boundary function was even simpler with only 8 separate formulae.</p></div>
<p>I subsequently recorded a construction video which runs for over an hour but gives a lot more detail on the Excel needed to get this up and running. You can view the video here: <a href="https://www.youtube.com/watch?v=suZhX6N5LAk&amp;t=3042s">https://www.youtube.com/watch?v=suZhX6N5LAk&amp;t=3042s</a></p>
<p>You can download the Excel file here:    <a href="https://drive.google.com/open?id=1kjnTsY9yC3QaQx3f_XHhoouVULLBYgs4" target="blank" class="emd_dl_grey_light">Download Excel</a>
        <style type="text/css">
    .emd_dl_grey_light {
        -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
        -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
        box-shadow:inset 0px 1px 0px 0px #ffffff;
        background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f9f9f9), color-stop(1, #e9e9e9) );
        background:-moz-linear-gradient( center top, #f9f9f9 5%, #e9e9e9 100% );
        filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#e9e9e9');
        background-color:#f9f9f9;
        -webkit-border-top-left-radius:0px;
        -moz-border-radius-topleft:0px;
        border-top-left-radius:0px;
        -webkit-border-top-right-radius:0px;
        -moz-border-radius-topright:0px;
        border-top-right-radius:0px;
        -webkit-border-bottom-right-radius:0px;
        -moz-border-radius-bottomright:0px;
        border-bottom-right-radius:0px;
        -webkit-border-bottom-left-radius:0px;
        -moz-border-radius-bottomleft:0px;
        border-bottom-left-radius:0px;
        text-indent:0;
        border:1px solid #dcdcdc;
        display:inline-block;
        color:#666666 !important;
        font-family:Georgia;
        font-size:15px;
        font-weight:bold;
        font-style:normal;
        height:41px;
        line-height:41px;
        width:153px;
        text-decoration:none;
        text-align:center;
        text-shadow:1px 1px 0px #ffffff;
    }
    .emd_dl_grey_light:hover {
        background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #e9e9e9), color-stop(1, #f9f9f9) );
        background:-moz-linear-gradient( center top, #e9e9e9 5%, #f9f9f9 100% );
        filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e9e9e9', endColorstr='#f9f9f9');
        background-color:#e9e9e9;
    }.emd_dl_grey_light:active {
        position:relative;
        top:1px;
    }
    </style></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/03/29/neural-networks-in-excel-finding-andrew-ngs-hidden-circle/">Neural Networks in Excel – Finding Andrew Ng’s Hidden Circle</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/03/29/neural-networks-in-excel-finding-andrew-ngs-hidden-circle/feed/</wfw:commentRss>
			<slash:comments>15</slash:comments>
		
		
			</item>
	</channel>
</rss>
