trainer.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:ANN-PONR-Python3 作者: anon-42 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号