Answers of hw - 4 (Manifold)

Answer 1

a) Graph of residual errors vs dimension (for RandomMotion100.zip): graph 1) residual error vs dimension of 100 images b) Discussion:

The residual error sharply increases when dimension is reduced below 2 because 2 is the lowest dimensions that these set of images can be represented in (in terms of theta1 and theta2)

It is impossible to exactly represent these images using any number of dimensions less than 2

c) 2D mapping: 2D mapping - isomap

The boundary theta-s are not on the boundary of this graph

d) Residual errors for RandomMotion1k.zip:

The residual errors increases with the higher number of configurations

e) Table of first 20 theta1, theta2 vs y1, y2:

theta1 theta1 y1 y1
21.708280 23.289759 -323.3017 -415.4495
20.963717 26.445587 -375.5832 287.6242
25.773035 19.942950 -188.7415 -127.9989
26.921942 10.453383 -450.5406 82.4779
28.739040 16.162862 294.9661 439.1663
24.460459 12.614105 -126.0120 -245.5464
27.325196 7.879244 -4.2116 -49.3457
23.942938 21.592861 169.0180 378.5916
28.450352 13.065413 572.2561 -562.2537
27.155386 4.504699 85.6251 96.5912
24.558251 7.640685 -267.3923 355.7070
25.452280 12.361451 103.3769 216.0948
25.685854 23.495475 -28.8359 -66.9891
28.677191 4.586599 269.4704 363.4453
22.755089 12.452133 98.4703 -117.8967
29.240948 9.477505 -234.7320 -486.0001
27.894608 4.657732 336.4506 -824.1019
20.822057 27.990783 104.2011 -26.7218
20.255749 12.828469 -190.7173 -508.8002
23.821824 9.272910 361.0947 157.9159

We can say that

Answer 2

Top 2 eigen values by PCA:

2.3295e+004

3.1665e+003

These two eigen values are pretty large as compared to the rest of the eigen values. e.g. The subsequent 3 eigen values are:

1.335e+003 <\p>

1.005e+003

3.23e+002

Plot of points in 2d after PCA:

2D plot after PCA

Reconstruction of y = y1+y2 into x: PCA y' reconstruction

Code used:

model = lle(double(data),8,2);

disp(model);

yprime = model(:,1)+model(:,2);

[IDX, D] = knnsearch((model)',(yprime)','k',8);

[COEFF,scores,latent] = princomp((double(data))','econ');

latentd = sort(latent,'descend');

disp(latentd(1));

disp(latentd(2));

i1=0;

i2=0;

for i=1:size(latent)

if(i1==0)

if(latent(i) == latentd(1))

i1=i;

end

end

if(i2==0)

if(latent(i) == latentd(2))

i2=i;

end

end

end

scores2 = [scores(:,i1), scores(:,i2)];

scatter(scores2(:,1),scores2(:,2));

COEFF2 = [COEFF(:,i1), COEFF(:,i2)];

data1 = [scores(1,1)*COEFF2(:,1), scores(1,2)*COEFF2(:,2)];

data2 = [scores(2,1)*COEFF2(:,1), scores(2,2)*COEFF2(:,2)];

datavg = data1+data2;

finaldat = datavg(:,1)+datavg(:,2);

img1 = reshape(finaldat,100,100);

img1 = imresize(img1 ,[800 800]);

imshow(img1);

Answer 3

Matrix of coordinates with respect to the two new dimensions obtained on using lle on RandomMotion100.zip:

Columns 1 through 5

0.4152 0.4633 -0.9008 0.1889 -1.8013 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 6 through 10 1.2107 0.1692 -0.1742 -1.1041 0.2440 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 11 through 15 1.1688 0.7376 -0.8987 -0.4803 1.5450 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 16 through 20 -1.0656 -0.1976 0.7152 1.3658 1.4343 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 21 through 25 -0.9348 1.4439 0.0749 0.4982 0.3161 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 26 through 30 -0.3003 -1.0394 -0.1051 0.3519 -0.2138 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 31 through 35 0.2435 0.4666 1.5578 -0.1426 1.2610 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 36 through 40 0.6492 -1.8609 -0.4142 -1.8033 0.8148 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 41 through 45 -1.8098 -0.8328 0.0760 0.5499 -0.0984 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 46 through 50 1.0985 -0.7668 0.2669 0.0386 0.7633 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 51 through 55 0.2686 1.2689 0.1492 0.2066 1.4287 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 56 through 60 -0.8853 0.8936 1.4169 0.0851 0.3552 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 61 through 65 -1.8288 1.2826 -0.7267 -0.3751 -1.7093 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 66 through 70 0.8434 -1.6805 -1.1359 -1.5234 0.2007 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 71 through 75 0.2780 -1.4879 0.2388 0.7024 -1.0986 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 76 through 80 -0.6116 -1.5418 -0.8451 -0.1752 -1.6009 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 81 through 85 -0.3770 -0.8422 0.1032 -1.6888 1.5523 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 86 through 90 -0.6695 0.2864 1.6278 0.4872 1.0765 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 91 through 95 0.9887 -1.2443 -0.4657 0.7740 1.2824 1.0000 1.0000 1.0000 1.0000 1.0000 Columns 96 through 100 1.2910 -1.0248 -1.5243 1.1915 1.5986 1.0000 1.0000 1.0000 1.0000 1.0000

Code used:

model = lle(double(data),8,2);

disp(model);

yprime = model(:,1)+model(:,2);

[IDX, D] = knnsearch((model)',(yprime)','k',8);

However the knnsearch function kept giving errors and hence the question couldnt be fully answered

Answer 4

After executing pca.m on the 2k pics the 2d plot of points:

Error generated: ??? Error using ==> svd Out of memory. Type HELP MEMORY for your options.

Conducting isomap on 2k data, 2D plot obtained:

2d plot after isomap on 2k data