GithubHelp home page GithubHelp logo

Determining eigenvectors about pca_transform HOT 1 CLOSED

mkobos avatar mkobos commented on July 18, 2024
Determining eigenvectors

from pca_transform.

Comments (1)

mkobos avatar mkobos commented on July 18, 2024

First, that's an interesting application of PCA that you have in mind. It seems that you want to apply it in some computer graphics problem. I'm more of a data analysis guy, so this is something new to me.

If I understand correctly, you have a cloud of points in a 3-dimensional space and you want to find a 2-dimensional plane that "fits" them best. In such case, you can compute the eigenvectors and select the first two ones (the vectors are ordered according to importance, i.e. from the ones along which the variance is the largest to the ones along which it is the smallest). These two vectors will span the plane that you're looking for. In order to compute the normal vector of the plane, you need to compute the cross product of these two vector.

Replace the last three lines in your snippet with the lines below to see how this works in practice:

          Vector3d v1 = new Vector3d(vectors[0][0], vectors[1][0], vectors[2][0]);
          Vector3d v2 = new Vector3d(vectors[0][1], vectors[1][1], vectors[2][1]);
          System.out.println("v1="+v1+", v2="+v2);
          Vector3d vCross = new Vector3d();
          vCross.cross(v1, v2);
          System.out.println("cross="+vCross);

The significant part of output produced by this is

v1=(1.0, 0.0, 0.0), v2=(0.0, 0.0, 1.0)
cross=(0.0, -1.0, 0.0)

BTW, the eigenvectors correspond to columns and not rows of the matrix returned by pca.getEigenvectorsMatrix().

I'm assuming the components that aren't useful are being dropped.

Yes, the components along which the variance of the training points is very small are removed.

from pca_transform.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.