Skip to content

Commit 0acf199

Browse files
committed
added graphs
1 parent f7cdd38 commit 0acf199

File tree

8 files changed

+58
-3
lines changed

8 files changed

+58
-3
lines changed

Diff for: 2dplot.jpg

47 KB
Loading

Diff for: linerr.jpg

29.7 KB
Loading

Diff for: linout.txt

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
C Error #Support_vectors
2+
0.01 0.947748513169 662
3+
0.0137382379588 0.0522514868309 664
4+
0.0188739182214 0.0522514868309 664
5+
0.025929437974 0.0522514868309 666
6+
0.0356224789026 0.0522514868309 664
7+
0.0489390091848 0.0522514868309 664
8+
0.067233575365 0.0522514868309 434
9+
0.0923670857187 0.053525913339 423
10+
0.126896100317 0.482158028887 671
11+
0.17433288222 0.308836023789 331
12+
0.239502661999 0.0598980458794 419
13+
0.329034456231 0.0909090909091 465
14+
0.452035365636 0.831775700935 589
15+
0.621016941892 0.662701784197 372
16+
0.853167852417 0.7158028887 481
17+
1.17210229753 0.225573491929 611
18+
1.61026202756 0.494902293968 275
19+
2.21221629107 0.709005947324 450
20+
3.03919538231 0.328802039082 621
21+
4.17531893656 0.59940526763 426
22+
5.73615251045 0.633389974511 662
23+
7.88046281567 0.0781648258284 626
24+
10.8263673387 0.294392523364 294
25+
14.8735210729 0.203483432455 333
26+
20.4335971786 0.153355989805 492
27+
28.0721620394 0.938402718777 456
28+
38.5662042116 0.478759558199 413
29+
52.9831690628 0.672472387426 302
30+
72.7895384398 0.443925233645 274
31+
100.0 0.681393372982 358
32+
final err 0.235 final c 0.067233575365

Diff for: linsupvec.jpg

32.6 KB
Loading

Diff for: rbferr.jpg

30.8 KB
Loading

Diff for: rbfout.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#C Sigma Error #Support_vectors
2+
0.1 0.1 0.0522514868309 664
3+
0.1 1 0.947748513169 664
4+
0.1 5 0.0522514868309 666
5+
0.1 10 0.947748513169 664
6+
1 0.1 0.0522514868309 666
7+
1 1 0.0522514868309 664
8+
1 5 0.947748513169 662
9+
1 10 0.0522514868309 664
10+
5 0.1 0.0522514868309 419
11+
5 1 0.77994902294 371
12+
5 5 0.88572642311 585
13+
5 10 0.0522514868309 666
14+
10 0.1 0.947748513169 334
15+
10 1 0.763381478335 398
16+
10 5 0.527187765506 438
17+
10 10 0.85896346644 374
18+
100 0.1 0.0522514868309 419
19+
100 1 0.135938827528 322
20+
100 5 0.236618521665 485
21+
100 10 0.625318606627 291
22+
#final err 0.235 final c 0.1 final sigma 0.1

Diff for: rbfsvec.jpg

45.5 KB
Loading

Diff for: svmplot.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
def make2dData(n_samples):
2121
# generate a 2d 2-class dataset
22-
X,y = make_blobs(n_samples=n_samples, centers=2)
22+
X,y = make_blobs(n_samples=n_samples, centers=[[-1,-1],[1,1]])
2323
y[y==0] = -1
2424
return X,y
2525

@@ -86,12 +86,13 @@ def plot2d(s, X, y):
8686
k = svm.LinKernel()
8787
X,y = make2dData(200)
8888
cs = [0.1, 1, 5, 10, 100]
89-
sigmas = [0.1, 1, 5, 10]
89+
cs = np.logspace(-2,2,10)
90+
sigmas = [0.5, 1, 2, 5]
9091
for c in cs:
9192
for sigma in sigmas:
9293
k = svm.RBFKernel(sigma)
9394
print "c =", c, "sigma = ", sigma
9495
s = svm.SVM(c,k)
9596
s.train(X,y)
96-
plot2d(s,X,y)
9797
print "error", s.test(X,y)
98+
plot2d(s,X,y)

0 commit comments

Comments
 (0)