Skip to content

Fix PCA in Dimensionality reduction

Cédric Traizet requested to merge fix_dimensionality_reduction into develop

Summary

Fix bugs in the DimensionalityReduction and add a few functionalities (e.g. output eigenvalues)

See issues #1950 (closed) and #1849

Implementation Details

List of changes:

  • Rescaling step: call SetAutomaticInputMinMaxComputation(false) on the rescaler to avoid computation of the min max on each streaming tile (the global min/max are computed before the rescaling step. This was causing the "stripping" described in #1950 (closed).
  • the rescale was disabled by default, and at it was a ParameterGroup it was not possible to enable it using cli (it was possible to use it in gui by clicking on the parameter box), so it was not possible to use rescaling in cli. "rescale" is now a parameterChoice, with two choices: no and minmax, if the latter is chosen rescaling is performed.
  • when the normalize parameter is set to true, the input data is centered and reduced. In PCA this means that the transformation is defined by the eigenvector of the correlation matrix defined by the element (E[XY]-E[X]E[Y])/(sigmaX*sigmaY), but in the PCAImageFilter E[XY] was used (this is what the StreamingStatisticsVectorImageFilter's GetCorrelation() method output, this is the definition of auto correlation matrix used in signal processing). The code has been modified to use the correct matrix.
  • There is currently two way of using PCA, normalize on and normalize off. With normalize on the data is reduced and centered, and normalize off where the data is not centered nor reduced. However the most common way to use PCA is to use it on centered data (0 mean). By default (normalize off) the data is now centered.
  • new optional parameter method.pca.outeigenvalues (filename) : write the computed eigenvalues in a txt file.
  • new optional parameter method.pca.whiten (bool) : perform whitening on the input data (currently whitening was always performed).

Copyright

The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.


Check before merging:

  • All discussions are resolved
  • At least 2 👍 votes from core developers, no 👎 vote.
  • The feature branch is (reasonably) up-to-date with the base branch
  • Dashboard is green
  • Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
  • Optionally, run git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i on latest changes and commit
Edited by Cédric Traizet

Merge request reports