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;
    }
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
@param k the number of results
to retrieve
@param arr the array to run the search on.
Note that this must be a row vector
@return
@throws Exception