Below is the code to show the sentence similarity in a heat map. The final graph is a nxn matrix where each entry [i, j] is colored based on the inner product of the encodings for sentence i and j.
def plot_similarity(labels, features, rotation):
corr = np.inner(features, features)
sns.set(font_scale=1.2)
g = sns.heatmap(
corr,
xticklabels=labels,
yticklabels=labels,
vmin=0,
vmax=1,
cmap="YlOrRd")
g.set_xticklabels(labels, rotation=rotation)
g.set_title("Semantic Textual Similarity")
def run_and_plot(messages_):
message_embeddings_ = embed(messages_)
plot_similarity(messages_, message_embeddings_, 90)
The heatmap works fine, however as the number of message increase, the results are no more visible. Is there a way to zoom the heatmap? Or the size increases based on the number of entries?
Thanks!
question from:
https://stackoverflow.com/questions/65941440/how-to-increase-size-of-heat-map-built-using-seaborn 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…