View source: R/embed-all-the-things.R
starspace_load_model | R Documentation |
Load a Starspace model
starspace_load_model(
object,
method = c("ruimtehol", "tsv-data.table", "binary"),
...
)
object |
the path to a Starspace model on disk |
method |
character indicating the method of loading. Possible values are 'ruimtehol', 'binary' and 'tsv-data.table'. Defaults to 'ruimtehol'.
|
... |
further arguments passed on to |
an object of class textspace
starspace_save_model
data(dekamer, package = "ruimtehol")
dekamer$text <- strsplit(dekamer$question, "\\W")
dekamer$text <- lapply(dekamer$text, FUN = function(x) x[x != ""])
dekamer$text <- sapply(dekamer$text,
FUN = function(x) paste(x, collapse = " "))
dekamer$target <- as.factor(dekamer$question_theme_main)
codes <- data.frame(code = seq_along(levels(dekamer$target)),
label = levels(dekamer$target), stringsAsFactors = FALSE)
dekamer$target <- as.integer(dekamer$target)
set.seed(123456789)
model <- embed_tagspace(x = dekamer$text,
y = dekamer$target,
early_stopping = 0.8,
dim = 10, minCount = 5)
starspace_save_model(model, file = "textspace.ruimtehol", method = "ruimtehol",
labels = codes)
model <- starspace_load_model("textspace.ruimtehol", method = "ruimtehol")
## clean up for cran
file.remove("textspace.ruimtehol")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.