Machine Learning Perceptron Algorithm I'm studying Machine Learning using Sebastian Raschka's book. 


Wonder if someone could please help me to confirm if I have the following steps correct if I apply Perceptron Algorithm to Iris dataset as shown in the table below.
What do I set $\eta$ to?
What do I set $θ$ to? I randomly set it to 2.


Perceptron rule - summarized by the following steps:


Initialize the weights to 0 or small random numbers. 
For each training sample $x(i)$ perform the following steps:


Compute the output value $\hat{y}$ .
Update the weights.



\begin{array}{c|c|c|} 
 &amp; \text{sepal_length, $X_1$ } &amp; \text{sepal_width, $X_2$} &amp; \text{petal_length, $X_3$} &amp; \text{petal_width, $X_4$} &amp; \text{species, $Y$}\\ \hline
\text{Row 0} &amp; 5 .1 &amp; 3.5 &amp;1.4 &amp;0.2 &amp; setosa \\ \hline
\text{Row 1} &amp; 4.9 &amp; 3.0 &amp; 1.4 &amp; 0.2 &amp; setosa \\\hline
\text{Row 2} &amp; 4.7 &amp; 3.0 &amp; 1.4 &amp; 0.2 &amp; setosa \\\hline
\text{Row 3} &amp; 4.6 &amp; 3.1 &amp; 1.5 &amp; 0.2 &amp; setosa \\\hline
\text{Row 4} &amp; 5.0 &amp; 3.6 &amp; 1.4 &amp; 0.2 &amp; setosa \\\hline
\end{array}

set: $θ = 2$

set: $virginica = -1,$ $\&gt;$ $setosa = 1$

let's say if $z \ge  θ,$ $\&gt;$ $θ(z) = 1$,  $\&gt;$ $θ(z) = -1$ if otherwise

Initialize weight vector: $W$ = [ $w_1$ = 0.1, $w_2$ = 0.2, $w_3$ = 0.3, $w_4$ = 0.4]

For observation row 0: 

$z = w_1*x_1 + w_2*x_2 + w_3*x_3 + w_4*x_4$ 
$= (0.1* 5.1) + (0.2*3.5) + (0.3*1.4) + (0.4*0.2)$
$= 1.71$

Since $z = 1.71 \lt θ = 2$, $\&gt;$ then $θ(z) = -1$

As for row 0, the perceptron algorithm incorrectly predict $virginica = -1,$, hence the weights would be adjusted.

$w_j:= w_j + \Delta w_j$

$\Delta w_j = \eta(y^{(i)} - \hat{y}^{(i)}) x_j^{(i)}$

Hence,

$\Delta w_1 = \eta(1-(-1))5.1 = 10.2\eta$

$\Delta w_2 = \eta(1-(-1))3.5 = 7.0\eta$

$\Delta w_3 = \eta(1-(-1))1.4 = 2.8\eta$

$\Delta w_3 = \eta(1-(-1))0.2= 0.4\eta$

Update weight vector: $W$ = [ $w_1 = 0.1 + 10.2\eta$, $w_2 = 0.2 + 7.0\eta$, $w_3 = 0.3 + 2.8\eta$, $w_4 = 0.4 +0.4\eta$]

Using the updated weight to Row 1 and repeat the process above.
OK WHAT I understood from your understanding is below:-

1.What do I set η to? 
Answer:**It is learning rate. As usual everyone uses **η=0.01. Learning rate is crucial because if you set bigger values when updating weights the it will reach to a local minima and never reach to global minima. Now if you set it low then it will gradually went to global minima. This iris dataset problem is so trivial that it takes no time to reach global minima but for a complex dataset you will need another factor such as decay rate. After a while, when training you will find the accuracy isn't increasing then the neural net suppose that it reached global minima now if you set decay rate to learning rate like 0.01* decay rate then learning rate will be much less and then it will TRULY converges to global minima as the gradient will be minimized in a small amount.

2.Z is the label for your dataset.You should have used one hot encoding. I think rather than writting everything here i would suggest following links.
Please go to there and then pick up a paper and pen.do the math.Bang.

How Neural Network learns

And obviously check 3Blue1Brown youtube channel's playlist on Neural Net.

Welcome to Deep Learning.Best of luck.