Search in sources :

Example 1 with SubspaceModel

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 });
}
Also used : ELKIBuilder(de.lmu.ifi.dbs.elki.utilities.ELKIBuilder) Database(de.lmu.ifi.dbs.elki.database.Database) SubspaceModel(de.lmu.ifi.dbs.elki.data.model.SubspaceModel) DoubleVector(de.lmu.ifi.dbs.elki.data.DoubleVector) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 2 with SubspaceModel

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 });
}
Also used : ELKIBuilder(de.lmu.ifi.dbs.elki.utilities.ELKIBuilder) Database(de.lmu.ifi.dbs.elki.database.Database) SubspaceModel(de.lmu.ifi.dbs.elki.data.model.SubspaceModel) DoubleVector(de.lmu.ifi.dbs.elki.data.DoubleVector) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 3 with SubspaceModel

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 });
}
Also used : ELKIBuilder(de.lmu.ifi.dbs.elki.utilities.ELKIBuilder) Database(de.lmu.ifi.dbs.elki.database.Database) SubspaceModel(de.lmu.ifi.dbs.elki.data.model.SubspaceModel) DoubleVector(de.lmu.ifi.dbs.elki.data.DoubleVector) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 4 with SubspaceModel

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;
}
Also used : NumberVector(de.lmu.ifi.dbs.elki.data.NumberVector) Subspace(de.lmu.ifi.dbs.elki.data.Subspace) SubspaceModel(de.lmu.ifi.dbs.elki.data.model.SubspaceModel)

Example 5 with SubspaceModel

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;
}
Also used : ArrayList(java.util.ArrayList) SubspaceModel(de.lmu.ifi.dbs.elki.data.model.SubspaceModel) Cluster(de.lmu.ifi.dbs.elki.data.Cluster) Comparator(java.util.Comparator) ArrayModifiableDBIDs(de.lmu.ifi.dbs.elki.database.ids.ArrayModifiableDBIDs) Subspace(de.lmu.ifi.dbs.elki.data.Subspace)

Aggregations

SubspaceModel (de.lmu.ifi.dbs.elki.data.model.SubspaceModel)16 Subspace (de.lmu.ifi.dbs.elki.data.Subspace)9 AbstractClusterAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest)7 Database (de.lmu.ifi.dbs.elki.database.Database)7 Test (org.junit.Test)7 Cluster (de.lmu.ifi.dbs.elki.data.Cluster)6 DoubleVector (de.lmu.ifi.dbs.elki.data.DoubleVector)5 ELKIBuilder (de.lmu.ifi.dbs.elki.utilities.ELKIBuilder)5 Clustering (de.lmu.ifi.dbs.elki.data.Clustering)4 ArrayList (java.util.ArrayList)4 ArrayModifiableDBIDs (de.lmu.ifi.dbs.elki.database.ids.ArrayModifiableDBIDs)3 ModifiableDBIDs (de.lmu.ifi.dbs.elki.database.ids.ModifiableDBIDs)3 StepProgress (de.lmu.ifi.dbs.elki.logging.progress.StepProgress)3 NumberVector (de.lmu.ifi.dbs.elki.data.NumberVector)2 IndefiniteProgress (de.lmu.ifi.dbs.elki.logging.progress.IndefiniteProgress)2 Pair (de.lmu.ifi.dbs.elki.utilities.pairs.Pair)2 List (java.util.List)2 AbstractProjectedClustering (de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractProjectedClustering)1 MultivariateGaussianModel (de.lmu.ifi.dbs.elki.algorithm.clustering.em.MultivariateGaussianModel)1 CLIQUESubspace (de.lmu.ifi.dbs.elki.algorithm.clustering.subspace.clique.CLIQUESubspace)1