# NOT RUN {
library(fastrtext)
model_file <- build_supervised(documents = train_sentences[["text"]],
targets =train_sentences[["class.text"]],
model_path = 'my_model',
dim = 20, lr = 1, epoch = 20, wordNgrams = 2)
model <- load_model(model_file)
predictions <- predict(model, test_sentences[["text"]])
mean(sapply(predictions, names) == test_sentences[["class.text"]])
# ~0.8
# }
Run the code above in your browser using DataLab