Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.math.linearalgebra.pca
Class PCARunner<V extends RealVector<V,?>,D extends NumberDistance<D,?>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
          extended by de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PCARunner<V,D>
Type Parameters:
V -
All Implemented Interfaces:
Parameterizable
Direct Known Subclasses:
PCAFilteredRunner

public class PCARunner<V extends RealVector<V,?>,D extends NumberDistance<D,?>>
extends AbstractParameterizable

Class to run PCA on given data. The various methods will start PCA at different places (e.g. with database IDs, database query results, a precomputed covariance matrix or eigenvalue decomposition). The runner can be parametrized by setting a covariance matrix builder (e.g. to a weighted covariance matrix builder)

Author:
Erich Schubert

Field Summary
private  ClassParameter<CovarianceMatrixBuilder<V,D>> COVARIANCE_PARAM
          Parameter to specify the class to compute the covariance matrix. must be a subclass of CovarianceMatrixBuilder.
protected  CovarianceMatrixBuilder<V,D> covarianceMatrixBuilder
          The covariance computation class.
static OptionID PCA_COVARIANCE_MATRIX
          OptionID for COVARIANCE_PARAM
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
optionHandler
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug, logger
 
Constructor Summary
PCARunner()
          Constructor for the covariance runner.
 
Method Summary
 CovarianceMatrixBuilder<V,D> getCovarianceMatrixBuilder()
          Get covariance matrix builder
 PCAResult processCovarMatrix(Matrix covarMatrix)
          Process an existing covariance Matrix
 PCAResult processDatabase(Database<V> database)
          Run PCA on the complete database
 PCAResult processEVD(EigenvalueDecomposition evd)
          Process an existing eigenvalue decomposition
 PCAResult processIds(Collection<Integer> ids, Database<V> database)
          Run PCA on a collection of database IDs
 PCAResult processQueryResult(Collection<DistanceResultPair<D>> results, Database<V> database)
          Run PCA on a QueryResult Collection
 void setCovarianceMatrixBuilder(CovarianceMatrixBuilder<V,D> covarianceBuilder)
          Set covariance matrix builder.
 List<String> setParameters(List<String> args)
          Parameter handling.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
addOption, addParameterizable, addParameterizable, checkGlobalParameterConstraints, collectOptions, getAttributeSettings, getParameters, rememberParametersExcept, removeOption, removeParameterizable, shortDescription
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, progress, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PCA_COVARIANCE_MATRIX

public static final OptionID PCA_COVARIANCE_MATRIX
OptionID for COVARIANCE_PARAM


COVARIANCE_PARAM

private ClassParameter<CovarianceMatrixBuilder<V extends RealVector<V,?>,D extends NumberDistance<D,?>>> COVARIANCE_PARAM
Parameter to specify the class to compute the covariance matrix. must be a subclass of CovarianceMatrixBuilder.

Default value: CovarianceMatrixBuilder

Key: -pca.covariance


covarianceMatrixBuilder

protected CovarianceMatrixBuilder<V extends RealVector<V,?>,D extends NumberDistance<D,?>> covarianceMatrixBuilder
The covariance computation class.

Constructor Detail

PCARunner

public PCARunner()
Constructor for the covariance runner.

Method Detail

setParameters

public List<String> setParameters(List<String> args)
                           throws ParameterException
Parameter handling.

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class AbstractParameterizable
Parameters:
args - parameters to set the attributes accordingly to
Returns:
a list containing the unused parameters
Throws:
ParameterException - in case of wrong parameter-setting

processDatabase

public PCAResult processDatabase(Database<V> database)
Run PCA on the complete database

Parameters:
database - the database used
Returns:
PCA result

processIds

public PCAResult processIds(Collection<Integer> ids,
                            Database<V> database)
Run PCA on a collection of database IDs

Parameters:
ids - a collection of ids
database - the database used
Returns:
PCA result

processQueryResult

public PCAResult processQueryResult(Collection<DistanceResultPair<D>> results,
                                    Database<V> database)
Run PCA on a QueryResult Collection

Parameters:
results - a collection of QueryResults
database - the database used
Returns:
PCA result

processCovarMatrix

public PCAResult processCovarMatrix(Matrix covarMatrix)
Process an existing covariance Matrix

Parameters:
covarMatrix - the matrix used for performing pca
Returns:
PCA result

processEVD

public PCAResult processEVD(EigenvalueDecomposition evd)
Process an existing eigenvalue decomposition

Parameters:
evd - eigenvalue decomposition to use
Returns:
PCA result

getCovarianceMatrixBuilder

public CovarianceMatrixBuilder<V,D> getCovarianceMatrixBuilder()
Get covariance matrix builder

Returns:
covariance matrix builder in use

setCovarianceMatrixBuilder

public void setCovarianceMatrixBuilder(CovarianceMatrixBuilder<V,D> covarianceBuilder)
Set covariance matrix builder.

Parameters:
covarianceBuilder - New covariance matrix builder.

Release 0.2 (2009-07-06_1820)