【问题标题】:Is it possible to merge two different set of dataset which consist of different attributes in weka?是否可以合并由 weka 中不同属性组成的两组不同数据集?
【发布时间】:2018-04-04 14:33:13
【问题描述】:

我是 Weka 的新手。

我想知道,Weka 是否可以对 Weka 中由不同属性组成的 2 组不同的数据库进行分类?

例子:

数据集 A:@attributes {用户 ID、标签、描述} @数据 a,#user,写书

数据集 B : @attributes {UserID, Longitude, Latitude, Dates} @数据 xyz ,7895231, 453221.1, 28.10.2012

是否可以将具有不同属性的数据集 A 和 B 合并到 Weka 中的 1 个数据集中?有人告诉我,我可以在 Weka 对其进行分类之前将其手动合并到 Excel 中,但我正在徘徊 Weka 如何读取数据?是一行一行的吗?输入这些表格(excel)并将值设为0是否合乎逻辑?

数据集 AB:用户 ID、标签、描述、用户 ID、经度、
纬度、日期

         a,  #user, writing books, 0, 0,0
         xyz, 0, 0 , 7895231, 453221.1, 28.10.2012

【问题讨论】:

标签: weka


【解决方案1】:

是的。这篇文章对此进行了介绍: https://list.waikato.ac.nz/pipermail/wekalist/2009-April/043232.html 这也涵盖了您想要追加两个文件(添加实例)的情况。

这是在 Weka 命令行界面 (CLI) 中完成的。 一个技巧是似乎有一个行长限制,所以将你的文件移动到默认目录(这似乎是 Program Files/Weka-3-8),这样你就不会遇到长路径的问题。

假设我们的文件“merge A.arff”由

组成
@relation 'merge A'

@attribute UserID numeric
@attribute A1 {Joe,Bill,Larry}
@attribute A2 numeric
@attribute Aclass {pos,neg}

@data
1,Joe,17,pos
3,Joe,42,neg
5,Bill,8,neg
7,Larry,4,neg

和文件“merge B.arff”组成

@relation 'merge B'

@attribute BUserID numeric
@attribute Blong numeric
@attribute Blat numeric

@data
1,-180,42
3,-182,45
5,-179,36
7,-184,38

如果您打开 CLI 并在 > 提示符后键入以下内容

java weka.core.Instances merge "merge A.arff"  "merge B.arff"

以下内容将转储到控制台:

@relation 'merge A_merge B'

@attribute UserID numeric
@attribute A1 {Joe,Bill,Larry}
@attribute A2 numeric
@attribute Aclass {pos,neg}
@attribute BUserID numeric
@attribute Blong numeric
@attribute Blat numeric

@data
1,Joe,17,pos,1,-180,42
3,Joe,42,neg,3,-182,45
5,Bill,8,neg,5,-179,36
7,Larry,4,neg,7,-184,38

由于某种原因,我无法将其直接传送到另一个文件,例如

 java weka.core.Instances merge "merge A.arff"  "merge B.arff" > "output.arff"

要么它没有创建文件,要么我找不到它在哪里创建它。但一次一个问题!

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-26
  • 2018-11-24
  • 2023-03-04
  • 1970-01-01
  • 1970-01-01
  • 2021-10-23
相关资源
最近更新 更多