use of de.lmu.ifi.dbs.elki.data.model.SubspaceModel in project elki by elki-project.
the class CLIQUETest method testCLIQUEResults.
/**
* Run CLIQUE with fixed parameters and compare the result to a golden
* standard.
*/
@Test
public void testCLIQUEResults() {
Database db = makeSimpleDatabase(UNITTEST + "subspace-simple.csv", 600);
Clustering<SubspaceModel> result = //
new ELKIBuilder<CLIQUE<DoubleVector>>(CLIQUE.class).with(CLIQUE.Parameterizer.TAU_ID, //
"0.1").with(CLIQUE.Parameterizer.XSI_ID, //
20).build().run(db);
// PairCounting is not appropriate here: overlapping clusterings!
// testFMeasure(db, result, 0.9882);
testClusterSizes(result, new int[] { 200, 200, 216, 400 });
}
use of de.lmu.ifi.dbs.elki.data.model.SubspaceModel in project elki by elki-project.
the class SUBCLUTest method testSUBCLUResults.
/**
* Run SUBCLU with fixed parameters and compare the result to a golden
* standard.
*/
@Test
public void testSUBCLUResults() {
Database db = makeSimpleDatabase(UNITTEST + "subspace-simple.csv", 600);
Clustering<SubspaceModel> result = //
new ELKIBuilder<SUBCLU<DoubleVector>>(SUBCLU.class).with(SUBCLU.EPSILON_ID, //
0.001).with(SUBCLU.MINPTS_ID, //
100).build().run(db);
// PairCounting is not appropriate here: overlapping clusterings!
// testFMeasure(db, result, 0.9090);
testClusterSizes(result, new int[] { 191, 194, 395 });
}
use of de.lmu.ifi.dbs.elki.data.model.SubspaceModel in project elki by elki-project.
the class SUBCLUTest method testSUBCLUSubspaceOverlapping.
/**
* Run SUBCLU with fixed parameters and compare the result to a golden
* standard.
*/
@Test
public void testSUBCLUSubspaceOverlapping() {
Database db = makeSimpleDatabase(UNITTEST + "subspace-overlapping-3-4d.ascii", 850);
Clustering<SubspaceModel> result = //
new ELKIBuilder<SUBCLU<DoubleVector>>(SUBCLU.class).with(SUBCLU.EPSILON_ID, //
0.04).with(SUBCLU.MINPTS_ID, //
70).build().run(db);
// PairCounting is not appropriate here: overlapping clusterings!
// testFMeasure(db, result, 0.49279033);
testClusterSizes(result, new int[] { 99, 247, 303, 323, 437, 459 });
}
use of de.lmu.ifi.dbs.elki.data.model.SubspaceModel in project elki by elki-project.
the class DiSH method isParent.
/**
* Returns true, if the specified parent cluster is a parent of one child of
* the children clusters.
*
* @param relation the database containing the objects
* @param parent the parent to be tested
* @param iter the list of children to be tested
* @param db_dim Database dimensionality
* @return true, if the specified parent cluster is a parent of one child of
* the children clusters, false otherwise
*/
private boolean isParent(Relation<V> relation, Cluster<SubspaceModel> parent, It<Cluster<SubspaceModel>> iter, int db_dim) {
Subspace s_p = parent.getModel().getSubspace();
NumberVector parent_centroid = ProjectedCentroid.make(s_p.getDimensions(), relation, parent.getIDs());
int subspaceDim_parent = db_dim - s_p.dimensionality();
for (; iter.valid(); iter.advance()) {
Cluster<SubspaceModel> child = iter.get();
Subspace s_c = child.getModel().getSubspace();
NumberVector child_centroid = ProjectedCentroid.make(s_c.getDimensions(), relation, child.getIDs());
long[] commonPreferenceVector = BitsUtil.andCMin(s_p.getDimensions(), s_c.getDimensions());
int subspaceDim = subspaceDimensionality(parent_centroid, child_centroid, s_p.getDimensions(), s_c.getDimensions(), commonPreferenceVector);
if (subspaceDim == subspaceDim_parent) {
return true;
}
}
return false;
}
use of de.lmu.ifi.dbs.elki.data.model.SubspaceModel in project elki by elki-project.
the class DiSH method sortClusters.
/**
* Returns a sorted list of the clusters w.r.t. the subspace dimensionality in
* descending order.
*
* @param relation the database storing the objects
* @param clustersMap the mapping of bits sets to clusters
* @return a sorted list of the clusters
*/
private List<Cluster<SubspaceModel>> sortClusters(Relation<V> relation, Object2ObjectMap<long[], List<ArrayModifiableDBIDs>> clustersMap) {
final int db_dim = RelationUtil.dimensionality(relation);
// int num = 1;
List<Cluster<SubspaceModel>> clusters = new ArrayList<>();
for (long[] pv : clustersMap.keySet()) {
List<ArrayModifiableDBIDs> parallelClusters = clustersMap.get(pv);
for (int i = 0; i < parallelClusters.size(); i++) {
ArrayModifiableDBIDs c = parallelClusters.get(i);
Cluster<SubspaceModel> cluster = new Cluster<>(c);
cluster.setModel(new SubspaceModel(new Subspace(pv), Centroid.make(relation, c).getArrayRef()));
String subspace = BitsUtil.toStringLow(cluster.getModel().getSubspace().getDimensions(), db_dim);
if (parallelClusters.size() > 1) {
cluster.setName("Cluster_" + subspace + "_" + i);
} else {
cluster.setName("Cluster_" + subspace);
}
clusters.add(cluster);
}
}
// sort the clusters w.r.t. lambda
Comparator<Cluster<SubspaceModel>> comparator = new Comparator<Cluster<SubspaceModel>>() {
@Override
public int compare(Cluster<SubspaceModel> c1, Cluster<SubspaceModel> c2) {
return c2.getModel().getSubspace().dimensionality() - c1.getModel().getSubspace().dimensionality();
}
};
Collections.sort(clusters, comparator);
return clusters;
}
Aggregations