O'Reilly logo
  • Jason Aylward thinks this is interesting:

Figure 3-7 plots the data generated by this code with Matplotlib to verify that the distribution is as expected. We see that the data resides in two classes that are neatly separated.


Cover of TensorFlow for Deep Learning


I found this example really confusing.
Only two lines of the code in Example 3-3 are represented in Figure 3-7.

    x_zeros = np.random.multivariate_normal( mean=np.array((-1, -1)), cov=.1*np.eye(2), size=(N//2,))
    x_ones = np.random.multivariate_normal( mean=np.array((1, 1)), cov=.1*np.eye(2), size=(N//2,))

You can plot this with plt.scatter(x_zeros[:, 0], x_zeros[:, 1], color="blue") plt.scatter(x_ones[:, 0], x_ones[:, 1], color="red") to generate the graph.

x_zeros, y_zeros, x_np, y_np and all that vstack(), concatenate() usage completely unnecessary for generating a toy dataset until its time to feed it into the TensorFlow graph.