2015年11月3日 星期二

weka.classifiers.functions.VotedPerceptron

weka.classifiers.functions.VotedPerceptron 為投票型感知器,屬錯誤驅動型學習器。
先全域性取代缺值,再轉換文字屬性為二元屬性,適用於預測二元類別值,可線上累進學習。

給定案例屬性 a=(a0, a1, ..., ak),權重向量 w=(w0, w1, ..., wk)
其中,a 屬性值為二元值 0 或 1,擴充屬性 a0 恆為 1。
預測式為
  w0 * a0 + w1 * a1 + ... + wk * ak > 0 表類別1; 否則類別2

學習過程若遇預測錯誤,則權重向量調整法如下:
  類別2誤為類別1:   w -= a  讓權重變小
  類別1誤為類別2:   w += a  讓權重變大

參數說明:
 -I  套用訓練集學習權重的輪數。預設值1
 -E  多項式核函數(polynomial kernel)之次方。預設值1
 -S  亂數種子,影響訓練集的案例訓練順序。預設值1
 -M  最大允許權重修正次數。預設值10000

> java  weka.classifiers.functions.VotedPerceptron  -t data\weather.numeric.arff


VotedPerceptron: Number of perceptrons=5


Time taken to build model: 0 seconds
Time taken to test model on training data: 0 seconds

=== Error on training data ===

Correctly Classified Instances           9               64.2857 %
Incorrectly Classified Instances         5               35.7143 %
Kappa statistic                          0     
Mean absolute error                      0.3623
Root mean squared error                  0.587 
Relative absolute error                 78.0299 %
Root relative squared error            122.4306 %
Total Number of Instances               14     


=== Confusion Matrix ===

 a b   <-- classified as
 9 0 | a = yes
 5 0 | b = no



=== Stratified cross-validation ===

Correctly Classified Instances           9               64.2857 %
Incorrectly Classified Instances         5               35.7143 %
Kappa statistic                          0     
Mean absolute error                      0.3736
Root mean squared error                  0.589 
Relative absolute error                 78.4565 %
Root relative squared error            119.3809 %
Total Number of Instances               14     


=== Confusion Matrix ===

 a b   <-- classified as
 9 0 | a = yes
 5 0 | b = no


如下 weather.numeric.arff 案例集的14個案例利用2個文字屬性及2個數字屬性,預測文字屬性。
outlooktemperaturehumiditywindyplay
sunny8585FALSEno
sunny8090TRUEno
rainy6570TRUEno
sunny7295FALSEno
rainy7191TRUEno
overcast8386FALSEyes
rainy7096FALSEyes
rainy6880FALSEyes
overcast6465TRUEyes
sunny6970FALSEyes
rainy7580FALSEyes
sunny7570TRUEyes
overcast7290TRUEyes
overcast8175FALSEyes
參考: 1.weka.classifiers.functions.VotedPerceptron code | doc

沒有留言: