Shapeworks: PCA Python API

Created on 23 Feb 2021  ·  7Comments  ·  Source: SCIInstitute/ShapeWorks

Need python API support for performing all PCA operations for correspondence model currently present in Studio.
The API should calculate the following:

  1. Eigenvalues
  2. Eigenvectors
  3. PCA Loading
  4. PCA Component Scores / Variance

All these quantities should be saved as numpy arrays.

Feature Request

Most helpful comment

Studio uses the ParticleShapeStatistics class:

https://github.com/SCIInstitute/ShapeWorks/blob/master/Libs/Particles/ParticleShapeStatistics.h

In general, my recommendation is to use a single library for both. This keeps results and behavior consistent across tools. I worry that having multiple implementations is a step backward into a disjoint set of tools that we've been trying to consolidate over time.

FYI, there are some different plans for the future of statistical analysis including using R.

All 7 comments

Related to #995

@akenmorris: Currently, which library does Studio use to perform the principal component analysis?
@sheryjoe Should we use the same library for the API or use python libraries like sklearn to perform the PCA analysis?
If we want to use python libraries, following the same suite of ShapeCohortGenPackage/DataAugmentationsPackage I can start working on PCAPackage in the python library.

Studio uses the ParticleShapeStatistics class:

https://github.com/SCIInstitute/ShapeWorks/blob/master/Libs/Particles/ParticleShapeStatistics.h

In general, my recommendation is to use a single library for both. This keeps results and behavior consistent across tools. I worry that having multiple implementations is a step backward into a disjoint set of tools that we've been trying to consolidate over time.

FYI, there are some different plans for the future of statistical analysis including using R.

Are we planning on creating a pybind wrapper of ParticleShapeStatistics?

Are we planning on creating a pybind wrapper of ParticleShapeStatistics?

Yes, as part of the shapeworks python library.

830 #1172

It’ll be 1000x easier to get this feature out by simply exporting Eigen::Matrix that already has all these functions.

Was this page helpful?
0 / 5 - 0 ratings