gdKNearestNeighbors: Search for k nearest neighbors

View source: R/RcppExports.R

gdKNearestNeighborsR Documentation

Search for k nearest neighbors

Description

Search for k nearest neighbors in generative data for a data record. When the data record contains NA values only the non-NA values are considered in search. By default a linear search is performed. When a search tree is used search is performed on a tree which is built once in the first function call. Building a tree is also triggered when NA values in data records change in subsequent function calls.

Usage

gdKNearestNeighbors(dataRecord, k = 1L, useSearchTree = FALSE)

Arguments

dataRecord

List containing a data record

k

Number of nearest neighbors

useSearchTree

Boolean value indicating if a search tree should be used.

Value

A list of rows in generative data

Examples

## Not run: 
gdRead("gd.bin")
gdKNearestNeighbors(list(5.1, 3.5, 1.4, 0.2), 3)
## End(Not run)

ganGenerativeData documentation built on Nov. 19, 2023, 5:12 p.m.