我正在试图找出WEKA并用我拥有的数据进行一些实验。
基本上我想要做的是采用数据集1,将其用作训练集。在其上运行J48决策树。然后获取数据集2并在其上运行经过训练的树,原始数据集的输出带有一个额外的列,用于预测。
然后用贝叶斯神经网络再次做同样的事情。
有人能指出我的详细说明链接,我将如何完成这项工作?我似乎缺少一些步骤,无法使用额外的列获取原始数据集的输出。
答案 0 :(得分:1)
以下是使用命令行执行此操作的一种方法。此信息可在软件随附的Weka手册的第1章(“命令行入门”)中找到。
java weka.classifiers.trees.J48 -t training_data.arff -T test_data.arff -p 1-N
其中:
-t <training_data.arff> specifies the training data in ARFF format
-T <test_data.arff> specifies the test data in ARFF format
-p 1-N specifies that you want to output the feature vector and the prediction,
where N is the number of features in your feature vector.
例如,我在这里使用soy.arff进行训练和测试。特征向量中有35个特征:
java weka.classifiers.trees.J48 -t soybean.arff -T soybean.arff -p 1-35
输出的前几行看起来像:
=== Predictions on test data ===
inst# actual predicted error prediction (date,plant-stand,precip,temp,hail,crop-hist,area-damaged,severity,seed-tmt,germination,plant-growth,leaves,leafspots-halo,leafspots-marg,leafspot-size,leaf-shread,leaf-malf,leaf-mild,stem,lodging,stem-cankers,canker-lesion,fruiting-bodies,external-decay,mycelium,int-discolor,sclerotia,fruit-pods,fruit-spots,seed,mold-growth,seed-discolor,seed-size,shriveling,roots)
1 1:diaporth 1:diaporth 0.952 (october,normal,gt-norm,norm,yes,same-lst-yr,low-areas,pot-severe,none,90-100,abnorm,abnorm,absent,dna,dna,absent,absent,absent,abnorm,no,above-sec-nde,brown,present,firm-and-dry,absent,none,absent,norm,dna,norm,absent,absent,norm,absent,norm)
2 1:diaporth 1:diaporth 0.952 (august,normal,gt-norm,norm,yes,same-lst-two-yrs,scattered,severe,fungicide,80-89,abnorm,abnorm,absent,dna,dna,absent,absent,absent,abnorm,yes,above-sec-nde,brown,present,firm-and-dry,absent,none,absent,norm,dna,norm,absent,absent,norm,absent,norm)
列是:(1)数据实例编号; (2)地面真相标签; (3)预测标签; (4)错误; (5)预测信心; (6)特征向量。