Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from sklearn.manifold import SpectralEmbedding
import seaborn as sns
for threshold in range(1,8):
nonzeros = (conversions_df["Approved_Conversion"] >= threshold)
sizes = conversions_df["Spent"].values ** 2 + 10
mds = SpectralEmbedding(n_components=2, affinity="precomputed")
reduced_dimensions = mds.fit_transform(proximity_matrix)
sns.scatterplot(x=reduced_dimensions[:,0], y=reduced_dimensions[:, 1],
hue=nonzeros, alpha=0.5, legend=False, size=sizes)
plt.title(f"Spectral Embedding Visualization of \n Random Forest Proximity Matrix ({threshold} or More Conversions)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment