interactive_embedding_exploration: Interactive exploration of embeddings

Description Usage Arguments Details Examples

Description

Shiny application to interactively play with embeddings. User provides a pivot word and the n most similar word are projected on a scatter plot.

Usage

1
2
interactive_embedding_exploration(annoy_model, default_number_neighbors = 100,
  default_number_rounds = 500, default_perplexity = 30)

Arguments

annoy_model

RcppAnnoy model generated with get_annoy_model

default_number_neighbors

set the number of neighbors slider to this value

default_number_rounds

set the number of T-SNE rounds slider to this value

default_perplexity

set the T-SNE perplexity slider to this value

Details

For large list of texts, the auto-complete can be slow.

Increasing the number of neighbors can make things very slow, in particular with T-SNE approach. 500 neighbors is usually a good value to have an understanding of the neighborhood of a vector.

Colors in the scatter plot represents clusters found by dbscan.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
if(interactive()){
# This example should be run with a higher quality model
# than the one embedded in fastrtext

library(projector)
library(fastrtext)

model_test_path <- system.file("extdata",
                               "model_unsupervised_test.bin",
                               package = "fastrtext")

model <- load_model(model_test_path)
word_embeddings <- get_word_vectors(model, words = head(get_dictionary(model), 2e5))
annoy_model <- get_annoy_model(word_embeddings, 5)

interactive_embedding_exploration(annoy_model)
}

projector documentation built on May 2, 2019, 3:42 a.m.