protected void computePDists ( Relation < O > relation , KNNQuery < O > knn , WritableDoubleDataStore pdists ) { // computing PRDs FiniteProgress prdsProgress = LOG . isVerbose ( ) ? new FiniteProgress ( "pdists" , relation . size ( ) , LOG ) : null ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { final KNNList neighbors = knn . getKNNForDBID ( iditer , kreach + 1 ) ; // + // query // point // use first kref neighbors as reference set int ks = 0 ; double ssum = 0. ; for ( DoubleDBIDListIter neighbor = neighbors . iter ( ) ; neighbor . valid ( ) && ks < kreach ; neighbor . advance ( ) ) { if ( DBIDUtil . equal ( neighbor , iditer ) ) { continue ; } final double d = neighbor . doubleValue ( ) ; ssum += d * d ; ks ++ ; } double pdist = ks > 0 ? FastMath . sqrt ( ssum / ks ) : 0. ; pdists . putDouble ( iditer , pdist ) ; LOG . incrementProcessed ( prdsProgress ) ; } LOG . ensureCompleted ( prdsProgress ) ; }
Compute the probabilistic distances used by LoOP .