上QQ阅读APP看书,第一时间看更新
Checking linear separability
The session has now taken the four XOR linearly non-separable (see Chapter 4, Become an Unconventional Innovator) predicates, that is, four possibilities, and computed a linearly separable solution:
The input of the output expected was the following:
XOR_Y = [[0],[1],[1],[0]]
One of the results obtained is the following:
Output [[ 0.01742549]
[ 0.98353356]
[ 0.98018438]
[ 0.01550745]
The results are separable as described in Chapter 4, Become an Unconventional Innovator. If you plot the values, you can separate them with a line.
The results are displayed by printing the intermediate values as the session runs, as shown in the following code:
if epoch % 10000 == 0:
print('Epoch ', epoch)
print('Output ', sess.run(Output, feed_dict={x_: XOR_X, y_: XOR_Y}))
print('Weights 1 ', sess.run(W1))
print('Bias 1 ', sess.run(B1))
print('Weights 2 ', sess.run(W2))
print('Bias 2 ', sess.run(B2))
print('cost ', sess.run(cost, feed_dict={x_: XOR_X, y_: XOR_Y}))
These source code lines are difficult to visualize. Using a graph to represent your architecture helps to see the strong and weak points of a solution.