Learn R Programming

ganGenerativeData (version 2.1.6)

gdKNearestNeighbors: Search for k nearest neighbors

Description

Search for k nearest neighbors in normalized 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)

Value

A list of denormalized rows in normalized generative data

Arguments

dataRecord

List containing an unnormalized data record

k

Number of nearest neighbors

useSearchTree

Boolean value indicating if a search tree should be used.

Examples

Run this code
if (FALSE) {
gdRead("gd.bin")
gdKNearestNeighbors(list(5.1, 3.5, 1.4, 0.2), 3)}

Run the code above in your browser using DataLab