protected double computeNNForRealData(final KNNQuery<NumberVector> knnQuery, Relation<NumberVector> relation, final int dim) {
    double w = 0.;
    ModifiableDBIDs dataSampleIds = DBIDUtil.randomSample(relation.getDBIDs(), sampleSize, random);
    for(DBIDIter iter = dataSampleIds.iter(); iter.valid(); iter.advance()) {
      final double kdist = knnQuery.getKNNForDBID(iter, k + 1).getKNNDistance();
      w += MathUtil.powi(kdist, dim);
    }
    return w;
  }
protected double computeNNForRealData ( final KNNQuery < NumberVector > knnQuery , Relation < NumberVector > relation , final int dim ) { double w = 0. ; ModifiableDBIDs dataSampleIds = DBIDUtil . randomSample ( relation . getDBIDs ( ) , sampleSize , random ) ; for ( DBIDIter iter = dataSampleIds . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { final double kdist = knnQuery . getKNNForDBID ( iter , k + 1 ) . getKNNDistance ( ) ; w += MathUtil . powi ( kdist , dim ) ; } return w ; }
Search nearest neighbors for <em>real</em> data members.

@param knnQuery KNN query
@param relation Data relation
@return Aggregated 1NN distances