private int clusterProcessedInstance(Instance instance,boolean updateErrors,boolean useFastDistCalc,long[] instanceCanopies){
  double minDist=Integer.MAX_VALUE;
  int bestCluster=0;
  for (int i=0; i < m_NumClusters; i++) {
    double dist;
    if (useFastDistCalc) {
      if (m_speedUpDistanceCompWithCanopies && instanceCanopies != null && instanceCanopies.length > 0) {
        try {
          if (!Canopy.nonEmptyCanopySetIntersection(m_centroidCanopyAssignments.get(i),instanceCanopies)) {
            continue;
          }
        }
 catch (        Exception ex) {
          ex.printStackTrace();
        }
        dist=m_DistanceFunction.distance(instance,m_ClusterCentroids.instance(i),minDist);
      }
 else {
        dist=m_DistanceFunction.distance(instance,m_ClusterCentroids.instance(i),minDist);
      }
    }
 else {
      dist=m_DistanceFunction.distance(instance,m_ClusterCentroids.instance(i));
    }
    if (dist < minDist) {
      minDist=dist;
      bestCluster=i;
    }
  }
  if (updateErrors) {
    if (m_DistanceFunction instanceof EuclideanDistance) {
      minDist*=minDist * instance.weight();
    }
    m_squaredErrors[bestCluster]+=minDist;
  }
  return bestCluster;
}

private int clusterProcessedInstance ( Instance instance , boolean updateErrors , boolean useFastDistCalc , long [ ] instanceCanopies ) { double minDist = Integer . MAX_VALUE ; int bestCluster = 0 ; for ( int i = 0 ; i < m_NumClusters ; i ++ ) { double dist ; if ( useFastDistCalc ) { if ( m_speedUpDistanceCompWithCanopies && instanceCanopies != null && instanceCanopies . length > 0 ) { try { if ( ! Canopy . nonEmptyCanopySetIntersection ( m_centroidCanopyAssignments . get ( i ) , instanceCanopies ) ) { continue ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; } dist = m_DistanceFunction . distance ( instance , m_ClusterCentroids . instance ( i ) , minDist ) ; } else { dist = m_DistanceFunction . distance ( instance , m_ClusterCentroids . instance ( i ) , minDist ) ; } } else { dist = m_DistanceFunction . distance ( instance , m_ClusterCentroids . instance ( i ) ) ; } if ( dist < minDist ) { minDist = dist ; bestCluster = i ; } } if ( updateErrors ) { if ( m_DistanceFunction instanceof EuclideanDistance ) { minDist *= minDist * instance . weight ( ) ; } m_squaredErrors [ bestCluster ] += minDist ; } return bestCluster ; }
clusters an instance that has been through the filters .
