def plot_gradients(self, foo=False):
'''
Shows the difference between the computed gradients in the ANN modul
and the numerically calculated gradients.
'''
fig = plt.gcf()
fig.canvas.set_window_title('Comparison of the computed gradients')
numgrad, grad, qua, ok = ngc.compare_gradients(self.Net,
self.inputdata_tr,
self.outputdata_tr)
print(qua, ok)
y = numgrad-grad
y2 = np.absolute(y)
plt.bar(np.arange(1,len(y)+1), y)
plt.grid(1)
plt.xlabel('Gradient')
plt.ylabel('Difference')
plt.show()
if foo:
print('numgrad: ', numgrad)
print('grad: ', grad)
print('difference: ', y)
评论列表
文章目录