如何根据n-gram对数据进行分类

时间:2017-06-07 13:12:27

标签: python machine-learning scikit-learn text-classification n-gram

我有以下数据集,其中包含恶意软件类别及其对应的API调用.API调用列包含一串字。基于这些字符串,我需要一个分类器,以便能够相应地对每个类别进行分类。 这是数据集样本

self.previous_changes

我已设法通过以下代码使用贝叶斯天真分类器

Class   APIcall
virus   LdrGetDllHandle,LdrGetProcedureAddress,LdrGetDllHandle,NtCreateSection,….
trojan  NtOpenFile,NtCreateSection,NtClose,LdrLoadDll,……….
worm    LdrLoadDll,LdrGetProcedureAddress,LdrGetProcedureAddress,LdrGetProcedureAddress…

似乎有用。 但我需要的是首先生成n-gram,例如每个API调用4,5克,这样分类可以基于n-gram进行分类,而不仅仅是API调用。 非常感谢您的帮助。 谢谢

0 个答案:

没有答案
相关问题