Multi-label text classification using mlr package in R

自古美人都是妖i 提交于 2019-12-11 12:46:55

问题


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

来源:https://stackoverflow.com/questions/36332849/multi-label-text-classification-using-mlr-package-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!