protected ApproximationLine progressiveKnnDistanceApproximation ( int k_max ) { if ( ! isLeaf ( ) ) { throw new UnsupportedOperationException ( "Progressive KNN-distance approximation " + "is only vailable in leaf nodes!" ) ; } // determine k_0, y_1, y_kmax int k_0 = 0 ; double y_1 = Double . POSITIVE_INFINITY ; double y_kmax = Double . POSITIVE_INFINITY ; for ( int i = 0 ; i < getNumEntries ( ) ; i ++ ) { MkCoPLeafEntry entry = ( MkCoPLeafEntry ) getEntry ( i ) ; ApproximationLine approx = entry . getProgressiveKnnDistanceApproximation ( ) ; k_0 = Math . max ( approx . getK_0 ( ) , k_0 ) ; } for ( int i = 0 ; i < getNumEntries ( ) ; i ++ ) { MkCoPLeafEntry entry = ( MkCoPLeafEntry ) getEntry ( i ) ; ApproximationLine approx = entry . getProgressiveKnnDistanceApproximation ( ) ; y_1 = Math . min ( approx . getValueAt ( k_0 ) , y_1 ) ; y_kmax = Math . min ( approx . getValueAt ( k_max ) , y_kmax ) ; } // determine m and t double m = ( y_kmax - y_1 ) / ( FastMath . log ( k_max ) - FastMath . log ( k_0 ) ) ; double t = y_1 - m * FastMath . log ( k_0 ) ; return new ApproximationLine ( k_0 , m , t ) ; }
Determines and returns the progressive approximation for the knn distances of this node as the maximum of the progressive approximations of all entries .