import numpy as np import matplotlib.pyplot as plt mnist = np.load('mnist.npz') x_train = mnist['x_train'][mnist['y_train']<=1]/255. y_train = mnist['y_train'][mnist['y_train']<=1] x_train = np.array([[img.mean(),img[10:18,11:17].mean()] for img in x_train]) y_train = np.array([[[1,0],[0,1]][n] for n in y_train]) from neurons import neurons model = neurons([2,5,2]) out = np.array([model.predict(x) for x in x_train]) fig = plt.figure(figsize=(6,6), dpi=80) plt.subplot(2,1,1) plt.hist(out[:,0][y_train[:,0]==1], bins=50, color='y') plt.hist(out[:,0][y_train[:,1]==1], bins=50, color='g', alpha=0.5) plt.subplot(2,1,2) plt.hist(out[:,1][y_train[:,0]==1], bins=50, color='y') plt.hist(out[:,1][y_train[:,1]==1], bins=50, color='g', alpha=0.5) plt.show()