2013-06-26 26 views
0

我想弄清楚WEKA並用我擁有的數據進行一些實驗。如何使用WEKA機器學習的貝葉斯神經網絡和J48決策樹

基本上我想要做的就是取數據集1,用它作爲訓練集。在其上運行J48決策樹。然後取數據集2,並在其上運行訓練樹,原始數據集的輸出與預測的額外列進行比較。

然後再次用貝葉斯神經網絡做同樣的事情。

有人可以指示我詳細說明的鏈接,關於如何完成此操作?我似乎錯過了一些步驟,無法使用額外的列獲取原始數據集的輸出。

+0

你如何接受給你的答案? – stackoverflowuser2010

回答

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. 

例如,我在這裏使用訓練和測試soybean.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)特徵向量。