324 views
1 1 vote

Consider the following data set with three data points:

$$
\left(\left[\begin{array}{l}
2 \\
2
\end{array}\right],+1\right),\left(\left[\begin{array}{c}
2 \\
-2
\end{array}\right],+1\right),\left(\left[\begin{array}{c}
-2 \\
1
\end{array}\right],-1\right)
$$


The Perceptron algorithm is applied to this data. For the training process, assume the following:

  • The initial weight vector is $w^0=\left[\begin{array}{l}0 \\ 0\end{array}\right]$.
     
  • The data points are processed sequentially in the order they are given for each epoch.
     
  • The prediction rule is: predicted class is +1 if $w^T x \geq 0$, and -1 otherwise.
     
  • The learning rate $\eta$ is $1$.
     
  1. The algorithm will converge with $w=\left[\begin{array}{c}-2 \\ 1\end{array}\right]$
     
  2. The algorithm will converge with $w=\left[\begin{array}{l}2 \\ 1\end{array}\right]$
     
  3. The algorithm will converge with $w=\left[\begin{array}{c}2 \\ -1\end{array}\right]$
     
  4. The algorithm will never converge.

1 Answer

1 1 vote

We will trace the algorithm epoch by epoch until no more updates are made.
Initial State:

  • $w_0=\left[\begin{array}{l}0 \\ 0\end{array}\right]$

Epoch 1
1. Point 1: $x_1=\left[\begin{array}{l}2 \\ 2\end{array}\right], y_1=+1$

  • Calculate activation: $w_0^T x_1=\left[\begin{array}{ll}0 & 0\end{array}\right]\left[\begin{array}{l}2 \\ 2\end{array}\right]=0$.
     
  • Predict class: Since $0 \geq 0$, the predicted class $\dot{y}_1$ is +1 .
     
  • Check for error: $\hat{y}_1=y_1$. The point is correctly classified.
     
  • Result: No update. w remains $\left[\begin{array}{l}0 \\ 0\end{array}\right]$.

2. Point 2: $x_2=\left[\begin{array}{c}2 \\ -2\end{array}\right], y_2=+1$

  • Calculate activation: $w^T x_2=\left|\begin{array}{ll}0 & 0\end{array}\right|\left[\begin{array}{c}2 \\ 2\end{array}\right]=0$.
     
  • Predict class: Since $0 \geq 0$, the predicted class $\hat{y}_2$ is +1.
     
  • Check for error: $\hat{y}_2=y_2$. The point is correctly classified.
     
  • Result: No update. $w$ remains $\left[\begin{array}{l}0 \\ 0\end{array}\right]$.

3. Point 3: $x_3=\left[\begin{array}{c}2 \\ 1\end{array}\right], y_3=-1$

  • Calculate activation: $w^T x_3=\left|\begin{array}{ll}0 & 0\end{array}\right|\left[\begin{array}{c}2 \\ 1\end{array}\right]=0$.
     
  • Predict class: Since $0 \geq 0$, the predicted class $\hat{y}_3$ is +1.
     
  • Check for error: $\hat{y}_3 \neq y_3$ (predicted +1 , actual -1 ). The point is misclassified.
     
  • Result: Update weights.

$$
w_{\text {new }}=w_{\text {old }}+y_3 \cdot x_3=\left[\begin{array}{l}
0 \\
0
\end{array}\right]+(-1)\left[\begin{array}{c}
-2 \\
1
\end{array}\right]=\left[\begin{array}{c}
2 \\
-1
\end{array}\right] .
$$


End of Epoch 1: An update occurred. The new weight vector is $w=\left[\begin{array}{c}2 \\ -1\end{array}\right]$. We proceed to the next epoch.
 

Epoch 2

1. Point 1: $x_1=\left[\begin{array}{l}2 \\ 2\end{array}\right], y_1=+1$

  • Calculate activation: $w^T x_1=\left[\begin{array}{ll}2 & -1\end{array}\right]\left[\begin{array}{l}2 \\ 2\end{array}\right]=(2)(2)+(-1)(2)=2$.
     
  • Predict class: Since $2 \geq 0, \hat{y}_1=+1$.
     
  • Check for error: $\hat{y}_1=y_1$. Correctly classified. No update.

2. Point 2: $x_2=\left[\begin{array}{c}2 \\ -2\end{array}\right], y_2=+1$

  • Calculate activation: $w^T x_2=\left[\begin{array}{ll}2 & 1\end{array}\right]\left[\begin{array}{c}2 \\ -2\end{array}\right]=(2)(2)+(-1)(-2)=6$.
     
  • Predict class: Since $6 \geq 0, \hat{y}_2=+1$.
     
  • Check for error: $\hat{y}_2=y_2$. Correctly classified. No update.

3. Point 3: $x_3=\left[\begin{array}{c}-2 \\ 1\end{array}\right], y_3=-1$

  • Calculate activation: $w^T x_3=\left[\begin{array}{ll}2 & -1\end{array}\right]\left[\begin{array}{c}-2 \\ 1\end{array}\right]=(2)(-2)+(-1)(1)=-5$.
     
  • Predict class: Since $5<0, \hat{y}_3=-1$.
     
  • Check for error: $\hat{y}_3=y_3$. Correctly classified. No update.

End of Epoch 2: No updates were made during this entire epoch. The algorithm has converged.

The algorithm will converge with $w=\left[\begin{array}{c}2 \\ -1\end{array}\right]$

Answer:
Position:
Show:

Related questions

2 2 votes
1 1 answer
255
255 views
GO Classes asked Oct 7, 2025
255 views
Consider the following data set:\[\begin{array}{|c|c|c|}\hlinef_1 & f_2 & y \\\hline-1 & -1 & -1 \\0 & 1 & +1 \\1 & 0 & +1 \\1 & 1 & +1 \\\hline\end{array}\]If the Percep...
1 1 vote
1 1 answer
252
252 views
GO Classes asked Oct 7, 2025
252 views
Assume that the Perceptron algorithm is applied to a data set in which the maximum of the lengths of the data points is $4$ and the value of the margin ( $\gamma$ ) of th...
1 1 vote
1 1 answer
351
351 views
GO Classes asked Oct 7, 2025
351 views
A binary classification dataset has 1000 data points belonging to $\{0,1\}^2$. A naive Bayes algorithm was run on the same dataset that results in the following estimate:...
0 0 votes
1 1 answer
287
287 views
GO Classes asked Oct 7, 2025
287 views
A binary classification dataset has 1000 data points belonging to $\{0,1\}^2$. A naive Bayes algorithm was run on the same dataset that results in the following estimate:...