Additional Vector Utilities
project_points_onto_line.Rd
Additional Vector Utilities
Details
project_points_onto_line
calculated the projections of a group of points onto
a line defined by two end points. It is useful for graphing the positions of
embeddings with respect to an anchored vector.
Examples
emotion_words <- c("happy", "sad", "scared", "angry", "anxious", "grateful")
emotion_embeddings <- predict(glove_twitter_25d, emotion_words)
#> Warning: 1 items in `newdata` are not present in the embeddings object.
emotion_embeddings_2d <- reduce_dimensionality(emotion_embeddings, 2)
# project points
happy_vec_2d <- predict(emotion_embeddings_2d, "happy")
sad_vec_2d <- predict(emotion_embeddings_2d, "sad")
emotional_projections <- emotion_embeddings_2d |>
project_points_onto_line(happy_vec_2d, sad_vec_2d)