actinf_models.py 文件源码

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

项目:actinf 作者: x75 项目源码 文件源码
def plot_hebbsom_links_distances_activations(X, Y, mdl, predictions, distances, activities):
    """plot the hebbian link matrix, and all node distances and activities for all inputs"""


    hebblink_log = np.log(mdl.hebblink_filter.T + 1.0)

    fig4 = pl.figure()
    fig4.suptitle("Debugging SOM: hebbian links, distances, activities (%s)" % (mdl.__class__.__name__))
    gs = gridspec.GridSpec(4, 1)
    # pl.plot(X, Y, "k.", alpha=0.5)
    # pl.subplot(numplots, 1, numplots-1)
    ax1 = fig4.add_subplot(gs[0])
    # im1 = ax1.imshow(mdl.hebblink_filter, interpolation="none", cmap=pl.get_cmap("gray"))
    im1 = ax1.pcolormesh(hebblink_log, cmap=pl.get_cmap("gray"))
    ax1.set_xlabel("in (e)")
    ax1.set_ylabel("out (p)")
    cbar = fig4.colorbar(mappable = im1, ax=ax1, orientation="horizontal")

    ax2 = fig4.add_subplot(gs[1])

    distarray = np.array(distances)
    print("distarray.shape", distarray.shape)
    pcm = ax2.pcolormesh(distarray.T)
    cbar = fig4.colorbar(mappable = pcm, ax=ax2, orientation="horizontal")

    # pl.subplot(numplots, 1, numplots)
    ax3 = fig4.add_subplot(gs[2])
    actarray = np.array(activities)
    print("actarray.shape", actarray.shape)
    pcm = ax3.pcolormesh(actarray.T)
    cbar = fig4.colorbar(mappable = pcm, ax=ax3, orientation="horizontal")

    ax4 = fig4.add_subplot(gs[3])
    ax4.plot(hebblink_log.flatten())

    print("hebblink_log", hebblink_log)

    fig4.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号