Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed eigenvalue discrepancy in PCA/ActiveShapeModel. #114

Merged
merged 6 commits into from Dec 21, 2017

Conversation

@tmgeimer
Copy link
Collaborator

commented Dec 12, 2017

PCA & ActiveShapeModel

Principal components (as the eigenvalues of the covariance matrix) are now correctly set as the square of singular values s_i of the data matrix divided by the number of samples minus 1.

eigenVals[i] = Math.pow(svd.getSingularValues()[i],2)/(this.numSamples-1);

In addition, pc scores are now formulated w.r.t. standard deviation (i.e. square root of eigenvalues) of their corresponding principal component. This was already implicitly the case, as the singular values haven't been squared in the first place.


CONRADCardiacModel

The changed scaling of pc scores impacted the CONRADCardiacModel classes in the packages
edu.stanford.rsl.conrad.phantom.asmheart & edu.stanford.rsl.apps.activeshapemodels.

Changes have been made to accommodate for the fact that weights are now formulated in terms of standard deviation instead of variance.
In addition, naming and file-extensions of the CONRADCardiacModel files have been streamlined to better differentiate between model (.ccm) and score (.ccs) files.


Heart Model Data

The Conrad Cardiac Model files provided at https://www5.cs.fau.de/en/conrad/data/heart-model/ will be updated shortly w.r.t. the above mentioned changes.


Backwards Compatibility

With the new behavior of PCA and ActiveShapeModel, PcaIO files written prior to this change are no longer compatible. Though still readible, the entries will be interpreted incorrectly.

PcaHotfixScript in the edu.stanford.rsl.aps.activeshapemodel package provides an easy way for users to update their ConradCardiacModel model files (.ccm) and score files (.ccs), as well as other PcaIO-written files.

This script updates the old eigenvalues (i.e. singular values) by computing the square and dividing by the number of samples -1.
The scores are updated in a similar fashion by multiplying with the old eigenvalues and dividing by the square root of the new (i.e. scaling with standard deviation).

If you encounter any problems with your existing files, please feel free to contact us.

@jenniferMaier jenniferMaier merged commit ce1148a into akmaier:master Dec 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.