private Cluster<SubspaceModel> runDOC(Database database,Relation<V> relation,ArrayModifiableDBIDs S,final int d,int n,int m,int r,int minClusterSize){
  DBIDs C=null;
  long[] D=null;
  double quality=Double.NEGATIVE_INFINITY;
  SubspaceMaximumDistanceFunction df=new SubspaceMaximumDistanceFunction(BitsUtil.zero(d));
  DistanceQuery<V> dq=database.getDistanceQuery(relation,df);
  RangeQuery<V> rq=database.getRangeQuery(dq);
  FiniteProgress iprogress=LOG.isVerbose() ? new FiniteProgress("Iteration progress for current cluster",m * n,LOG) : null;
  Random random=rnd.getSingleThreadedRandom();
  DBIDArrayIter iter=S.iter();
  for (int i=0; i < n; ++i) {
    iter.seek(random.nextInt(S.size()));
    for (int j=0; j < m; ++j) {
      DBIDs randomSet=DBIDUtil.randomSample(S,r,random);
      long[] nD=BitsUtil.zero(d);
      for (int k=0; k < d; ++k) {
        if (dimensionIsRelevant(k,relation,randomSet)) {
          BitsUtil.setI(nD,k);
        }
      }
      if (BitsUtil.cardinality(nD) > 0) {
        df.setSelectedDimensions(nD);
        DBIDs nC=DBIDUtil.intersection(S,rq.getRangeForDBID(iter,w));
        if (LOG.isDebuggingFiner()) {
          LOG.finer("Testing a cluster candidate, |C| = " + nC.size() + ", |D| = "+ BitsUtil.cardinality(nD));
        }
        if (nC.size() < minClusterSize) {
          if (LOG.isDebuggingFiner()) {
            LOG.finer("... but it's too small.");
          }
        }
 else {
          double nQuality=computeClusterQuality(nC.size(),BitsUtil.cardinality(nD));
          if (nQuality > quality) {
            if (LOG.isDebuggingFiner()) {
              LOG.finer("... and it's the best so far: " + nQuality + " vs. "+ quality);
            }
            C=nC;
            D=nD;
            quality=nQuality;
          }
 else {
            if (LOG.isDebuggingFiner()) {
              LOG.finer("... but we already have a better one.");
            }
          }
        }
      }
      LOG.incrementProcessed(iprogress);
    }
  }
  LOG.ensureCompleted(iprogress);
  return (C != null) ? makeCluster(relation,C,D) : null;
}

private Cluster < SubspaceModel > runDOC ( Database database , Relation < V > relation , ArrayModifiableDBIDs S , final int d , int n , int m , int r , int minClusterSize ) { DBIDs C = null ; long [ ] D = null ; double quality = Double . NEGATIVE_INFINITY ; SubspaceMaximumDistanceFunction df = new SubspaceMaximumDistanceFunction ( BitsUtil . zero ( d ) ) ; DistanceQuery < V > dq = database . getDistanceQuery ( relation , df ) ; RangeQuery < V > rq = database . getRangeQuery ( dq ) ; FiniteProgress iprogress = LOG . isVerbose ( ) ? new FiniteProgress ( "Iteration progress for current cluster" , m * n , LOG ) : null ; Random random = rnd . getSingleThreadedRandom ( ) ; DBIDArrayIter iter = S . iter ( ) ; for ( int i = 0 ; i < n ; ++ i ) { iter . seek ( random . nextInt ( S . size ( ) ) ) ; for ( int j = 0 ; j < m ; ++ j ) { DBIDs randomSet = DBIDUtil . randomSample ( S , r , random ) ; long [ ] nD = BitsUtil . zero ( d ) ; for ( int k = 0 ; k < d ; ++ k ) { if ( dimensionIsRelevant ( k , relation , randomSet ) ) { BitsUtil . setI ( nD , k ) ; } } if ( BitsUtil . cardinality ( nD ) > 0 ) { df . setSelectedDimensions ( nD ) ; DBIDs nC = DBIDUtil . intersection ( S , rq . getRangeForDBID ( iter , w ) ) ; if ( LOG . isDebuggingFiner ( ) ) { LOG . finer ( "Testing a cluster candidate, |C| = " + nC . size ( ) + ", |D| = " + BitsUtil . cardinality ( nD ) ) ; } if ( nC . size ( ) < minClusterSize ) { if ( LOG . isDebuggingFiner ( ) ) { LOG . finer ( "... but it's too small." ) ; } } else { double nQuality = computeClusterQuality ( nC . size ( ) , BitsUtil . cardinality ( nD ) ) ; if ( nQuality > quality ) { if ( LOG . isDebuggingFiner ( ) ) { LOG . finer ( "... and it's the best so far: " + nQuality + " vs. " + quality ) ; } C = nC ; D = nD ; quality = nQuality ; } else { if ( LOG . isDebuggingFiner ( ) ) { LOG . finer ( "... but we already have a better one." ) ; } } } } LOG . incrementProcessed ( iprogress ) ; } } LOG . ensureCompleted ( iprogress ) ; return ( C != null ) ? makeCluster ( relation , C , D ) : null ; }
performs a single run of doc , finding a single cluster .
