Created
September 17, 2018 16:55
-
-
Save ImadDabbura/538f22b74fa8e63f21836faab035d633 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Cricles | |
| X1 = make_circles(factor=0.5, noise=0.05, n_samples=1500) | |
| # Moons | |
| X2 = make_moons(n_samples=1500, noise=0.05) | |
| fig, ax = plt.subplots(1, 2) | |
| for i, X in enumerate([X1, X2]): | |
| fig.set_size_inches(18, 7) | |
| sp = SpectralClustering(n_clusters=2, affinity='nearest_neighbors') | |
| sp.fit(X[0]) | |
| labels = sp.labels_ | |
| ax[i].scatter(X[0][:, 0], X[0][:, 1], c=labels) | |
| plt.suptitle('Simulated data', y=1.05, fontsize=22, fontweight='semibold') | |
| plt.tight_layout(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment