Spam Classifier Visualization

This explorer compares perceptron, decision tree, and support vector machine classifiers on a two-feature email dataset.

Controls

Decision Boundary Visualization

Decision Boundary Comparison: Perceptron, Decision Tree, SVM1.042.383.6124.9166.2207.5-1.03.47.812.216.621.0Email Length (words)Keyword CountNot SpamSpamPerceptronDecision tree regionsSVM regions/support
Not spam32class 0
Spam68class 1
Perceptron accuracy100.0%RMSE 12.0874
Decision tree100.0%RMSE 0.0000
SVM94.0%RMSE 0.7770

Dataset Preview

Email Length (words) Keyword Count Class
81.16 1.00 Not Spam
190.64 13.00 Spam
149.08 6.00 Spam
123.75 10.00 Spam
39.64 18.00 Spam
39.64 5.00 Not Spam
21.04 8.00 Not Spam
174.57 15.00 Spam
13.91 6.00 Not Spam
194.28 3.00 Spam

Perceptron Status

Epochs run1260 errors in final epoch
Weight 10.0838Email Length (words)
Weight 21.6462Keyword Count
Bias-18.3700boundary offset

Decision function: f(x) = 0.084 * x1 + 1.646 * x2 + -18.370. If f(x) >= 0, predict spam.

Perceptron Weight EvolutionWeight 111261.92-0.05Weight 211261.880.29Bias1126-0.15-18.37Training Error112638.000.00

Training History

Epoch Errors Weight 1 Weight 2 Bias Delta W1 Delta W2 Delta Bias Status
115 26 0.208585 1.546174 -16.980000 +0.135347 -0.010000 -0.120000 26 errors
116 36 0.227634 1.636174 -17.140000 +0.019049 +0.090000 -0.160000 36 errors
117 35 0.300225 1.696174 -17.290000 +0.072591 +0.060000 -0.150000 35 errors
118 35 0.372816 1.756174 -17.440000 +0.072591 +0.060000 -0.150000 35 errors
119 34 0.307582 1.846174 -17.580000 -0.065234 +0.090000 -0.140000 34 errors
120 33 0.342334 1.776174 -17.730000 +0.034751 -0.070000 -0.150000 33 errors
121 30 0.264972 1.706174 -17.870000 -0.077361 -0.070000 -0.140000 30 errors
122 35 0.337563 1.766174 -18.020000 +0.072591 +0.060000 -0.150000 35 errors
123 27 0.095041 1.636174 -18.150000 -0.242522 -0.130000 -0.130000 27 errors
124 26 0.230388 1.626174 -18.270000 +0.135347 -0.010000 -0.120000 26 errors
125 22 0.083804 1.646174 -18.370000 -0.146584 +0.020000 -0.100000 22 errors
126 0 0.083804 1.646174 -18.370000 +0.000000 +0.000000 +0.000000 Converged

Showing the latest 12 rows of 127 total training states.

Recent Perceptron Update

The latest epoch made no mistakes, so no weight update was needed.

Decision Tree Details

Depth3maximum rule depth
Leaves5terminal predictions
Nodes9total tree nodes
|--- Keyword Count <= 6.50
|   |--- Email Length (words) <= 142.48
|   |   |--- class: 0  value: [26, 0]
|   |--- Email Length (words) > 142.48
|   |   |--- class: 1  value: [0, 10]
|--- Keyword Count > 6.50
|   |--- Email Length (words) <= 29.89
|   |   |--- Keyword Count <= 14.00
|   |   |   |--- class: 0  value: [6, 0]
|   |   |--- Keyword Count > 14.00
|   |   |   |--- class: 1  value: [0, 2]
|   |--- Email Length (words) > 29.89
|   |   |--- class: 1  value: [0, 56]

SVM Details

KernelLINEARimplemented locally
C1.0regularization
Support vectors2424.0% of data
Gamma0.00013scale value
ID Email Length (words) Keyword Count
0 39.64 18.00
1 50.34 16.00
2 44.55 13.00
3 44.85 17.00
4 109.70 4.00
5 36.50 18.00
6 96.65 5.00
7 47.94 16.00
8 122.56 0.00
9 33.19 19.00
10 135.88 1.00
11 69.23 12.00