Multi-label text classification using mlr package

2019-07-27 11:19发布

问题:

I need to train a model which would perform multilabel multiclass classification on text data.

I am presently trying to do the same using mlr package in R , following the directions in this link -

Multilabel Classification (using mlr R package)

1) Is there any other package recommended?

2) Otherwise, I am stuck at this place (as instructed in the article mentioned above)

classify <-  getTaskData(dtmDf) ## dtmDf is my dtm converted to dataframe   form

'classify' is NULL

Any help/ directions would be appreciated.

Thanks.

Updates:- Trying to create the 'task' object . Code as below-

dtm <- DocumentTermMatrix(docs) 
mat <- as.matrix(dtm)
mat <- cbind(mat,data$Label)

dtmDf <- as.data.frame(mat)
target <- unique(dtmDf[,2628]) %>% as.character() %>% sort()

classify.task = makeMultilabelTask(id = "classif", data = dtmDf, target =target)

Face the following error -

Error in makeSupervisedTask("multilabel", data, target, weights, blocking) : Column names of data doesn't contain target var: 10

SOLVED

I was able to train it after getting the input data frame in the required format , similar to the yeast data in the tutorial link, which was given as input to the makeMultilabelTask() function