Java SVD with JAMA or else -



Java SVD with JAMA or else -

i have cloud of points , need best fitting line. i'm using jama don't know why, not working. it's me doesn't how works. have nx3 matrix (this jama svd supports) , right matrix v svd. vector need right singular vector (row or coloumn ? ) corresponding greatest singular value. vector supposed represent main direction.

every vector supposed have y greatest positive value, x can both positive or negative , z supposed negative. vector has negative y value, or anyway it's pointing in wrong direction.

my cloud of points pretty regular, postioned along y axis (with z little , negative). main direction supposed easy find. it's still not working properly.

in case i'm getting row vector (i tried coloumn vector too) of right matrix v. substracted centroid "pointset".

public static matrix bestdirection(matrix pointset){ matrix bestfittingline = new matrix(3,1); singularvaluedecomposition svd = pointset.svd(); bestfittingline.set(0, 0, svd.getv().get(0, 0)); bestfittingline.set(1, 0, svd.getv().get(0, 1)); bestfittingline.set(2, 0, svd.getv().get(0, 2)); homecoming bestfittingline; }

i guess maybe i'm not considering something. idk maybe should utilize technique or library.

from wikipedia on svd:

non-degenerate singular values have unique left , right singular vectors, multiplication unit phase factor (for real case up sign).

simply put, can't rely on sign of output singular vectors.

you may need center info before svd.

why won't perform regression?

java svd jama

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -