View source: R/matrixFunctions.R
distend | R Documentation |
This is an experimental function that might be useful sometimes. 'Reject' flatly eliminates a particular dimension from a vectorspace, essentially squashing out a single dimension; 'distend' gives finer grained control, making it possible to stretch out or compress in the same space. High values of 'multiplier' make a given vector more prominent; 1 keeps the original matrix untransformed; values less than one compress distances along the vector; and 0 is the same as "reject," eliminating a vector entirely. Values less than zero will do some type of mirror-image universe thing, but probably aren't useful?
distend(matrix, vector, multiplier)
matrix |
A matrix or VectorSpaceModel |
vector |
A vector (or an object coercable to a vector, see project) of the same length as the VectorSpaceModel. |
multiplier |
A scaling factor. See below. |
A new matrix or VectorSpaceModel of the same dimensions as 'matrix', distended along the vector 'vector' by factor 'multiplier'.
See 'project' for more details and usage.
closest_to(demo_vectors,"sweet") # Stretch out the vectorspace 4x longer along the gender direction. more_sexist = distend(demo_vectors, ~ "man" + "he" - "she" -"woman", 4) closest_to(more_sexist,"sweet")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.