I am using weka 3.7.13 ADTree classifier. I wrote a parser to convert the output tree to if-then rules. Even though the if-then rules match the visualization tree the confusion matrix differs. Here is the ADTree generated:
: -0.248
| (1)M_L < 6.5: 0.284
| | (2)Fav = 0: -0.114
| | | (4)M_L < 4.25: 0.117
| | | | (7)M_L < 0.15: -0.695
| | | | (7)M_L >= 0.15: 0.013
| | | (4)M_L >= 4.25: -0.125
| | (2)Fav = 1: 0.359
| | (8)M_L < 2.2: 0.181
| | (8)M_L >= 2.2: -0.036
| (1)M_L >= 6.5: -0.38
| | (3)M_L < 15.5: 0.102
| | | (6)M_L < 8.5: 0.153
| | | (6)M_L >= 8.5: -0.059
| | (3)M_L >= 15.5: -0.381
| | | (9)M_L < 20.5: 0.111
| | | (9)M_L >= 20.5: -0.267
| (5)AvgSpd < 46.5: -0.129
| (5)AvgSpd >= 46.5: 0.036
| (10)Horse = 1A: -0.409
| (10)Horse != 1A: 0.004
And this is the if-then routine
Function test(ByRef p) ' E:\Horses\ADTree10 03-20-17.txt
Dim t
t = -0.248
If p("M_L") < 6.5 Then
t = t + 0.284
If p("Fav") = 0 Then
t = t - 0.114
If p("M_L") < 4.25 Then
t = t + 0.117
If p("M_L") < 0.15 Then
t = t - 0.695
End If ' p("M_L") < 0.15
If p("M_L") >= 0.15 Then
t = t + 0.013
End If ' p("M_L") >= 0.15
End If ' p("M_L") < 4.25
If p("M_L") >= 4.25 Then
t = t - 0.125
End If ' p("M_L") >= 4.25
End If ' p("Fav") = 0
If p("Fav") = 1 Then
t = t + 0.359
End If ' p("Fav") = 1
If p("M_L") < 2.2 Then
t = t + 0.181
End If ' p("M_L") < 2.2
If p("M_L") >= 2.2 Then
t = t - 0.036
End If ' p("M_L") >= 2.2
End If ' p("M_L") < 6.5
If p("M_L") >= 6.5 Then
t = t - 0.38
If p("M_L") < 15.5 Then
t = t + 0.102
If p("M_L") < 8.5 Then
t = t + 0.153
End If ' p("M_L") < 8.5
If p("M_L") >= 8.5 Then
t = t - 0.059
End If ' p("M_L") >= 8.5
End If ' p("M_L") < 15.5
If p("M_L") >= 15.5 Then
t = t - 0.381
If p("M_L") < 20.5 Then
t = t + 0.111
End If ' p("M_L") < 20.5
If p("M_L") >= 20.5 Then
t = t - 0.267
End If ' p("M_L") >= 20.5
End If ' p("M_L") >= 15.5
End If ' p("M_L") >= 6.5
If p("AvgSpd") < 46.5 Then
t = t - 0.129
End If ' p("AvgSpd") < 46.5
If p("AvgSpd") >= 46.5 Then
t = t + 0.036
End If ' p("AvgSpd") >= 46.5
If p("Horse") = "1A" Then
t = t - 0.409
End If ' p("Horse") = "1A"
If p("Horse") <> "1A" Then
t = t + 0.004
End If ' p("Horse") <> "1A"
if t < 0 Then
t = 0
Else
t = 1
End If ' t < 0
test = t
End Function
Now the weka confusion matrix is
=== Weka Confusion Matrix ===
a b <-- classified as
5971 1415 | a = 0
2353 2145 | b = 1
And the routine output is as follow
=== Confusion Matrix ===
a b <-- classified as
5995 1391 | a = 0
2342 2156 | b = 1
And I cannot find out what is wrong with the routine. The routines generated by the parser work great with other classification but not with ADTree. Thanks in advance
Aucun commentaire:
Enregistrer un commentaire