most_correlated: Calculate the words most correlated with an input word.

Description Usage Arguments Value References Examples

View source: R/top_relations.R

Description

The correlation coefficient between vectors x and y is calculated using

cor(x,y) = cov(x,y) / sqrt( var(x) * var(y) )

In this function, this formula is applied between x all other word vectors in matrix m, and the resulting correlation coefficients are sorted and returned in the form of a data table.

Usage

1
most_correlated(m, word, num_results = 10)

Arguments

m

A matrix.

word

An entry in m.

num_results

Number of results to display.

Value

A data table of words in m most correlated with x.

References

“Displaying and Summarizing Data.” Introduction to Bayesian Statistics, by William M. Bolstad, 2nd ed., Wiley, 2007, pp. 29–54.

Examples

1
most_correlated(W, "loue")

ajfabry/Statspeare documentation built on Jan. 26, 2020, 7:44 a.m.