summaryrefslogtreecommitdiff
path: root/src/de/lmu/ifi/dbs/elki/algorithm/DependencyDerivator.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/algorithm/DependencyDerivator.java')
-rw-r--r--src/de/lmu/ifi/dbs/elki/algorithm/DependencyDerivator.java26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/algorithm/DependencyDerivator.java b/src/de/lmu/ifi/dbs/elki/algorithm/DependencyDerivator.java
index dca3649e..ee43ecf4 100644
--- a/src/de/lmu/ifi/dbs/elki/algorithm/DependencyDerivator.java
+++ b/src/de/lmu/ifi/dbs/elki/algorithm/DependencyDerivator.java
@@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.algorithm;
This file is part of ELKI:
Environment for Developing KDD-Applications Supported by Index-Structures
- Copyright (C) 2013
+ Copyright (C) 2014
Ludwig-Maximilians-Universität München
Lehr- und Forschungseinheit für Datenbanksysteme
ELKI Development Team
@@ -33,11 +33,10 @@ import de.lmu.ifi.dbs.elki.data.type.TypeUtil;
import de.lmu.ifi.dbs.elki.database.Database;
import de.lmu.ifi.dbs.elki.database.ids.DBIDUtil;
import de.lmu.ifi.dbs.elki.database.ids.DBIDs;
-import de.lmu.ifi.dbs.elki.database.ids.distance.KNNList;
+import de.lmu.ifi.dbs.elki.database.ids.KNNList;
import de.lmu.ifi.dbs.elki.database.query.distance.DistanceQuery;
import de.lmu.ifi.dbs.elki.database.relation.Relation;
import de.lmu.ifi.dbs.elki.distance.distancefunction.PrimitiveDistanceFunction;
-import de.lmu.ifi.dbs.elki.distance.distancevalue.Distance;
import de.lmu.ifi.dbs.elki.logging.Logging;
import de.lmu.ifi.dbs.elki.math.linearalgebra.Centroid;
import de.lmu.ifi.dbs.elki.math.linearalgebra.LinearEquationSystem;
@@ -72,12 +71,11 @@ import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.IntParameter;
*
* @author Arthur Zimek
* @param <V> the type of FeatureVector handled by this Algorithm
- * @param <D> the type of Distance used by this Algorithm
*/
@Title("Dependency Derivator: Deriving numerical inter-dependencies on data")
@Description("Derives an equality-system describing dependencies between attributes in a correlation-cluster")
@Reference(authors = "E. Achtert, C. Böhm, H.-P. Kriegel, P. Kröger, A. Zimek", title = "Deriving Quantitative Dependencies for Correlation Clusters", booktitle = "Proc. 12th Int. Conf. on Knowledge Discovery and Data Mining (KDD '06), Philadelphia, PA 2006.", url = "http://dx.doi.org/10.1145/1150402.1150408")
-public class DependencyDerivator<V extends NumberVector<?>, D extends Distance<D>> extends AbstractPrimitiveDistanceBasedAlgorithm<V, D, CorrelationAnalysisSolution<V>> {
+public class DependencyDerivator<V extends NumberVector> extends AbstractPrimitiveDistanceBasedAlgorithm<V, CorrelationAnalysisSolution<V>> {
/**
* The logger for this class.
*/
@@ -112,7 +110,7 @@ public class DependencyDerivator<V extends NumberVector<?>, D extends Distance<D
/**
* Holds the object performing the pca.
*/
- private final PCAFilteredRunner<V> pca;
+ private final PCAFilteredRunner pca;
/**
* Number format for output of solution.
@@ -133,7 +131,7 @@ public class DependencyDerivator<V extends NumberVector<?>, D extends Distance<D
* @param sampleSize sample size
* @param randomsample flag for random sampling
*/
- public DependencyDerivator(PrimitiveDistanceFunction<V, D> distanceFunction, NumberFormat nf, PCAFilteredRunner<V> pca, int sampleSize, boolean randomsample) {
+ public DependencyDerivator(PrimitiveDistanceFunction<V> distanceFunction, NumberFormat nf, PCAFilteredRunner pca, int sampleSize, boolean randomsample) {
super(distanceFunction);
this.nf = nf;
this.pca = pca;
@@ -162,8 +160,8 @@ public class DependencyDerivator<V extends NumberVector<?>, D extends Distance<D
ids = DBIDUtil.randomSample(relation.getDBIDs(), this.sampleSize, 1L);
}
else {
- DistanceQuery<V, D> distanceQuery = database.getDistanceQuery(relation, getDistanceFunction());
- KNNList<D> queryResults = database.getKNNQuery(distanceQuery, this.sampleSize).getKNNForObject(centroidDV, this.sampleSize);
+ DistanceQuery<V> distanceQuery = database.getDistanceQuery(relation, getDistanceFunction());
+ KNNList queryResults = database.getKNNQuery(distanceQuery, this.sampleSize).getKNNForObject(centroidDV, this.sampleSize);
ids = DBIDUtil.newHashSet(queryResults);
}
}
@@ -221,7 +219,7 @@ public class DependencyDerivator<V extends NumberVector<?>, D extends Distance<D
log.append("Transposed weak Eigenvectors:\n");
log.append(FormatUtil.format(transposedWeakEigenvectors, nf)).append('\n');
log.append("Eigenvalues:\n");
- log.append(FormatUtil.format(pcares.getEigenvalues(), " , ", 2));
+ log.append(FormatUtil.format(pcares.getEigenvalues(), ", ", nf));
LOG.debugFine(log.toString());
}
Vector b = transposedWeakEigenvectors.times(centroid);
@@ -279,7 +277,7 @@ public class DependencyDerivator<V extends NumberVector<?>, D extends Distance<D
*
* @apiviz.exclude
*/
- public static class Parameterizer<V extends NumberVector<?>, D extends Distance<D>> extends AbstractPrimitiveDistanceBasedAlgorithm.Parameterizer<V, D> {
+ public static class Parameterizer<V extends NumberVector> extends AbstractPrimitiveDistanceBasedAlgorithm.Parameterizer<V> {
/**
* Output accuracy.
*/
@@ -298,7 +296,7 @@ public class DependencyDerivator<V extends NumberVector<?>, D extends Distance<D
/**
* Class to compute PCA with
*/
- protected PCAFilteredRunner<V> pca = null;
+ protected PCAFilteredRunner pca = null;
@Override
protected void makeOptions(Parameterization config) {
@@ -321,12 +319,12 @@ public class DependencyDerivator<V extends NumberVector<?>, D extends Distance<D
if(config.grab(randomSampleF)) {
randomSample = randomSampleF.getValue();
}
- Class<PCAFilteredRunner<V>> cls = ClassGenericsUtil.uglyCastIntoSubclass(PCAFilteredRunner.class);
+ Class<PCAFilteredRunner> cls = ClassGenericsUtil.uglyCastIntoSubclass(PCAFilteredRunner.class);
pca = config.tryInstantiate(cls);
}
@Override
- protected DependencyDerivator<V, D> makeInstance() {
+ protected DependencyDerivator<V> makeInstance() {
NumberFormat nf = NumberFormat.getInstance(Locale.US);
nf.setMaximumFractionDigits(outputAccuracy);
nf.setMinimumFractionDigits(outputAccuracy);