Examples of Neural Network (CS229)

Non-linear classification example

XOR / XNOR function

XOR and XNOR (not XOR) problem can classifify by neural network with complex function.

(source: https://www.coursera.org/learn/machine-learning)

AND function

Recall sigmoid function $g(z)$, there are some values to know:


OR function

(source: https://www.coursera.org/learn/machine-learning)

According to the on-line class quiz above, we know that

$x_1$ $x_2$ $g(x_i)$
0 0 $g(-10)\approx0$
1 0 $g(10)\approx1$
0 1 $g(10)\approx1$
1 1 $g(30)\approx1$

Observe the result in the right column of the table, it is only false at $x_1=0$ and $x_2=0$, so $g(x_i)$ here is an OR function.

General Idea

Negation (NOT)

If we need a not function, then put a large negative coefficient of $x_i,i\ne0$.

For example, if we want a (NOT $x_1$) AND (NOT $x_2$)(i.e. if and only if $x_1=x_2=0$ the result will be TRUE) function, the following function will be feasible.