public NearestNeighborsResults knnNew ( int k , INDArray arr ) throws Exception { Base64NDArrayBody base64NDArrayBody = Base64NDArrayBody . builder ( ) . k ( k ) . ndarray ( Nd4jBase64 . base64String ( arr ) ) . build ( ) ; HttpRequestWithBody req = Unirest . post ( url + "/knnnew" ) ; req . header ( "accept" , "application/json" ) . header ( "Content-Type" , "application/json" ) . body ( base64NDArrayBody ) ; addAuthHeader ( req ) ; NearestNeighborsResults ret = req . asObject ( NearestNeighborsResults . class ) . getBody ( ) ; return ret ; }
Run a k nearest neighbors search on a NEW data point