Created
May 23, 2019 16:55
-
-
Save ychennay/5a1991caf9513a32ac2d4fa4c99740ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment