How to do it...

Perform the following steps to perform nonlinear dimension reduction with ISOMAP:

  1. First, install and load the RnavGraphImageData and vegan packages:
        > install.packages("RnavGraphImageData")
        > install.packages("vegan")
        > library(RnavGraphImageData)
        > library(vegan)  
  1. You can then load the dataset, digits:
        > data(digits)  
  1. Rotate and plot the image:
       > sample.digit = matrix(digits[,3000],ncol = 16, byrow=FALSE)
       > image(t(sample.digit)[,nrow(sample.digit):1])  
A sample image from the digits dataset
  1. Next, you can randomly sample 300 digits from the population:
> set.seed(2) > digit.idx = sample(1:ncol(digits),size = 600) ...

Get Machine Learning with R Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.