[PYTHON] Laplacian eigenmaps with Scikit-learn (personal notes)

References

Reference code

Embed a roll cake in a two-dimensional subspace.

python


# codeing: utf-8

import numpy as np
from numpy.random import uniform
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

from sklearn import manifold

n=1000
k=10

a=np.array(3*np.pi*uniform(0,1,n), dtype=np.float64)
x = np.vstack((a*np.cos(a), 30*uniform(0,1,n), a*np.sin(a)))

fig = plt.figure()
ax = Axes3D(fig)
ax.scatter(x[0,:],x[1,:],x[2,:], c=x[0,:]+x[2,:])
plt.show()

embedder = manifold.SpectralEmbedding(n_components=2, random_state=0, n_neighbors=k,
                                      eigen_solver="arpack")
x_se = embedder.fit_transform(x.T)

plt.scatter(x_se[:,0],x_se[:,1], c=x_se[:,0]+x_se[:,1])
plt.show()

Output result

3D roll cake

3Ddata.png

2D roll cake

2Ddata.png

Recommended Posts

Laplacian eigenmaps with Scikit-learn (personal notes)
WEB scraping with Python (for personal notes)
Gaussian process regression with PyMC3 Personal notes
Isomap with Scikit-learn
Notes about with
DBSCAN with scikit-learn
Clustering with scikit-learn (1)
Clustering with scikit-learn (2)
PCA with Scikit-learn
python personal notes
kmeans ++ with scikit-learn
Pandas Personal Notes Summary
missingintegers python personal notes
Multi-class SVM with scikit-learn
Clustering with scikit-learn + DBSCAN
Manipulate excel files from python with xlrd (personal notes)
Learn with chemoinformatics scikit-learn
[Personal notes] Python, Django
DBSCAN (clustering) with scikit-learn
Install scikit.learn with pip
Calculate tf-idf with scikit-learn
Neural network with Python (scikit-learn)
Notes playing with symbolic links
Auto Encodder notes with Keras
Parallel processing with Parallel of scikit-learn
[Python] Linear regression with scikit-learn
Robust linear regression with scikit-learn
[Reading Notes] Hands-on Machine Learning with Scikit-Learn, Keras, and TensorFlow Chapter 1