public static RPNode query ( RPNode from , RPHyperPlanes planes , INDArray x , String similarityFunction ) { if ( from . getLeft ( ) == null && from . getRight ( ) == null ) { return from ; } INDArray hyperPlane = planes . getHyperPlaneAt ( from . getDepth ( ) ) ; double dist = computeDistance ( similarityFunction , x , hyperPlane ) ; if ( dist <= from . getMedian ( ) ) { return query ( from . getLeft ( ) , planes , x , similarityFunction ) ; } else { return query ( from . getRight ( ) , planes , x , similarityFunction ) ; } }
Query the tree starting from the given node using the given hyper plane and similarity function