是否可以使用数字属性作为K-means聚类的类?

时间:2017-01-14 03:02:42

标签: classification cluster-analysis weka data-mining

@attribute CustomerID       NUMERIC
@attribute Age              {A,B,C,D,E,F,G,H,I,J,K}
@attribute Region           {A,B,C,D,E,F,G,H}
@attribute ProductSubClass  NUMERIC
@attribute ProductID        NUMERIC 
@attribute Quantity         NUMERIC
@attribute Cost             NUMERIC
@attribute sales            NUMERIC

@data
00141833,F,F,130207,4710105011011,2,44,52
01376753,E,E,110217,4710265849066,1,150,129
01603071,E,G,100201,4712019100607,1,35,39
01738667,E,F,530105,4710168702901,1,94,119

上面是标题和一个trianing数据集training.arff文件的protion 我想使用Kmeans集群和J48分类器,我可以毫无问题地完成它。和流动是我的测试数据集test.arff

@attribute CustomerID       NUMERIC
@attribute Age              {A,B,C,D,E,F,G,H,I,J,K}
@attribute Region           {A,B,C,D,E,F,G,H}
@attribute ProductSubClass  NUMERIC
@attribute ProductID        INTEGER
@attribute Quantity         NUMERIC
@attribute Cost             NUMERIC
@attribute sales            NUMERIC

@data
1754698,H,A,560402,?,1,676,849
1027365,F,C,530404,?,1,170,219
956710,E,E,500303,?,1,36,59

在这两种情况下,我都确保将ProductID选为Class

这是我做的步骤

Setp1: assigning "AddCluster" to use K-means clusterig for each instance in the dataset 
step2: and then using J48 classificaion algorithm to evaluate the performance of the clustering algorithms using 10-fold cross validation option 
Step3: save Finalized Model and close weka (I am closing to test if I can relode and use it agian)
Step4:Load the Model in weaka (Useing "Load Model")
step5: This time I am selecting "supplied test set"  and select test file to predict (which is same formate as I mentioned in the questien above)
step6: I am trying "Re-evaluate model on  current test set" 

但是在这里我得到了一个通知"用于训练模式测试集的数据不兼容。你想自动包装分类器吗? 在继续之前的" inputMappedClassifier?""如果我点击"否"它显示"火车和测试装置不兼容... 5!= 6"如果"是"它 在plainText:

中给出以下输出
=== Predictions on user test set ===

    inst#     actual  predicted error prediction
        1          ?      0              ? 
        2          ?      0              ? 
        3          ?      0              ? 
        4          ?      0              ? 
        5          ?      0              ? 
        6          ?      0              ? 
        7          ?      0              ? 
        8          ?      0              ? 
        9          ?      0              ? 
       10          ?      0              ? 
       11          ?      0              ? 
       12          ?      0              ? 
       13          ?      0              ? 
       14          ?      0              ? 
       15          ?      0              ? 
       16          ?      1              ? 
       17          ?      0              ? 
       18          ?      0              ? 
       19          ?      0              ? 
       20          ?      0              ? 
       21          ?      0              ? 

现在 1.是否可以将数字字段ProductID用作类,因为我必须根据考虑其他属性的ProductID预测客户对产品的选择。

  1. 如果是,我遇到了另一个问题火车和测试装置不兼容这个错误是否与选择数字属性有关?
  2. 注意:我使用的是Weka 3.8.1 GUI

1 个答案:

答案 0 :(得分:0)

可能,您的测试数据集缺少K-Means集群操作可能添加到训练集的集群ID(您是否告诉Weka这样做?),但是没有添加到测试数据集。

除此之外,K-Means的重点是将其用于聚类而不是用于分类。

坦率地说,你正在应用不正确的东西,不给我们读者足够的信息(J48?),并在这里询问(至少)两个问题。