首页 > 解决方案 > weka中的通过/失败学校成绩二进制分类

问题描述

我正在使用 Weka 进行数据挖掘。我的数据正在考虑学校成绩(0 到 20 之间的数字输出)。我希望通过二进制分类对成绩进行建模(即如果成绩> = 10,则为“通过”,否则为“失败”)。但是当我在 Weka 中使用离散化并进行分箱(通过定义 2 个箱)时,值 = 10 进入较低的箱(失败组)。我希望 values=10 成为上部 bin(通过组)的一部分。我怎么解决这个问题?

标签: classificationwekabinningdiscretization

解决方案


MathExpression 过滤器将起作用。

示例 arff 文件,其中 y 和 y2 刚刚复制,因此我可以将 y2 和 x 转换为另一个属性:

@relation so_2020-04-01

@attribute x numeric
@attribute y numeric
@attribute y2 numeric

@data
0.32789,12,12
0.932754,8,8
0.750824,20,20
0.601161,17,17
0.867985,2,2
0.469246,19,19
0.570984,10,10
0.82686,18,18
0.536315,6,6
0.878526,15,15
0.318298,7,7
0.278011,5,5
0.78302,4,4
0.557255,1,1
0.510926,3,3
0.429421,13,13
0.642457,9,9
0.227804,11,11
0.655531,16,16
0.41444,14,14

设置数学表达式:

在此处输入图像描述

应用后,y2 现在有 1 表示通过,0 表示失败,其中 10 作为切点。

@relation 'so_2020-04-01-weka.filters.unsupervised.attribute.MathExpression-Eifelse(A>10,1,0)-Rfirst,2-unset-class-temporarily'

@attribute x numeric
@attribute y numeric
@attribute y2 numeric

@data
0.32789,12,1
0.932754,8,0
0.750824,20,1
0.601161,17,1
0.867985,2,0
0.469246,19,1
0.570984,10,0
0.82686,18,1
0.536315,6,0
0.878526,15,1
0.318298,7,0
0.278011,5,0
0.78302,4,0
0.557255,1,0
0.510926,3,0
0.429421,13,1
0.642457,9,0
0.227804,11,1
0.655531,16,1
0.41444,14,1

如果您希望类变量是名义变量而不是数字变量,则可以使用 NumericToNominal 过滤器。


推荐阅读