protected boolean relevantSubspace ( long [ ] subspace , DoubleDBIDList neigh , KernelDensityEstimator kernel ) { final double crit = K_S_CRITICAL001 / FastMath . sqrt ( neigh . size ( ) - 2 ) ; double [ ] data = new double [ neigh . size ( ) ] ; Relation < ? extends NumberVector > relation = kernel . relation ; for ( int dim = BitsUtil . nextSetBit ( subspace , 0 ) ; dim >= 0 ; dim = BitsUtil . nextSetBit ( subspace , dim + 1 ) ) { // TODO: can/should we save this copy? int count = 0 ; for ( DBIDIter neighbor = neigh . iter ( ) ; neighbor . valid ( ) ; neighbor . advance ( ) ) { data [ count ++ ] = relation . get ( neighbor ) . doubleValue ( dim ) ; } assert ( count == neigh . size ( ) ) ; Arrays . sort ( data ) ; final double min = data [ 0 ] , norm = data [ data . length - 1 ] - min ; // Kolmogorow-Smirnow-Test against uniform distribution: boolean flag = false ; for ( int j = 1 , end = data . length - 1 ; j < end ; j ++ ) { if ( Math . abs ( j / ( data . length - 2. ) - ( data [ j ] - min ) / norm ) > crit ) { flag = true ; break ; } } if ( ! flag ) { return false ; } } return true ; }
Subspace relevance test .