我正在按照本教程进行操作,就像我做训练集一样,但它一直在说同样的事情。有人知道这有什么问题吗?
> #Construct sample document-term matrix con el vectorizer inicial
> sample.it <- itoken(rawsample$Abstract,
+ preprocessor = prep_fun,
+ tokenizer = tok_fun,
+ ids = rawsample$id,
+ progressbar = F)
> sample.dtm <- create_dtm (sample.it, vectorizer, vtype = "dgTMatrix", progressbar = FALSE)
> sample.tfidf <- TfIdf$new() #define tfidf model
> sample.tfidf <- fit_transform(sample.dtm, tfidf)
Error in fit_transform.Matrix(sample.dtm, tfidf) :
inherits(model, "mlapiTransformation") is not TRUE
> sample.tfidf = create_dtm(sample.it, vectorizer, vtype = "dgTMatrix", progressbar = FALSE) %>%
+ transform(tfidf)
Error in transform.Matrix(., tfidf) :
inherits(model, "mlapiTransformation") is not TRUE