The Perceptron
51
The Perceptron
perceptron(D, T):
𝜃 = zeros(d); 𝜃0 = 0 for t=1 to T
for i=1 to n
if𝑦𝑖 𝜃𝑇𝑥𝑖 +𝜃0 ≤0:
𝜃 = 𝜃 + 𝑦(𝑖)𝑥(𝑖)
𝜃0 = 𝜃0 + 𝑦(𝑖) return(𝜃, 𝜃0)
52
The Perceptron
51
The Perceptron
perceptron(D, T):
𝜃 = zeros(d); 𝜃0 = 0 for t=1 to T
for i=1 to n
if𝑦𝑖 𝜃𝑇𝑥𝑖 +𝜃0 ≤0:
𝜃 = 𝜃 + 𝑦(𝑖)𝑥(𝑖)
𝜃0 = 𝜃0 + 𝑦(𝑖) return(𝜃, 𝜃0)
52