Isomap with Scikit-learn

Play with Isomap. It can be used in almost the same way as PCA.

isomap.py


from sklearn.datasets import load_digits
from sklearn.manifold import Isomap
import matplotlib.pyplot as plt

##Data reading
digits = load_digits()
X = digits.data
y = digits.target
target_names = digits.target_names

## Isomap
n_neighbors=30
isomap = Isomap(n_neighbors=30, n_components=2)
X_iso = isomap.fit(X).transform(X)

## colors
colors = [plt.cm.nipy_spectral(i/10., 1) for i in range(10)]

## plot
plt.figure()
for c, target_name  in zip(colors, target_names):
    plt.scatter(X_iso[y == target_name, 0], X_iso[y == target_name, 1], c=c, label = target_name)
plt.legend()
plt.title('Isomap')
plt.show()

Execution result.

Untitled.png

reference: Scikit-learn PCA sample Scikit-learn manifold learning sample

Recommended Posts

Isomap with Scikit-learn
DBSCAN with scikit-learn
Clustering with scikit-learn (1)
Clustering with scikit-learn (2)
PCA with Scikit-learn
kmeans ++ with scikit-learn
Cross Validation with scikit-learn
Multi-class SVM with scikit-learn
Clustering with scikit-learn + DBSCAN
Learn with chemoinformatics scikit-learn
DBSCAN (clustering) with scikit-learn
Install scikit.learn with pip
Calculate tf-idf with scikit-learn
Neural network with Python (scikit-learn)
Parallel processing with Parallel of scikit-learn
[Python] Linear regression with scikit-learn
Robust linear regression with scikit-learn
Grid search of hyperparameters with Scikit-learn
Creating a decision tree with scikit-learn
Image segmentation with scikit-image and scikit-learn
Identify outliers with RandomForestClassifier in scikit-learn
Laplacian eigenmaps with Scikit-learn (personal notes)
Non-negative Matrix Factorization (NMF) with scikit-learn
Try machine learning with scikit-learn SVM
Scikit-learn DecisionTreeClassifier with datetime type values
The most basic clustering analysis with scikit-learn
Let's tune the model hyperparameters with scikit-learn!
Revisited scikit-learn
[Scikit-learn] I played with the ROC curve
Try SVM with scikit-learn on Jupyter Notebook
Multi-label classification by random forest with scikit-learn
[Python] Use string data with scikit-learn SVM
Clustering representative schools in summer 2016 with scikit-learn
Implement a minimal self-made estimator with scikit-learn
Fill in missing values with Scikit-learn impute
Visualize scikit-learn decision trees with Plotly's Treemap
I tried handwriting recognition of runes with scikit-learn
Predict the second round of summer 2016 with scikit-learn
Multivariable regression model with scikit-learn --SVR comparison verification