NeuralNet.py 文件源码

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

项目:hco-experiments 作者: zooniverse 项目源码 文件源码
def visualiseLearnedFeatures(self):
        """
            Visualise the features learned by the autoencoder
        """
        import matplotlib.pyplot as plt

        extent = np.sqrt(self._architecture[0]) # size of input vector is stored in self._architecture
        # number of rows and columns to plot (number of hidden units also stored in self._architecture)
        plotDims = np.rint(np.sqrt(self._architecture[1]))
        plt.ion()
        fig = plt.figure()
        plt.set_cmap("gnuplot")
        plt.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.9, wspace=-0.6, hspace=0.1)
        learnedFeatures = self.getLearnedFeatures()
        for i in range(self._architecture[1]):
            image = np.reshape(learnedFeatures[i,:], (extent, extent), order="F") * 1000
            ax = fig.add_subplot(plotDims, plotDims, i)
            plt.axis("off")
            ax.imshow(image, interpolation="nearest")
        plt.show()
        input("Program paused. Press enter to continue.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号