protected static VectorApproximation calculatePartialApproximation ( DBID id , NumberVector dv , List < DoubleObjPair < DAFile > > daFiles ) { int [ ] approximation = new int [ dv . getDimensionality ( ) ] ; for ( int i = 0 ; i < daFiles . size ( ) ; i ++ ) { double val = dv . doubleValue ( i ) ; double [ ] borders = daFiles . get ( i ) . second . getSplitPositions ( ) ; assert borders != null : "borders are null" ; int lastBorderIndex = borders . length - 1 ; // value is lower outlier if ( val < borders [ 0 ] ) { approximation [ i ] = 0 ; } // value is upper outlier else if ( val > borders [ lastBorderIndex ] ) { approximation [ i ] = lastBorderIndex - 1 ; } // normal case else { for ( int s = 0 ; s < lastBorderIndex ; s ++ ) { if ( val >= borders [ s ] && val < borders [ s + 1 ] && approximation [ i ] != - 1 ) { approximation [ i ] = s ; } } } } return new VectorApproximation ( id , approximation ) ; }
Calculate partial vector approximation .