Using the mlr package, I have developed a task using word frequency data to categorize tweets into two categories (TRUE and FALSE). Now I am using this task to classify out-of-sample tweets. Sorry, I cannot share my data, but I will show my code here:
task = makeClassifTask(data = train, target = "category") mod = train("classif.randomForest", task) newdata.pred = predict(mod, newdata = outofsample) newdata.pred
My output is shown here:
Prediction: 17981 observations predict.type: response threshold: time: 0.29 ... (#rows: 17981, #cols: 1)
And as a dataframe:
response <fctr> 1 TRUE 2 FALSE 3 FALSE 4 FALSE 5 FALSE 6 FALSE
I now want to use my categorization to remove any tweets falling in the "FALSE" category. But if I have 17981 tweets, why do I only see 6 observations? I cannot find anything wrong with the "train" dataframe or "outofsample" dataframe (they both have the appropriate number of observations and are listed as dataframes in the global environment, but I did notice that the object "task" creates a list of 6. Is this just a coincidence? How do I retrieve the classification for all of my tweets? And how do I link this information to the out of sample dataset to delete tweets by ID number, if this classification method does not include ID number?
Please don't judge me too harshly, I'm very new to machine learning and R in general. Any advice would be a big help.