Visualizer.py 文件源码

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

项目:rank-ordered-autoencoder 作者: paulbertens 项目源码 文件源码
def saveFinalPlots(self, errors_train, errors_test, sparsity_train, sparsity_test, errors_train_vector, errors_test_vector, epoch=0):
        #plot errors
        plt.figure(2, figsize=(10, 7))
        plt.clf()
        plt.plot(np.arange(len(errors_train)), errors_train, label='train error')
        plt.plot(np.arange(len(errors_train)), errors_test, label='test error')
        plt.colors()
        plt.legend()
        plt.title('Reconstruction error convergence')
        plt.xlabel('t')
        plt.ylabel('Reconstruction error')
        plt.savefig('plots/Reconstruction_errors_'+str(epoch)+'.pdf')

        #plot sparsity, real and non-zero
        plt.figure(3, figsize=(10, 7))
        plt.clf()
        plt.plot(np.arange(len(sparsity_train)), sparsity_train, label='train error')
        plt.plot(np.arange(len(sparsity_test)), sparsity_test, label='test error')
        plt.colors()
        plt.legend()
        plt.title('Objective function error convergence')
        plt.xlabel('t')
        plt.ylabel('E')
        plt.savefig('plots/Sparsity_'+str(epoch)+'.pdf')

        # plot reconstruction error output progression over time
        plt.figure(12, figsize=(10, 7))
        plt.clf()
        image=plt.imshow(np.clip(np.asarray(errors_train_vector).T, 0, 1), interpolation='nearest', aspect='auto', origin='lower')
        plt.xlabel('t')
        plt.ylabel('Output units \n (Rank Ordered)')
        plt.colors()
        plt.colorbar(image, label='reconstruction error')
        plt.title('Progressive reconstruction input error convergence')
        plt.savefig('plots/Reconstruction_errors_vector_' + str(epoch) + '.pdf')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号