Description Usage Arguments Value Examples
This function evaluates the performance of a trained model.
1 | evaluate(model_path, X_test, y_test)
|
model_path |
Path to HDF5 file containing model. Should be of the form "models/{model type}_{embedding type}_{embedding dimensionality}d.h5" |
X_test |
data.frame or matrix of vectorized Tweets |
y_test |
Labels for testing data. 0 for liberal, 1 for conservative. |
List of performance metrics. Currently, a confusion matrix, overall prediction accuracy, precision, recall, and F1 score are return.
1 2 3 4 5 6 7 8 9 | data("ideo_tweets")
ideo_tokenizer <- text_tokenizer(num_words=20000)
ideo_tokenizer <- fit_text_tokenizer(ideo_tokenizer, ideo_tweets$text)
texts <- texts_to_vectors(ideo_tweets$text, ideo_tokenizer)
labels <- tweets$ideo_cat
train_test <- train_test_split(texts, labels)
evaluate("models/bi-lstm_w2v_25d.h5", train_test$X_test, train_test$y_test)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.