rp_model: Random Projection Model

Description Usage Arguments Examples

View source: R/string_analysis.R

Description

In mathematics and statistics, random projection is a technique used to reduce the dimensionality of a set of points which lie in Euclidean space. Random projection methods are powerful methods known for their simplicity and less erroneous output compared with other methods. According to experimental results, random projection preserve distances well, but empirical results are sparse. They have been applied to many natural language tasks under the name of random indexing. The core idea behind random projection is given in the Johnson-Lindenstrauss lemma which states that if points in a vector space are of sufficiently high dimension, then they may be projected into a suitable lower-dimensional space in a way which approximately preserves the distances between the points.

Usage

1
2
3
4
5
6
7
rp_model(text, ...)

## S3 method for class 'dtm'
rp_model(text, ...)

## S3 method for class 'corpus'
rp_model(text, ...)

Arguments

text

An object inheriting of class document or corpus.

...

Any other options to pass to the model https://zgornel.github.io/StringAnalysis.jl/dev/examples/#Dimensionality-reduction-1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# Use stringanalysis backend!
init_stringanalysis()

# build document
doc1 <- string_document("First document.")
doc2 <- string_document("Second document.")

crps <- corpus(doc1, doc2)
dtm <- document_term_matrix(crps)
model <- rp_model(dtm)

## End(Not run)

news-r/textanalysis documentation built on Nov. 4, 2019, 9:40 p.m.