Package elki.datasource.filter.transform
Class GlobalPrincipalComponentAnalysisTransform<O extends NumberVector>
- java.lang.Object
-
- elki.datasource.filter.AbstractConversionFilter<I,O>
-
- elki.datasource.filter.AbstractVectorConversionFilter<O,O>
-
- elki.datasource.filter.transform.GlobalPrincipalComponentAnalysisTransform<O>
-
- Type Parameters:
O- Vector type
- All Implemented Interfaces:
ObjectFilter
@Alias({"whiten","whitening","pca"}) @Priority(200) public class GlobalPrincipalComponentAnalysisTransform<O extends NumberVector> extends AbstractVectorConversionFilter<O,O>
Apply Principal Component Analysis (PCA) to the data set.This is also popular form of "Whitening transformation", and will project the data to have a unit covariance matrix.
If you want to also reduce dimensionality, set the
-pca.filterparameter! Note that this implementation currently will always perform a full matrix inversion. For very high dimensional data, this can take an excessive amount of time O(d³) and memory O(d²). Please contribute a better implementation to ELKI that only computes the requiried dimensions, yet allows for the same filtering flexibility.TODO: design an API (and implementation) that allows plugging in efficient solvers that do not need to decompose the entire matrix. This may, however, require external dependencies such as jBlas.
- Since:
- 0.5.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGlobalPrincipalComponentAnalysisTransform.ModeTransformation mode.static classGlobalPrincipalComponentAnalysisTransform.Par<O extends NumberVector>Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description (package private) double[]bufProjection buffer.(package private) CovarianceMatrixcovmatCovariance matrix builder.(package private) EigenPairFilterfilterFilter to use for dimensionality reduction.private static LoggingLOGClass logger.(package private) double[]meanVector for data set centering.(package private) GlobalPrincipalComponentAnalysisTransform.ModemodeMode.(package private) double[][]projFinal projection after analysis run.-
Fields inherited from class elki.datasource.filter.AbstractVectorConversionFilter
factory
-
-
Constructor Summary
Constructors Constructor Description GlobalPrincipalComponentAnalysisTransform(EigenPairFilter filter)Constructor.GlobalPrincipalComponentAnalysisTransform(EigenPairFilter filter, GlobalPrincipalComponentAnalysisTransform.Mode mode)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SimpleTypeInformation<? super O>convertedType(SimpleTypeInformation<O> in)Get the output type from the input type after conversion.protected OfilterSingleObject(O obj)Normalize a single instance.protected SimpleTypeInformation<? super O>getInputTypeRestriction()Get the input type restriction used for negotiating the data query.protected LogginggetLogger()Class logger.protected voidprepareComplete()Complete the initialization phase.protected voidprepareProcessInstance(O obj)Process a single object during initialization.protected booleanprepareStart(SimpleTypeInformation<O> in)Return "true" when the normalization needs initialization (two-pass filtering!).-
Methods inherited from class elki.datasource.filter.AbstractVectorConversionFilter
initializeOutputType
-
Methods inherited from class elki.datasource.filter.AbstractConversionFilter
filter, toString
-
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger.
-
filter
EigenPairFilter filter
Filter to use for dimensionality reduction.
-
covmat
CovarianceMatrix covmat
Covariance matrix builder.
-
proj
double[][] proj
Final projection after analysis run.
-
buf
double[] buf
Projection buffer.
-
mean
double[] mean
Vector for data set centering.
-
mode
GlobalPrincipalComponentAnalysisTransform.Mode mode
Mode.
-
-
Constructor Detail
-
GlobalPrincipalComponentAnalysisTransform
public GlobalPrincipalComponentAnalysisTransform(EigenPairFilter filter)
Constructor.- Parameters:
filter- Filter to use for dimensionality reduction.
-
GlobalPrincipalComponentAnalysisTransform
public GlobalPrincipalComponentAnalysisTransform(EigenPairFilter filter, GlobalPrincipalComponentAnalysisTransform.Mode mode)
Constructor.- Parameters:
filter- Filter to use for dimensionality reduction.mode- Mode
-
-
Method Detail
-
prepareStart
protected boolean prepareStart(SimpleTypeInformation<O> in)
Description copied from class:AbstractConversionFilterReturn "true" when the normalization needs initialization (two-pass filtering!).- Overrides:
prepareStartin classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>- Parameters:
in- Input type information- Returns:
- true or false
-
prepareProcessInstance
protected void prepareProcessInstance(O obj)
Description copied from class:AbstractConversionFilterProcess a single object during initialization.- Overrides:
prepareProcessInstancein classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>- Parameters:
obj- Object to process
-
prepareComplete
protected void prepareComplete()
Description copied from class:AbstractConversionFilterComplete the initialization phase.- Overrides:
prepareCompletein classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>
-
filterSingleObject
protected O filterSingleObject(O obj)
Description copied from class:AbstractConversionFilterNormalize a single instance. You can implement this as UnsupportedOperationException if you override both public "normalize" functions!- Specified by:
filterSingleObjectin classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>- Parameters:
obj- Database object to normalize- Returns:
- Normalized database object
-
getInputTypeRestriction
protected SimpleTypeInformation<? super O> getInputTypeRestriction()
Description copied from class:AbstractConversionFilterGet the input type restriction used for negotiating the data query.- Specified by:
getInputTypeRestrictionin classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>- Returns:
- Type restriction
-
convertedType
protected SimpleTypeInformation<? super O> convertedType(SimpleTypeInformation<O> in)
Description copied from class:AbstractConversionFilterGet the output type from the input type after conversion.- Specified by:
convertedTypein classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>- Parameters:
in- input type restriction- Returns:
- output type restriction
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractConversionFilterClass logger.- Specified by:
getLoggerin classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>- Returns:
- Logger
-
-