为此,您可以使用
text
-包裹
# Create word embedding representations of your text
help(textEmbed)
reviews_embeddings <- textEmbed(movie_df,
model = "bert-base-uncased", # Select model you want from huggingface
layers = 11:12) # Select which layers you want to use
# Train the word embeddings to the numeric variable using ridge regression
reviews_rating_model <- textTrain(reviews_embeddings$movie_reviews,
movie_df$movie_ratings)
# See the results
reviews_rating_model
后果
$results
Pearson's product-moment correlation
data: predy_y$predictions and predy_y$y
t = 5.621, df = 7, p-value = 0.0003991
alternative hypothesis: true correlation is greater than 0
95 percent confidence interval:
0.6785761 1.0000000
sample estimates:
cor
0.9047823