-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathknn_exercises.txt
136 lines (127 loc) · 4.06 KB
/
knn_exercises.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
KNN - DIGIT DATA
Processing K value = 1
0.967786154901
[[ -1 0 0 0 0 0 0 0 0 0]
[ 0 -53 0 0 0 0 0 0 0 0]
[ 0 0 -126 2 0 0 0 2 1 0]
[ 0 0 0 114 0 3 0 0 4 0]
[ 2 2 0 1 119 0 0 0 0 4]
[ 2 0 1 3 0 105 2 0 2 0]
[ 2 0 0 0 0 0 117 0 0 0]
[ 0 0 0 0 2 0 0 121 0 2]
[ 0 2 0 1 0 0 1 1 111 0]
[ 0 0 0 0 2 0 0 3 0 -119]]
Processing K value = 2
0.956134338588
[[ -16 0 0 0 0 0 0 0 0 0]
[ 0 -49 0 0 0 0 0 0 0 0]
[ 2 2 -117 1 0 0 0 1 4 1]
[ 2 1 0 100 0 0 0 0 3 0]
[ 0 1 1 0 126 0 0 0 1 7]
[ 5 0 0 3 1 104 1 0 1 0]
[ 5 0 0 0 0 0 123 0 0 0]
[ 0 1 1 0 3 0 0 124 0 2]
[ 2 1 0 2 0 1 1 1 116 0]
[ 1 0 0 0 1 0 0 3 1 116]]
Processing K value = 3
0.96847155586
[[ -18 0 0 0 0 0 1 0 0 0]
[ 0 -40 0 0 0 0 0 0 0 0]
[ 2 2 -119 0 0 0 0 2 0 0]
[ 1 0 0 -125 0 2 0 0 0 1]
[ 1 2 1 0 110 0 1 1 0 2]
[ 3 0 0 4 0 85 1 0 0 1]
[ 3 0 0 0 2 0 -126 0 0 0]
[ 0 1 1 0 0 0 0 -111 0 2]
[ 0 1 1 2 1 0 0 0 105 0]
[ 1 0 0 0 1 0 0 2 0 116]]
Processing K value = 4
0.966415352981
[[ -14 0 1 1 0 1 0 0 0 0]
[ 0 -53 0 0 0 0 0 0 0 0]
[ 1 0 -101 0 0 0 0 0 4 2]
[ 0 0 0 122 0 0 0 0 0 0]
[ 0 3 1 0 104 0 0 0 0 2]
[ 1 0 1 3 0 100 2 0 1 1]
[ 2 0 0 0 1 0 -120 0 0 0]
[ 0 1 0 0 1 0 0 -128 0 7]
[ 2 1 0 3 1 1 1 0 105 0]
[ 0 0 0 0 0 0 0 3 0 115]]
Processing K value = 5
0.962988348184
[[ -22 0 0 0 0 1 0 0 0 0]
[ 0 -51 0 0 0 0 0 0 0 0]
[ 3 2 125 1 1 0 0 1 1 0]
[ 0 0 1 -121 0 1 0 0 1 1]
[ 0 5 0 0 118 0 1 0 0 5]
[ 3 0 1 2 1 107 2 0 0 1]
[ 1 0 0 0 1 0 124 0 0 0]
[ 0 0 0 0 2 0 0 -127 0 2]
[ 0 2 0 3 0 0 0 1 105 0]
[ 1 0 0 0 2 0 0 3 1 123]]
[0.9677861549006168, 0.9561343385880741, 0.9684715558601782, 0.9664153529814942, 0.9629883481836875]
We can see here that our best result is when K = 3
Runtime: 830.200028896 seconds
Accuracy:k = 1 - 68.9%
2 - 69.1%
3 - 70.1%
4 - 69.0%
5 - 68.5%
Spam Data Raw
Processing K value = 1
0.796959826276
[[-38 89]
[ 98 4]]
Processing K value = 2
0.795874049946
[[ 11 41]
[-109 -46]]
Processing K value = 3
0.809989142237
[[-45 74]
[101 23]]
Processing K value = 4
0.809989142237
[[ 2 46]
[-127 -24]]
Processing K value = 5
0.811074918567
[[-34 91]
[ 83 13]]
[0.7969598262757872, 0.7958740499457112, 0.8099891422366993, 0.8099891422366993, 0.8110749185667753]
Runtime 295.327699312 seconds
Accuracy
k = 1 18.4%
k = 2 27.6%
k = 3 27.98%
k = 4 14%
k = 5 21%
Spam Data Normalized
Processing K value = 1
0.837133550489
[[-5 89]
[61 8]]
Processing K value = 2
0.801302931596
[[ -4 41]
[-114 -26]]
Processing K value = 3
0.815418023887
[[-46 63]
[107 29]]
Processing K value = 4
0.807817589577
[[ 12 57]
[120 -36]]
Processing K value = 5
0.793702497286
[[-19 87]
[103 -18]]
[0.8371335504885994, 0.8013029315960912, 0.8154180238870793, 0.8078175895765473, 0.7937024972855592]
Runtime: 293.228666782 seconds
Accuracy
K = 1 7%
K = 2 16%
K = 3 30.6%
K = 4 21%
K = 5 79%