for(Cluster<Model> clus : copacResult.getAllClusters()) {
DBIDs group = clus.getIDs();
if(clus.getModel() != null && clus.getModel() instanceof DimensionModel) {
int correlationDimension = ((DimensionModel) clus.getModel()).getDimension();
ListParameterization parameters = pcaParameters(correlationDimension);
Class<PCAFilteredRunner<V>> cls = ClassGenericsUtil.uglyCastIntoSubclass(PCAFilteredRunner.class);
PCAFilteredRunner<V> pca = parameters.tryInstantiate(cls);
for(ParameterException e : parameters.getErrors()) {
logger.warning("Error in internal parameterization: " + e.getMessage());
}
// get cluster list for this dimension.
List<Cluster<CorrelationModel<V>>> correlationClusters = clusterMap.get(correlationDimension);
if(correlationClusters == null) {
correlationClusters = new ArrayList<Cluster<CorrelationModel<V>>>();
clusterMap.put(correlationDimension, correlationClusters);
}
PCAFilteredResult pcares = pca.processIds(group, database);
V centroid = DatabaseUtil.centroid(database, group);
Cluster<CorrelationModel<V>> correlationCluster = new Cluster<CorrelationModel<V>>("[" + correlationDimension + "_" + correlationClusters.size() + "]", group, new CorrelationModel<V>(pcares, centroid), new ArrayList<Cluster<CorrelationModel<V>>>(), new ArrayList<Cluster<CorrelationModel<V>>>());
correlationClusters.add(correlationCluster);
}
// partition containing noise
else if(clus.getModel() != null && clus.isNoise()) {
if(noise == null) {
noise = clus;
}
else {
ModifiableDBIDs merged = DBIDUtil.newHashSet(noise.getIDs());
merged.addAll(clus.getIDs().asCollection());
noise.setIDs(merged);
}
}
else {
throw new IllegalStateException("Unexpected group returned: " + clus.getClass().getName());
}
}
if(noise != null && noise.size() > 0) {
// get cluster list for this dimension.
List<Cluster<CorrelationModel<V>>> correlationClusters = clusterMap.get(dimensionality);
if(correlationClusters == null) {
correlationClusters = new ArrayList<Cluster<CorrelationModel<V>>>();
clusterMap.put(dimensionality, correlationClusters);
}
ListParameterization parameters = pcaParameters(dimensionality);
Class<PCAFilteredRunner<V>> cls = ClassGenericsUtil.uglyCastIntoSubclass(PCAFilteredRunner.class);
PCAFilteredRunner<V> pca = parameters.tryInstantiate(cls);
for(ParameterException e : parameters.getErrors()) {
logger.warning("Error in internal parameterization: " + e.getMessage());
}
PCAFilteredResult pcares = pca.processIds(noise.getIDs(), database);
V centroid = DatabaseUtil.centroid(database, noise.getIDs());