kNNGTweak: Tweak format of a 'k'-nearest-neighbour graph object

Description Usage Arguments

View source: R/00_Wrappers.R

Description

Changes format of a k-nearest-neighbour graph (k-NNG) object produced by SingleBench. You will typically want to use this inside WrapTool to change the format of a pre-computed k-NNG object for use with a projection or clustering tool. To only keep the Indices slot of knn (only keeping a single matrix instead of a list of two matrices), set parameter only_indices to TRUE. To modify the Indices slot of knn to use zero-indexing, set parameter zero_index to TRUE. To include the zero-th neighbour (self) for each point in knn, set parameter zeroth_neighbour to TRUE. If you want to limit the number of neighbours (to a value smaller than the original k), specify the new value using parameter new_k.

Usage

1
2
3
4
5
6
7
kNNGTweak(
  knn,
  only_indices = TRUE,
  zero_index = TRUE,
  zeroth_neighbours = TRUE,
  new_k = NULL
)

Arguments

knn

list: knn object created either directly via ComputekNNMatrix or by including a k-NNG generation step in a benchmark pipeline and evaluating it

only_indices

logical value: whether to only keep indices of nearest neighbours, discarding the distance matrix. Default value is TRUE

zero_index

logical value: whether to use zero indexing for nearest-neighbour indices. Default value is TRUE

zeroth_neighbours

logical value: whether to include the zero-th neighbour to each point (self). Default value is TRUE

new_k

optional integer value: new k for k-NN. Default value is NULL


davnovak/SingleBench documentation built on Dec. 19, 2021, 9:10 p.m.