protected DoubleDataStore computeIDOS ( DBIDs ids , KNNQuery < O > knnQ , DoubleDataStore intDims , DoubleMinMax idosminmax ) { WritableDoubleDataStore ldms = DataStoreUtil . makeDoubleStorage ( ids , DataStoreFactory . HINT_STATIC ) ; FiniteProgress prog = LOG . isVerbose ( ) ? new FiniteProgress ( "ID Outlier Scores for objects" , ids . size ( ) , LOG ) : null ; for ( DBIDIter iter = ids . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { final KNNList neighbors = knnQ . getKNNForDBID ( iter , k_r ) ; double sum = 0. ; int cnt = 0 ; for ( DoubleDBIDListIter neighbor = neighbors . iter ( ) ; neighbor . valid ( ) ; neighbor . advance ( ) ) { if ( DBIDUtil . equal ( iter , neighbor ) ) { continue ; } final double id = intDims . doubleValue ( neighbor ) ; sum += id > 0 ? 1.0 / id : 0. ; if ( ++ cnt == k_r ) { // Always stop after at most k_r elements. break ; } } final double id_q = intDims . doubleValue ( iter ) ; final double idos = id_q > 0 ? id_q * sum / cnt : 0. ; ldms . putDouble ( iter , idos ) ; idosminmax . put ( idos ) ; LOG . incrementProcessed ( prog ) ; } LOG . ensureCompleted ( prog ) ; return ldms ; }
Computes all IDOS scores .