k_nearest_neighbour: K Nearest Neighbour Classification

View source: R/stats.R

k_nearest_neighbourR Documentation

K Nearest Neighbour Classification

Description

Preform k-nearest-neighbour classification from a similarity matrix and a list classifying the columns into groups.

Usage

k_nearest_neighbour(x, group_definitions, k = 5, exclude_self_sharing = T)

Arguments

x

matrix. The input similarity matrix.

group_definitions

tibble. A tibble with two columns that specifies the name of each column in the input matrix and the grouping it belongs to.

k

integer. The number of nearest neighbours to use for classification.

exclude_self_sharing

logical. Should self sharing be excluded? If so, the highest sharing in each row is ignored (assumed to be self-sharing).

Value

Tibble. A tibble containing the assigned group of the k nearest neighbours as well as the accuracy of the knn at assigning the correct grouping based on the similarity scores for each row in the input matrix.


TCLamnidis/TCLHelperRPackage documentation built on Aug. 27, 2022, 12:42 a.m.