ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Python Manifold learning on handwritten digits with Isomap

Python Manifold learning on handwritten digits with Isomap

原创 Linux操作系统 作者:jieforest 时间:2012-07-09 11:08:21 0 删除 编辑
The Isomap algorithm is an approach to manifold learning. Isomap seeks a lower dimensional embedding of a set of high dimensional data points estimating the intrinsic geometry of a data manifold based on a rough estimate of each data point’s neighbors.

The scikit-learn library provides a great implmentation of the Isomap algorithm and a dataset of handwritten digits. In this post we'll see how to load the dataset and how to compute an embedding of the dataset on a bidimentional space.

Let's load the dataset and show some samples:

CODE:

from pylab import scatter,text,show,cm,figure
from pylab import subplot,imshow,NullLocator
from sklearn import manifold, datasets

# load the digits dataset
# about 180 samples for the digits (0,1,2,3,4)
digits = datasets.load_digits(n_class=5)
X = digits.data
color = digits.target

# shows some digits
figure(1)
for i in range(36):
ax = subplot(6,6,i)
ax.xaxis.set_major_locator(NullLocator()) # remove ticks
ax.yaxis.set_major_locator(NullLocator())
imshow(digits.images[i], cmap=cm.gray_r) The result should be as follows:


hwdigits.png
[attach]792574[/attach][attach]792574[/attach][attach]792574[/attach][attach]792574[/attach]



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/301743/viewspace-734952/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-04-23

  • 博文量
    443
  • 访问量
    508457