问题:使用库(text2vec)的 R GloVe 环境。使用 rsparse::GloVe$new() 的代码执行设置环境,但是,不使用 GlobalVectors$new() 的代码执行设置环境。
然后运行 wv_main = glove$fit_transform(tcm...),错误:
glove$fit_transform(tcm...) 错误 tcm 是有效的 dgTmaticx,S4 数据类型,暗度为 (545 X 545)
wv_main = glove$fit_transform(tcm, n_iter = 10, convergence_tol = 0.01, n_threads = 8)
cpp_glove_create(glove_params) 中的错误:与请求的类型不兼容:[type=S4; 目标=双]。
在 glove$fit_transform(tcm) 上寻求不兼容请求类型的帮助。
tokens = space_tokenizer(df_sample)
token_iter = itoken(tokens, progressbar = FALSE)
vocab = create_vocabulary(token_iter)
vocab = prune_vocabulary(vocab, term_count_min = 5L)
vectorizer = vocab_vectorizer(vocab)
tcm = create_tcm(token_iter, vectorizer, skip_grams_window = 5L)
glove = GlobalVectors$new(word_vectors_size = 50, x_max = 10)
glove <- rsparse::GloVe$new(tcm, rank = 50, x_max = 10, learning_rate = .25)
wv_main = glove$fit_transform(tcm, n_iter = 10, convergence_tol = 0.01, n_threads = 8)
dput(glove)
<environment>