LibSVM、Weka 的 .arff 文件中的字符串属性。
String attributes in .arff file for LibSVM, Weka.
我正在尝试在 Weka 中使用 LibSVM。在我的 .arff 数据集中,我有 @attribute attr1 字符串。但是当我检查 LibSVM 功能时,我发现 LibSVM 不支持 String 属性。有什么方法可以将字符串转换为数值,以便我可以将其保存在我的数据集中。
如果真的是字符串(而不是标称值),可以用StringToWordVector
Converts String attributes into a set of attributes representing word occurrence (depending on the tokenizer) information from the text contained in the strings. The set of words (attributes) is determined by the first batch filtered (typically training data).
这实际上取决于您想从字符串中获取什么。如果它不是 "normal" 文本,而是 DNA 序列之类的东西,则您需要完全不同的东西。
我正在尝试在 Weka 中使用 LibSVM。在我的 .arff 数据集中,我有 @attribute attr1 字符串。但是当我检查 LibSVM 功能时,我发现 LibSVM 不支持 String 属性。有什么方法可以将字符串转换为数值,以便我可以将其保存在我的数据集中。
如果真的是字符串(而不是标称值),可以用StringToWordVector
Converts String attributes into a set of attributes representing word occurrence (depending on the tokenizer) information from the text contained in the strings. The set of words (attributes) is determined by the first batch filtered (typically training data).
这实际上取决于您想从字符串中获取什么。如果它不是 "normal" 文本,而是 DNA 序列之类的东西,则您需要完全不同的东西。