I was running RTextTools package to build a text classification model.
And when I prepare the prediction dataset and tried to transform it in to matrix. I got error as:
Error in if (attr(weighting, "Acronym") == "tf-idf") weight <- 1e-09 :
argument is of length zero
My code is as below:
table<-read.csv("traintest.csv",header = TRUE)
dtMatrix <- create_matrix(table["COMMENTS"])
container <- create_container(dtMatrix,
table$LIKELIHOOD_TO_RECOMMEND,
trainSize=1:5000,testSize=5001:10000,
virgin=FALSE)
model <- train_model(container, "SVM", kernel="linear", cost=1)
predictionData<-read.csv("rest.csv",header = TRUE)
**predMatrix <- create_matrix(predictionData["COMMENTS"],originalMatrix=dtMatrix)**
Error in if (attr(weighting, "Acronym") == "tf-idf") weight <- 1e-09 :
argument is of length zero
The error was given by the last code (bold) I tried search on google but didn't see one clear solution.
Thanks
Run this:
trace("create_matrix",edit=T)
In the source code box that pops up, line 42 will have a misspelling of the word "acronym". Change the "A" to an "a" and hit "Save" - it should work fine after that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With