$$x_1$$
$$w_1$$
$$x_2$$
$$x_3$$
$$y_1$$
$$\sigma$$
$$w_2$$
$$w_3$$
https://cdn.vectorstock.com/i/composite/12,25/neuron-cell-vector-81225.jpg
soma
dendrite
axon
synapse
fires if visual is funny
fires if speech style is funny
fires if text is funny
fires if at least 2 of 3 inputs fired
________________________________________
face
nose
mouth
eyes
|
---|
\(y=f(g(x)) = 1\) if \(g(x) \geq \theta\)
\(= 0\) if \(g(x) < \theta\)
3
1
0
1
0
1
2
0
1
OR
\(x_1 + x_2 + x_3= \theta = 1\)
|
---|
|
---|
$$x_1$$
$$x_2$$
$$x_n$$
$$y$$
$$w_1$$
$$w_2$$
$$w_n$$
$$..$$
$$..$$
$$..$$
$$..$$
$$x_0=1$$
$$w_0=-\theta$$
$$x_1$$
$$w_1$$
$$x_2$$
$$x_n$$
$$w_2$$
$$w_n$$
$$..$$
$$..$$
$$..$$
$$..$$
$$y$$
$$x_1$$
$$w_1$$
$$x_2$$
$$y$$
$$w_2$$
$$w_3$$
$$x_0=1$$
$$w_0=-\theta$$
$$x_3$$
$$x_1$$
$$w_1$$
$$x_2$$
$$y$$
$$w_2$$
$$w_3$$
$$x_0=1$$
$$w_0=-\theta$$
$$x_3$$
\(x_1\)
\(x_2\)
OR
\(0\)
\(1\)
\(0\)
\(1\)
\(0\)
\(0\)
\(1\)
\(1\)
\(0\)
\(1\)
\(1\)
\(1\)
\(-1\)
\(-1\)
\(1\)
\(1.5\)
\(0\)
\(1\)
\(10\)
\(-10\)
\(2\)
...
...
(scaled to 0 to 1)
(scaled to 0 to 1)
$$w_1$$
$$w_2$$
$$w_n$$
$$..$$
$$..$$
$$w_0=-\theta$$
$$x_1$$
$$x_2$$
$$x_n$$
$$y$$
$$..$$
$$..$$
$$x_0=1$$
\(P \gets\) \(inputs\) \(with\) \(label\) \(1\);
\(N \gets\) \(inputs\) \(with\) \(label\) \(0\);
Initialize \(\text w\) randomly;
while \(!convergence\) do
Pick random \(\text x\) \(\isin\) \( P\) \(\cup\) \( N\) ;
\(\text w\) = \(\text w\) \(+\) \(\text x\) ;
end
end
//the algorithm converges when all the inputs
are classified correctly
if \(\text x\) \(\isin\) \(\text P\) \(and\) \(\sum_{i=0}^{n}\ w_i*x_i < 0\) then
end
if \(\text x\) \(\isin\) \(\text N\) \(and\) \(\sum_{i=0}^{n}\ w_i*x_i \geq 0\) then
\(\text w\) = \(\text w\) \(-\) \(\text x\) ;
(\(\because\) \(cos \alpha \)= \({w^Tx\over \parallel w \parallel \parallel x \parallel}\) = \(0\))
\(y = 1\) \(if \text w^\text T \text x \geq 0\)
\( = 0\) \(if \text w^\text T \text x < 0\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(\text w\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(P \gets\) \(inputs\) \(with\) \(label\) \(1\);
\(N \gets\) \(inputs\) \(with\) \(label\) \(0\);
Initialize \(\text w\) randomly;
while \(!convergence\) do
Pick random \(\text x\) \(\isin\) \( P\) \(\cup\) \( N\) ;
\(\text w\) = \(\text w\) \(+\) \(\text x\) ;
end
end
//the algorithm converges when all the inputs
are classified correctly
if \(\text x\) \(\isin\) \(\text P\) \(and\) \(\sum_{i=0}^{n}\ w_i*x_i < 0\) then
end
if \(\text x\) \(\isin\) \(\text N\) \(and\) \(\sum_{i=0}^{n}\ w_i*x_i \geq 0\) then
\(\text w\) = \(\text w\) \(-\) \(\text x\) ;
\(P \gets\) \(inputs\) \(with\) \(label\) \(1\);
\(N \gets\) \(inputs\) \(with\) \(label\) \(0\);
Initialize \(\text w\) randomly;
while \(!convergence\) do
Pick random \(\text x\) \(\isin\) \( P\) \(\cup\) \( N\) ;
\(\text w\) = \(\text w\) \(+\) \(\text x\) ;
end
end
//the algorithm converges when all the inputs
are classified correctly
if \(\text x\) \(\isin\) \(\text P\) \(and\) \(\sum_{i=0}^{n}\ w_i*x_i < 0\) then
end
if \(\text x\) \(\isin\) \(\text N\) \(and\) \(\sum_{i=0}^{n}\ w_i*x_i \geq 0\) then
\(\text w\) = \(\text w\) \(-\) \(\text x\) ;
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(x_2\)
\(x_1\)
\(p_2\)
\(p_3\)
\(p_1\)
\(n_1\)
\(n_2\)
\(n_3\)
\(N \gets\) \(inputs\) \(with\) \(label\) \(0\);
Initialize \(\text w\) randomly;
while \(!convergence\) do
Pick random \(\text p\) \(\isin\) \( P'\)
\(\text w\) = \(\text w\) \(+\) \(\text p\) ;
end
end
//the algorithm converges when all the inputs are classified correctly
if \(\sum_{i=0}^{n}\ w_i*p_i < 0\) then
\(N^- \gets\) \(negations~of~all~points~in\) \(N\);
\(P' \gets P \cup N^-\)
\(\text p \gets\) \({\text p \over \parallel \text p \parallel}\) (so now, \(\parallel \text p\parallel = 1)\)
Setup
//notice that we do not need the other if condition
because by construction we want all points in \(P'\) to lie
\(P \gets\) \(inputs\) \(with\) \(label\) \(1\);
Proof:
Observations:
Proof (continued):
Proof (continued):
\(x_1\)
\(x_2\)
XOR
\(0\)
\(1\)
\(0\)
\(1\)
\(0\)
\(0\)
\(1\)
\(1\)
\(0\)
\(1\)
\(1\)
\(0\)
\(x_1\)
\(x_2\)
\(0\)
\(0\)
\(1\)
\(0\)
\(0\)
\(1\)
\(1\)
\(1\)
\(0\)
\(0\)
\(0\)
\(0\)
\(0\)
\(0\)
\(0\)
\(1\)
\(0\)
\(0\)
\(1\)
\(0\)
\(0\)
\(0\)
\(1\)
\(1\)
\(0\)
\(1\)
\(0\)
\(0\)
\(0\)
\(1\)
\(0\)
\(1\)
\(0\)
\(1\)
\(1\)
\(0\)
\(0\)
\(1\)
\(1\)
\(1\)
\(1\)
\(0\)
\(0\)
\(0\)
\(1\)
\(0\)
\(0\)
\(1\)
\(1\)
\(0\)
\(1\)
\(0\)
\(1\)
\(0\)
\(1\)
\(1\)
\(1\)
\(1\)
\(0\)
\(0\)
\(1\)
\(1\)
\(0\)
\(1\)
\(1\)
\(1\)
\(1\)
\(0\)
\(1\)
\(1\)
\(1\)
\(1\)
\(f_1\)
\(f_2\)
\(f_3\)
\(f_4\)
\(f_5\)
\(f_6\)
\(f_7\)
\(f_8\)
\(f_9\)
\(f_{10}\)
\(f_{11}\)
\(f_{12}\)
\(f_{13}\)
\(f_{14}\)
\(f_{15}\)
\(f_{16}\)
$$x_1$$
$$x_2$$
$$y$$
$$w_0=-2$$
$$w_1$$
$$w_2$$
$$w_3$$
$$w_4$$
$$x_1$$
$$x_2$$
$$y$$
$$bias=-2$$
$$w_1$$
$$w_2$$
$$w_3$$
$$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