BNS: BNS

Description Usage Format Details Fields Usage Methods Arguments Examples

Description

Creates BNS (bi-normal separation) model. Defined as: Q(true positive rate) - Q(false positive rate), where Q is a quantile function of normal distribution.

Usage

1

Format

R6Class object.

Details

Bi-Normal Separation

Fields

bns_stat

data.table with computed BNS statistic. Useful for feature selection.

Usage

For usage details see Methods, Arguments and Examples sections.

1
2
3
bns = BNS$new(treshold = 0.0005)
bns$fit_transform(x, y)
bns$transform(x)

Methods

$new(treshold = 0.0005)

Creates bns model

$fit_transform(x, y)

fit model to an input sparse matrix (preferably in "dgCMatrix" format) and then transforms it.

$transform(x)

transform new data x using bns from train data

Arguments

bns

A BNS object

x

An input document term matrix. Preferably in dgCMatrix format

y

Binary target variable coercible to logical.

treshold

Clipping treshold to avoid infinities in quantile function.

Examples

1
2
3
4
5
6
7
data("movie_review")
N = 1000
it = itoken(head(movie_review$review, N), preprocessor = tolower, tokenizer = word_tokenizer)
vocab = create_vocabulary(it)
dtm = create_dtm(it, vocab_vectorizer(vocab))
model_bns = BNS$new()
dtm_bns = model_bns$fit_transform(dtm, head(movie_review$sentiment, N))

dselivanov/text2vec documentation built on Sept. 23, 2018, 1:57 a.m.