<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Ask Ghassem - Recent questions tagged gradient-decent</title>
<link>https://ask.ghassem.com/tag/gradient-decent</link>
<description>Powered by Question2Answer</description>
<item>
<title>How to update weights in backpropagation algorithm (a numerical example)?</title>
<link>https://ask.ghassem.com/612/update-weights-backpropagation-algorithm-numerical-example</link>
<description>&lt;p&gt;Assume we have the following neural network and all activation functions are $f(z)=z$. If the weights are initialized with the values you see in table below, what will be new updated weights after one step if learning rate, $\alpha = 0.05$?&lt;/p&gt;

&lt;p&gt;Assume the input values are [$i_1$,$i_2$] = [2,3] and target value&amp;nbsp;$out = 1$.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hint:&lt;/strong&gt;&lt;br&gt;
$w_{new} = w_{old} - \alpha \frac{\partial E}{\partial w}$&lt;/p&gt;

&lt;p&gt;$E_{\text {total}}=\sum \frac{1}{2}(\text {target}-\text {output})^{2}$&lt;/p&gt;

&lt;table border=&quot;1&quot; cellpadding=&quot;1&quot; style=&quot;height:225px; width:394px&quot;&gt;
&lt;caption&gt;Updating weights in backpropagation algorithm&lt;/caption&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Weights&lt;/td&gt;
&lt;td&gt;Initialization&lt;/td&gt;
&lt;td&gt;New weights after one step&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$w1$&lt;/td&gt;
&lt;td&gt;0.11&lt;/td&gt;
&lt;td&gt;?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$w2$&lt;/td&gt;
&lt;td&gt;0.21&lt;/td&gt;
&lt;td&gt;?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$w3$&lt;/td&gt;
&lt;td&gt;0.12&lt;/td&gt;
&lt;td&gt;?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$w4$&lt;/td&gt;
&lt;td&gt;0.08&lt;/td&gt;
&lt;td&gt;?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$w5$&lt;/td&gt;
&lt;td&gt;0.14&lt;/td&gt;
&lt;td&gt;?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$w6$&lt;/td&gt;
&lt;td&gt;0.15&lt;/td&gt;
&lt;td&gt;?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://i.imgur.com/v0RMeOQ.png&quot;&gt;https://i.imgur.com/v0RMeOQ.png&lt;/a&gt;&lt;/p&gt;</description>
<category>Machine Learning</category>
<guid isPermaLink="true">https://ask.ghassem.com/612/update-weights-backpropagation-algorithm-numerical-example</guid>
<pubDate>Thu, 11 Apr 2019 17:02:04 +0000</pubDate>
</item>
<item>
<title>How to update weights using gradient decent algorithm?</title>
<link>https://ask.ghassem.com/596/how-to-update-weights-using-gradient-decent-algorithm</link>
<description>&lt;p&gt;For the&amp;nbsp;below neural network, imagine we are going to use&amp;nbsp;the&amp;nbsp;&lt;strong&gt;backpropagation algorithm&lt;/strong&gt; to update weights. If the Bias (b) in this problem is always 0 (ignore bias when you solve the problem), and we have a dataset with only one record of $x=2$ and the target value of $y=5$ as you can see in the following table,&amp;nbsp;and activation function&amp;nbsp;is defined as $f(z) = z$&lt;/p&gt;

&lt;table border=&quot;1&quot; cellpadding=&quot;1&quot; style=&quot;width:200px&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot;&gt;feature (x)&lt;/th&gt;
&lt;th scope=&quot;col&quot;&gt;Target (y)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1) Define the cost function, $J(w)$, based on the error in backpropagation algorithm: $J(w) = E = \frac{1}{2}(predicted - target)^2$, and draw it&lt;/p&gt;

&lt;p&gt;2) Initialize the weight by $w=3$, and calculate the error&lt;/p&gt;

&lt;p&gt;3) Calculate updated weights using the gradient&amp;nbsp;decent algorithm &lt;strong&gt;after three updates &lt;/strong&gt;if we have the following values for learning rate ($\alpha$)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$\alpha$ = 1&lt;/li&gt;
&lt;li&gt;$\alpha$ = 0.1&lt;/li&gt;
&lt;li&gt;$\alpha$ = 0.5&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hint:&amp;nbsp; &amp;nbsp;$w_{new} = w_{old} - \alpha \frac{\partial E}{\partial w}$&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://i.imgur.com/uohFS6l.png&quot;&gt;https://i.imgur.com/uohFS6l.png&lt;/a&gt;&lt;/p&gt;</description>
<category>Machine Learning</category>
<guid isPermaLink="true">https://ask.ghassem.com/596/how-to-update-weights-using-gradient-decent-algorithm</guid>
<pubDate>Thu, 28 Mar 2019 17:17:39 +0000</pubDate>
</item>
</channel>
</rss>