zjunlp/KNN-KG

Would you mind open-sourcing the code drawn by Figure 6?

Closed this issue · 4 comments

Would you mind open-sourcing the code drawn by Figure 6?

We mainly use the function from seaborn.

ax = sns.jointplot(data=df,x='x',y='y', hue="id", legend=True) 

We use t-sne to make dimensionality reduction on the entity embedding with 768-d to 2-d.
You can get the nearest neighbor entities from the knowledge store. And calculate the distance to draw the circle.

Would you mind giving a piece of code that works? Data can be filled at will.

import seaborn as sns
import pandas as pd
df = pd.read_csv("tsne.csv")
sns.set_style("white")
sns.set_theme(font='Courier New')
# p = sns.color_palette("Paired", as_cmap=True)
p = sns.color_palette("Set2",20, as_cmap=True)
sns.set_palette("Paired")
ax = sns.jointplot(data=df,x='x',y='y', hue="name", legend=True) 
ax.ax_joint.legend(bbox_to_anchor=(1.23, 0.5),loc="center left", borderaxespad=0.)

tsne.csv
You can run this code to get the pic and draw the circle as you wish.
And it may diff from the paper as we select fewer entities in this process.

Thx. I will try. Good luck with you.