def test_square_grid():
X = np.mgrid[0:16, 0:16]
X = X.reshape((len(X), -1)).T
name = 'square'
D, Q = test_toy_embedding(X, 32, 2, name, palette='hls')
def plot_mat_on_data(mat, sample):
plt.figure()
plot_data_embedded(X, palette='w')
alpha = np.maximum(mat[sample], 0) / mat[sample].max()
plot_data_embedded(X, palette='#FF0000', alpha=alpha)
pdf_file_name = '{}{}_plot_{}_on_data_{}{}'
plot_mat_on_data(D, 7 * 16 + 7)
plt.savefig(pdf_file_name.format(dir_name, name, 'D', 'middle', '.pdf'))
plot_mat_on_data(Q, 7 * 16 + 7)
plt.savefig(pdf_file_name.format(dir_name, name, 'Q', 'middle', '.pdf'))
# for s in range(len(X)):
# plot_mat_on_data(Q, s)
# plt.savefig(pdf_file_name.format(dir_name, name, 'Q', s, '.png'))
# plt.close()
评论列表
文章目录