R/4_4_textPlotWordPrediction.R
textWordPrediction.Rd
Compute predictions based on single words for plotting words. The word embeddings of single words are trained to predict the mean value associated with that word. P-values does NOT work yet (experimental).
textWordPrediction(
words,
word_types_embeddings = word_types_embeddings_df,
x,
y = NULL,
seed = 1003,
case_insensitive = TRUE,
text_remove = "[()]",
...
)
Word or text variable to be plotted.
Word embeddings from textEmbed for individual words (i.e., decontextualized embeddings).
Numeric variable that the words should be plotted according to on the x-axes.
Numeric variable that the words should be plotted according to on the y-axes (y=NULL).
Set different seed.
When TRUE all words are made lower case.
Remove special characters
Training options from textTrainRegression().
A dataframe with variables (e.g., including trained (out of sample) predictions, frequencies, p-values) for the individual words that is used for the plotting in the textProjectionPlot function.
# Data
# Pre-processing data for plotting
if (FALSE) { # \dontrun{
df_for_plotting <- textWordPrediction(
words = Language_based_assessment_data_8$harmonywords,
word_types_embeddings = word_embeddings_4$word_types,
x = Language_based_assessment_data_8$hilstotal
)
df_for_plotting
} # }
#' @seealso see \code{\link{textProjection}}