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.filter
parameter! 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 class
GlobalPrincipalComponentAnalysisTransform.Mode
Transformation mode.static class
GlobalPrincipalComponentAnalysisTransform.Par<O extends NumberVector>
Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description (package private) double[]
buf
Projection buffer.(package private) CovarianceMatrix
covmat
Covariance matrix builder.(package private) EigenPairFilter
filter
Filter to use for dimensionality reduction.private static Logging
LOG
Class logger.(package private) double[]
mean
Vector for data set centering.(package private) GlobalPrincipalComponentAnalysisTransform.Mode
mode
Mode.(package private) double[][]
proj
Final 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 O
filterSingleObject(O obj)
Normalize a single instance.protected SimpleTypeInformation<? super O>
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.protected Logging
getLogger()
Class logger.protected void
prepareComplete()
Complete the initialization phase.protected void
prepareProcessInstance(O obj)
Process a single object during initialization.protected boolean
prepareStart(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:AbstractConversionFilter
Return "true" when the normalization needs initialization (two-pass filtering!).- Overrides:
prepareStart
in 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:AbstractConversionFilter
Process a single object during initialization.- Overrides:
prepareProcessInstance
in classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>
- Parameters:
obj
- Object to process
-
prepareComplete
protected void prepareComplete()
Description copied from class:AbstractConversionFilter
Complete the initialization phase.- Overrides:
prepareComplete
in classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>
-
filterSingleObject
protected O filterSingleObject(O obj)
Description copied from class:AbstractConversionFilter
Normalize a single instance. You can implement this as UnsupportedOperationException if you override both public "normalize" functions!- Specified by:
filterSingleObject
in 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:AbstractConversionFilter
Get the input type restriction used for negotiating the data query.- Specified by:
getInputTypeRestriction
in classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>
- Returns:
- Type restriction
-
convertedType
protected SimpleTypeInformation<? super O> convertedType(SimpleTypeInformation<O> in)
Description copied from class:AbstractConversionFilter
Get the output type from the input type after conversion.- Specified by:
convertedType
in classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>
- Parameters:
in
- input type restriction- Returns:
- output type restriction
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractConversionFilter
Class logger.- Specified by:
getLogger
in classAbstractConversionFilter<O extends NumberVector,O extends NumberVector>
- Returns:
- Logger
-
-