2

Can someone share a code snippet that shows how to use SVM for text mining using scikit. I have seen an example of SVM on numerical data but not quite sure how to deal with text. I looked at http://scikit-learn.org/stable/auto_examples/document_classification_20newsgroups.html but couldn't find SVM.

4

1 回答 1

1

在文本挖掘问题中,文本由数值表示。每个特征代表一个单词,值是二进制数。这给出了一个包含很多零和几个 1 的矩阵,这意味着相应的单词存在于文本中。单词可以根据它们的频率或其他标准赋予一些权重。然后你得到一些实数而不是 0 和 1。

将数据集转换为数值后,您可以使用以下示例:http ://scikit-learn.org/dev/modules/generated/sklearn.svm.SVC.html#sklearn.svm.SVC

于 2013-05-10T10:33:50.620 回答