Embedding data points problem
Show older comments
Hello. I wrote this following which I have theta data column points (1024 in my case)and finds the eigenvectors of the Laplace-Beltrami operator using density invariant normalization.
theta=0:2*pi/1023:2*pi;
t=-1.5:3/511:1.5;
P=my_data(theta,t);
B=(1/size(P,2))*sum(P,2);
U=zeros(size(P));
for l=1:size(P,2)
U(:,l)=B;
end
X=P-U;
epsilon=0.01
W=zeros(size(P,2),size(P,2));
T=zeros(size(P,2),size(P,2));
for i=1:size(P,2)
for j=1:size(P,2)
W(i,j)=exp(-norm(X(:,i)-P(:,j))/(sqrt(2*epsilon)));
end
end
a=(sum(W,2))';
D=zeros(size(W,1),size(W,2));
for k=1:size(W,2)
D(k,k)=a(k);
end
T=inv(D)*W*inv(D);
b=(sum(T,2))';
D2=zeros(size(W,1),size(W,2));
for m=1:size(W,2)
D2(m,m)=b(m);
end
Anorm=inv(D2)*T;
G=(D2^(-0.5))*T*(D2^(-0.5));
[V,gamma]=eig(G);
Now I need to make embedding of each column of X onto the first 3 and 4 non trivial eigenvectors excluding V(:,1) but I don’t know how to do it. Help is greatly appreciated!
Answers (1)
Hi Desiree,
To embed each column of “X” onto the eigenvectors, the approach is to extract out the desired eigenvectors and perform matrix multiplication with them. To achieve this, follow the following steps:
- Exclude the first eigenvector “V(:,1)” using indexing, and then extract next 3 and 4 eigenvectors.
V_non_trivial = V(:, 2:end);
V_first_3 = V_non_trivial(:, 1:3);
V_first_4 = V_non_trivial(:, 1:4);
- Now, project the data by multiplying “X” with the transpose of selected eigenvectors to obtain the embedding.
embedding_3 = V_first_3' * X;
embedding_4 = V_first_4' * X;
This is how we can embed the data points (columns of X) into a lower-dimensional space using the first 3 or 4 non-trivial eigenvectors.
To know more about indexing in MATLAB, refer to the following documentation link:
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!