0

Hi have a matrix A containing 132 elements of 3 features each

A= rand(132,3);

I compute the distance between each element

B=pdist(A);

and I put it in a squared distance matrix

C = squareform(B);

I compute the eigenvectors of the matrix

[V,D] = eig(C);

Now I would like to map a new element in the same space of eigenvectors V.

% I take the first element of A, but I assume it is a new one
new_element = A(1,:);

I calculate the distance with all the other elements of A

D1=pdist2(A(1,:),A);

now I can add this row to the C matrix obtaining

 C2 = squareform([D1,B])

What I would like to do now is: given the eigenvector space V previously calculated. can I approximate the new row of C (i.e the first row of C2) in the same space (i.e. using the eigenvectors of C)?

Not sure what I say makes sense...I am just trying to make a new classifier, but I miss the last passage because I cannot recalculate the eigenvectors (calculated using the training set)

gabboshow
  • 5,359
  • 12
  • 48
  • 98
  • I'm quite stuck on your maths, your choice of operations seems a bit arbitrary to me. Could you explain what you're trying to do, what `new_element_proj` should mean and why you believe that it should equal `V(1,:)`? – Andras Deak -- Слава Україні Feb 06 '16 at 15:23
  • Hi Andras, I m very sorry. I made a mistake...could you have a look at the question now? – gabboshow Feb 06 '16 at 15:33
  • I'm afraid I still don't understand, but it seems that I'm unqualified for your problem. If my suspicion is correct that this is related to image-processing or machine-learning or something similar, consider adding the relevant tags to attract interested users. – Andras Deak -- Слава Україні Feb 06 '16 at 15:42
  • it is an algebra/geometry problem... I want to project the last row of C2 in the eigenvector space V (if it is allowed).. – gabboshow Feb 06 '16 at 15:44
  • And are you sure you're interested in the *last* row of `C2`? In your code the *first* row is new compared to `C`, not the last one. Furthermore: your comment `% I take the first element of A, but I assume it is a new one` makes little sense to me. Is this always the case? Are you always adding the distances from *the first original point*? – Andras Deak -- Слава Україні Feb 06 '16 at 15:48
  • you are right again: it is the first row of C2 in this case. regarding your second remark: usually is a new point, but in this case I am taking equal to the first element so I can compare the results. I am expecting to be similar to the first row of V. – gabboshow Feb 06 '16 at 15:52
  • OK, I still don't get it. If this is indeed a purely geometrical problem, you might want to consider asking at math.SE, they might be of more help there. Just leave out the unnecessary `pdist` stuff: they probably just need to know what your matrix is like. – Andras Deak -- Слава Україні Feb 06 '16 at 16:11

0 Answers0