selfKNN: Self KNN

Description Usage Arguments Value Examples

View source: R/selfKNN.r

Description

This function performs the k-Nearest Neighbour algorithm without class estimation, but only computation of distances and neighbours.

Usage

1
selfKNN(train, K = 1)

Arguments

train

numeric matrix or data frame.

K

number of neighbours considered.

Value

The function returns a list with the following components:

D

matrix of squared root of the distances between observations and their nearest neighbours.

idx

Index of K nearest neighbours of each observation.

Examples

1
2
3
x<-matrix(runif(10),ncol=2)
plot(x,pch=c("1","2","3","4","5"))
selfKNN(x,K=4)

uHMM documentation built on May 2, 2019, 9:16 a.m.