Package elki.math.linearalgebra.pca
Class WeightedCovarianceMatrixBuilder
- java.lang.Object
-
- elki.math.linearalgebra.pca.WeightedCovarianceMatrixBuilder
-
- All Implemented Interfaces:
CovarianceMatrixBuilder
@Title("Weighted Covariance Matrix / PCA") @Description("A PCA modification by using weights while building the covariance matrix, to obtain more stable results") @Reference(authors="Hans-Peter Kriegel, Peer Kr\u00f6ger, Erich Schubert, Arthur Zimek", title="A General Framework for Increasing the Robustness of PCA-based Correlation Clustering Algorithms", booktitle="Proc. 20th Intl. Conf. on Scientific and Statistical Database Management (SSDBM)", url="https://doi.org/10.1007/978-3-540-69497-7_27", bibkey="DBLP:conf/ssdbm/KriegelKSZ08") public class WeightedCovarianceMatrixBuilder extends java.lang.Object implements CovarianceMatrixBuilder
CovarianceMatrixBuilder
with weights.This builder uses a weight function to weight points differently during build a covariance matrix. Covariance can be canonically extended with weights, as shown in the article
Reference:
A General Framework for Increasing the Robustness of PCA-Based Correlation Clustering Algorithms
Hans-Peter Kriegel and Peer Kröger and Erich Schubert and Arthur Zimek
Proc. 20th Int. Conf. on Scientific and Statistical Database Management (SSDBM)- Since:
- 0.2
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WeightedCovarianceMatrixBuilder.Par
Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description private PrimitiveDistance<? super NumberVector>
weightDistance
Holds the distance function used for weight calculation.protected WeightFunction
weightfunction
Holds the weight function.
-
Constructor Summary
Constructors Constructor Description WeightedCovarianceMatrixBuilder(WeightFunction weightfunction)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[][]
processIds(DBIDs ids, Relation<? extends NumberVector> relation)
Weighted Covariance Matrix for a set of IDs.double[][]
processQueryResults(DoubleDBIDList results, Relation<? extends NumberVector> database, int k)
Compute Covariance Matrix for a QueryResult Collection.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.math.linearalgebra.pca.CovarianceMatrixBuilder
processQueryResults, processRelation
-
-
-
-
Field Detail
-
weightfunction
protected WeightFunction weightfunction
Holds the weight function.
-
weightDistance
private PrimitiveDistance<? super NumberVector> weightDistance
Holds the distance function used for weight calculation.
-
-
Constructor Detail
-
WeightedCovarianceMatrixBuilder
public WeightedCovarianceMatrixBuilder(WeightFunction weightfunction)
Constructor.- Parameters:
weightfunction
- Weighting function
-
-
Method Detail
-
processIds
public double[][] processIds(DBIDs ids, Relation<? extends NumberVector> relation)
Weighted Covariance Matrix for a set of IDs. Since we are not supplied any distance information, we'll need to compute it ourselves. Covariance is tied to Euclidean distance, so it probably does not make much sense to add support for other distance functions?- Specified by:
processIds
in interfaceCovarianceMatrixBuilder
- Parameters:
ids
- Database ids to processrelation
- Relation to process- Returns:
- Covariance matrix
-
processQueryResults
public double[][] processQueryResults(DoubleDBIDList results, Relation<? extends NumberVector> database, int k)
Compute Covariance Matrix for a QueryResult Collection. By default it will just collect the ids and run processIds- Specified by:
processQueryResults
in interfaceCovarianceMatrixBuilder
- Parameters:
results
- a collection of QueryResultsdatabase
- the database usedk
- number of elements to process- Returns:
- Covariance Matrix
-
-