snn_graph: snn_graph

Description Usage Arguments Details Value Examples

View source: R/generics.R

Description

Creates a k-nearest-neighbor graph from a tf-idf matrix.

Usage

1
2
3
4
5
## S3 method for class 'BOWER'
snn_graph(bower, max_features = 100, remove_stopwords = FALSE, k = 5, ...)

## S3 method for class 'list'
snn_graph(gs, max_features = 100, remove_stopwords = FALSE, k = 5, ...)

Arguments

max_features

use top features sorted by count to be used in bag of words matrix. The default value is set to 100.

remove_stopwords

a list of stopwords to use, by default it uses its inbuilt list of standard stopwords. The default value is FALSE.

k

the maximum number of nearest neighbors to search. The default value is set to 5.

...

passed to superml::TfIdfVectorizer

gs

genesets in list.

Details

Given a list of text, it creates a sparse matrix consisting of tf-idf score for tokens from the text. See https://github.com/saraswatmks/superml/blob/master/R/TfidfVectorizer.R. A k shortest-nearest neighbor graph is then computed using the overlap of of the terms.

Value

Returns a matrix of tf-idf score of tokens.

Examples

1
2
3
4
gmt_file <- system.file("extdata", "h.all.v7.4.symbols.gmt", package = "bowerbird")
bwr <- bower(gmt_file)
bwr <- snn_graph(bwr)
bwr

clatworthylab/bowerbird documentation built on Dec. 19, 2021, 5:15 p.m.