-
Notifications
You must be signed in to change notification settings - Fork 27
/
2013-03-01-SVM.html
928 lines (726 loc) · 25.2 KB
/
2013-03-01-SVM.html
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>2013-03-01-SVM</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta name="title" content="2013-03-01-SVM"/>
<meta name="generator" content="Org-mode"/>
<meta name="generated" content="2013-03-15 10:19:25 PDT"/>
<meta name="author" content="Jim Blomo"/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<link rel="stylesheet" type="text/css" href="production/common.css" />
<link rel="stylesheet" type="text/css" href="production/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="production/projection.css" media="projection" />
<link rel="stylesheet" type="text/css" href="production/color-blue.css" media="projection" />
<link rel="stylesheet" type="text/css" href="production/presenter.css" media="presenter" />
<link href='http://fonts.googleapis.com/css?family=Lobster+Two:700|Yanone+Kaffeesatz:700|Open+Sans' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="preamble">
</div>
<div id="content">
<h1 class="title">2013-03-01-SVM</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Linear Regression</a></li>
<li><a href="#sec-2">2 Types of Models</a>
<ul>
<li><a href="#sec-2-1">2.1 Details</a></li>
</ul>
</li>
<li><a href="#sec-3">3 Case Study</a>
<ul>
<li><a href="#sec-3-1">3.1 Problem</a></li>
</ul>
</li>
<li><a href="#sec-4">4 Solution?</a>
<ul>
<li><a href="#sec-4-1">4.1 Prompts</a></li>
</ul>
</li>
<li><a href="#sec-5">5 Similarity</a>
<ul>
<li><a href="#sec-5-1">5.1 Challenge</a></li>
<li><a href="#sec-5-2">5.2 Log & Square</a></li>
</ul>
</li>
<li><a href="#sec-6">6 Point Distance</a>
<ul>
<li><a href="#sec-6-1">6.1 Error</a></li>
</ul>
</li>
<li><a href="#sec-7">7 Aggregate</a>
<ul>
<li><a href="#sec-7-1">7.1 Questions</a></li>
</ul>
</li>
<li><a href="#sec-8">8 Fitness Function</a>
<ul>
<li><a href="#sec-8-1">8.1 Fitness</a></li>
</ul>
</li>
<li><a href="#sec-9">9 Understanding Error</a>
<ul>
<li><a href="#sec-9-1">9.1 Error</a></li>
</ul>
</li>
<li><a href="#sec-10">10 Solution as Minimization</a></li>
<li><a href="#sec-11">11 Solution Approximation</a>
<ul>
<li><a href="#sec-11-1">11.1 Analytical</a></li>
</ul>
</li>
<li><a href="#sec-12">12 Gradient Descent</a>
<ul>
<li><a href="#sec-12-1">12.1 Steps</a></li>
</ul>
</li>
<li><a href="#sec-13">13 General Case</a>
<ul>
<li><a href="#sec-13-1">13.1 Approximate visualization</a></li>
</ul>
</li>
<li><a href="#sec-14">14 Support Vector Machines</a></li>
<li><a href="#sec-15">15 Decision Trees</a>
<ul>
<li><a href="#sec-15-1">15.1 Linearly Separable</a></li>
<li><a href="#sec-15-2">15.2 Details</a></li>
</ul>
</li>
<li><a href="#sec-16">16 Possibilities</a>
<ul>
<li><a href="#sec-16-1">16.1 Best?</a></li>
<li><a href="#sec-16-2">16.2 Best Separator</a></li>
<li><a href="#sec-16-3">16.3 Points, Vectors</a></li>
</ul>
</li>
<li><a href="#sec-17">17 Dimensions</a>
<ul>
<li><a href="#sec-17-1">17.1 Vocabulary</a></li>
</ul>
</li>
<li><a href="#sec-18">18 Expressing the Hyperplane</a>
<ul>
<li><a href="#sec-18-1">18.1 Questions</a></li>
</ul>
</li>
<li><a href="#sec-19">19 Challenge</a></li>
<li><a href="#sec-20">20 Maximizing Fitness Function</a></li>
<li><a href="#sec-21">21 Kernel Tricks</a>
<ul>
<li><a href="#sec-21-1">21.1 Polynomial Kernel</a>
<ul>
<li><a href="#sec-21-1-1">21.1.1 Square</a></li>
</ul>
</li>
<li><a href="#sec-21-2">21.2 Polynomial Kernel</a></li>
<li><a href="#sec-21-3">21.3 Details</a></li>
</ul>
</li>
<li><a href="#sec-22">22 <b>Break</b></a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Linear Regression <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-1">
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Types of Models <span class="tag"><span class="slide">slide</span> <span class="animate">animate</span></span></h2>
<div class="outline-text-2" id="text-2">
<ul>
<li>Classifiers
</li>
<li>Regressions
</li>
<li>Clustering
</li>
<li>Outlier
</li>
</ul>
</div>
<div id="outline-container-2-1" class="outline-3">
<h3 id="sec-2-1"><span class="section-number-3">2.1</span> Details <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-2-1">
<dl>
<dt>Classifiers</dt><dd>describes and distinguishes cases. Yelp may want to find a
category for a business based on the reviews and business description
</dd>
<dt>Regressions</dt><dd>Predict a continuous value. Eg. predict a home's selling
price given sq footage, # of bedrooms
</dd>
<dt>Clustering</dt><dd>find "natural" groups of data <b>without labels</b>
</dd>
<dt>Outlier</dt><dd>find anomalous transactions, eg. finding fraud for credit cards
</dd>
</dl>
</div>
</div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Case Study <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-3">
<ul>
<li>Housing prices: square footage
</li>
</ul>
<p> <img src="img/housing-regression.gif" alt="img/housing-regression.gif" />
</p>
</div>
<div id="outline-container-3-1" class="outline-3">
<h3 id="sec-3-1"><span class="section-number-3">3.1</span> Problem <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-3-1">
<ul>
<li>We'd like to know how to price a house based on the square footage
</li>
<li>Let's pretend this is the data we have
</li>
<li>How would we guess that value for 2500 sq ft?
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-4" class="outline-2">
<h2 id="sec-4"><span class="section-number-2">4</span> Solution? <span class="tag"><span class="slide">slide</span> <span class="animate">animate</span></span></h2>
<div class="outline-text-2" id="text-4">
<ul>
<li>Find a line that represents the data
</li>
<li><code>y = m*x + b</code>
</li>
<li>A line that is not very far from the points
</li>
</ul>
</div>
<div id="outline-container-4-1" class="outline-3">
<h3 id="sec-4-1"><span class="section-number-3">4.1</span> Prompts <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-4-1">
<ul>
<li>In English, how would you solve this?
</li>
<li>How to mathematically represent the line?
</li>
<li>What is a good line?
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-5" class="outline-2">
<h2 id="sec-5"><span class="section-number-2">5</span> Similarity <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-5">
<ul>
<li>Main challenges in data mining: defining a specific metric for an intuition
</li>
<li>Define distance for an individual point
</li>
<li>Define how to aggregate distances together
</li>
</ul>
</div>
<div id="outline-container-5-1" class="outline-3">
<h3 id="sec-5-1"><span class="section-number-3">5.1</span> Challenge <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-5-1">
<ul>
<li>This is big problem for engineering and math (stats) in general
</li>
<li>We'll cover some concepts, but if you're ever stuck, try looking in related
fields
</li>
<li>What are some of the ways we can measure distance between points?
Euclidian, Manhattan, Euclidian == L<sub>2</sub> norm
</li>
<li>What is a way to aggrgate numbers? sum, sum of squares, sum of logs
</li>
<li>Differences between the last two?
</li>
</ul>
</div>
</div>
<div id="outline-container-5-2" class="outline-3">
<h3 id="sec-5-2"><span class="section-number-3">5.2</span> Log & Square <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h3>
<div class="outline-text-3" id="text-5-2">
<dl>
<dt>Log</dt><dd>Useful for de-emphasizing large raw differences
</dd>
<dt>Square</dt><dd>Useful for taking the approximate absolute value
</dd>
</dl>
<p> <img src="img/logx.gif" alt="img/logx.gif" />
</p>
</div>
</div>
</div>
<div id="outline-container-6" class="outline-2">
<h2 id="sec-6"><span class="section-number-2">6</span> Point Distance <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-6">
<ul>
<li><code>y</code> distance from line
</li>
<li>Intuitively: error in estimate
</li>
<li><code>h(x) = m*x + b</code>
</li>
<li><code>err = h(x) - y</code>
</li>
</ul>
<p> <img src="img/error.gif" alt="img/error.gif" />
</p>
</div>
<div id="outline-container-6-1" class="outline-3">
<h3 id="sec-6-1"><span class="section-number-3">6.1</span> Error <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-6-1">
<ul>
<li>We want the difference from what we estimate to be the value to what the
value actually is
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-7" class="outline-2">
<h2 id="sec-7"><span class="section-number-2">7</span> Aggregate <span class="tag"><span class="slide">slide</span> <span class="animate">animate</span></span></h2>
<div class="outline-text-2" id="text-7">
<ul>
<li><code>sum</code>
</li>
<li>What about negative error?
</li>
<li>Sum of squares
</li>
<li><code>err = sum( (h(x) - y)**2 for x,y in dataset) / len(dataset)</code>
</li>
</ul>
</div>
<div id="outline-container-7-1" class="outline-3">
<h3 id="sec-7-1"><span class="section-number-3">7.1</span> Questions <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-7-1">
<ul>
<li>Now we have info about all the errors from points, how to summarize?
</li>
<li>Some points have negative error, some positive? Do they cancel each other
out?
</li>
<li>Imagine data set of two points: one solutions covers lines, other divides
them. Which is better?
</li>
<li>Use our squaring trick to make sure we don't have any negative values
</li>
<li>Normalize by the number of points
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-8" class="outline-2">
<h2 id="sec-8"><span class="section-number-2">8</span> Fitness Function <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-8">
<ul>
<li>Measures the quality or cost of the solution
</li>
<li><b>Key</b> ingredient for data mining algorithms
</li>
<li>If you can measure it, you can find the best solution
</li>
</ul>
</div>
<div id="outline-container-8-1" class="outline-3">
<h3 id="sec-8-1"><span class="section-number-3">8.1</span> Fitness <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-8-1">
<ul>
<li>Function spits out a metric. Metric can be thought of as <b>fitness</b> or
<b>cost</b>
</li>
<li>Find the maximum or minimum of that metric
</li>
<li>Depending on your fitness function, this can be easy or difficult
</li>
<li>img: <a href="http://onlinestatbook.com">http://onlinestatbook.com</a>
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-9" class="outline-2">
<h2 id="sec-9"><span class="section-number-2">9</span> Understanding Error <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-9">
<p> <img src="img/Linear_regression.svg.png" alt="img/Linear_regression.svg.png" />
Several possible solutions
</p>
</div>
<div id="outline-container-9-1" class="outline-3">
<h3 id="sec-9-1"><span class="section-number-3">9.1</span> Error <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-9-1">
<ul>
<li>What happens to the error as we move line around?
</li>
<li>Decreases until best fit, then increases
</li>
<li>What happens if we plot this error? Say, slope (x) against error (y)?
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-10" class="outline-2">
<h2 id="sec-10"><span class="section-number-2">10</span> Solution as Minimization <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-10">
<ul>
<li>Error is a parabola
</li>
<li>Several methods for finding the minimum
</li>
<li>Two categories: analytical, approximations
</li>
</ul>
<p><img src="img/parabola.png" alt="img/parabola.png" />
</p>
</div>
</div>
<div id="outline-container-11" class="outline-2">
<h2 id="sec-11"><span class="section-number-2">11</span> Solution Approximation <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-11">
<ul>
<li>Some fitness functions can be difficult to solve analytically
</li>
<li>Alternative: iteratively get closer to the solution
</li>
<li>Stop when answer is close enough
</li>
</ul>
</div>
<div id="outline-container-11-1" class="outline-3">
<h3 id="sec-11-1"><span class="section-number-3">11.1</span> Analytical <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-11-1">
<ul>
<li>How to find the minimum of functions in general?
</li>
<li>Take derivative, find 0
</li>
<li>Taking derivative can be complex or impossible (discontinuities) for some
functions, or solving for 0 is difficult
</li>
<li>Instead, well keep getting closer to the minimum using the function we
already have
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-12" class="outline-2">
<h2 id="sec-12"><span class="section-number-2">12</span> Gradient Descent <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-12">
<ol>
<li>Estimate current gradient (derivative)
</li>
<li>Take a step (<code>a * deriv</code>) in the direction of the gradient
</li>
<li>Step size is small, stop. Else repeat.
</li>
</ol>
<p> <img src="img/parabola.png" alt="img/parabola.png" />
</p>
</div>
<div id="outline-container-12-1" class="outline-3">
<h3 id="sec-12-1"><span class="section-number-3">12.1</span> Steps <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-12-1">
<ul>
<li>Take gradient by looking at the local derivative, or perturbating x
</li>
<li>Choose <code>a</code> as step size weight: big <code>a</code> is large step size
</li>
<li>If <code>deriv</code> is large, will also make you step size large.
</li>
<li>If <code>deriv</code> is large, probably means you are far away from minimum
</li>
<li>Keep repeating
</li>
<li>What happens if <code>a</code> is too small?
</li>
<li>What happens if <code>a</code> is too big?
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-13" class="outline-2">
<h2 id="sec-13"><span class="section-number-2">13</span> General Case <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-13">
<ul>
<li>Formulate fitness function for your problem
</li>
<li>Use analytics or approximations to find min/max
</li>
<li>Approximations: Newton's Method, Gradient Descent
</li>
</ul>
<p> <img src="img/error-reduce.png" alt="img/error-reduce.png" />
</p>
</div>
<div id="outline-container-13-1" class="outline-3">
<h3 id="sec-13-1"><span class="section-number-3">13.1</span> Approximate visualization <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-13-1">
<ul>
<li>Desired output of the error as gradient descent runs
</li>
<li>maybe some local problems, as step size is too big, but slowly move down to
a small amount of error
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-14" class="outline-2">
<h2 id="sec-14"><span class="section-number-2">14</span> Support Vector Machines <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-14">
</div>
</div>
<div id="outline-container-15" class="outline-2">
<h2 id="sec-15"><span class="section-number-2">15</span> Decision Trees <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-15">
<ul>
<li>Great for separable attributes
</li>
<li>Rules operate on independent attributes
</li>
<li>Classes separable along an axis/attribute
</li>
</ul>
<p> <img src="img/tree.png" alt="img/tree.png" />
</p>
</div>
<div id="outline-container-15-1" class="outline-3">
<h3 id="sec-15-1"><span class="section-number-3">15.1</span> Linearly Separable <span class="tag"><span class="slide">slide</span></span></h3>
<div class="outline-text-3" id="text-15-1">
<ul>
<li>How to handle case where separator line is not along an axis?
</li>
</ul>
<p> <img src="img/dataset_linsep.png" alt="img/dataset_linsep.png" />
</p></div>
</div>
<div id="outline-container-15-2" class="outline-3">
<h3 id="sec-15-2"><span class="section-number-3">15.2</span> Details <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-15-2">
<ul>
<li>Could say if <code>x>2</code> and <code>y>2</code>, but not a great intuitive fit
</li>
<li>Draw a line that takes both into account
</li>
<li><code>y = m*x + b</code>
</li>
<li>img: <a href="http://www.eric-kim.net/eric-kim-net/posts/1/kernel_trick.html">http://www.eric-kim.net/eric-kim-net/posts/1/kernel_trick.html</a>
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-16" class="outline-2">
<h2 id="sec-16"><span class="section-number-2">16</span> Possibilities <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-16">
<ul>
<li>Many lines <b>could</b> separate these classes
</li>
</ul>
<p> <img src="img/dataset_linsep.png" alt="img/dataset_linsep.png" />
</p>
</div>
<div id="outline-container-16-1" class="outline-3">
<h3 id="sec-16-1"><span class="section-number-3">16.1</span> Best? <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-16-1">
<ul>
<li>Which is the best?
</li>
<li>Why?
</li>
</ul>
</div>
</div>
<div id="outline-container-16-2" class="outline-3">
<h3 id="sec-16-2"><span class="section-number-3">16.2</span> Best Separator <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h3>
<div class="outline-text-3" id="text-16-2">
<ul>
<li>Best line gives the most distance between the two classes
</li>
<li>Measure distance between closest points
</li>
<li>Closest points == support vectors
</li>
</ul>
<p> <img src="img/separable.jpg" alt="img/separable.jpg" />
</p></div>
</div>
<div id="outline-container-16-3" class="outline-3">
<h3 id="sec-16-3"><span class="section-number-3">16.3</span> Points, Vectors <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-16-3">
<ul>
<li>Points can be represented as vectors
</li>
<li>Vector math can be easier to express succinctly
</li>
<li>img: <a href="http://www.sciencedirect.com/science/article/pii/S1072751511001918">http://www.sciencedirect.com/science/article/pii/S1072751511001918</a>
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-17" class="outline-2">
<h2 id="sec-17"><span class="section-number-2">17</span> Dimensions <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-17">
<ul>
<li>When separating two dimensions, we need a line
</li>
<li>When separating 3 dimensions?
</li>
<li>4 dimensions?
</li>
</ul>
</div>
<div id="outline-container-17-1" class="outline-3">
<h3 id="sec-17-1"><span class="section-number-3">17.1</span> Vocabulary <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-17-1">
<ul>
<li>Plane
</li>
<li>Hyperplane
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-18" class="outline-2">
<h2 id="sec-18"><span class="section-number-2">18</span> Expressing the Hyperplane <span class="tag"><span class="slide">slide</span> <span class="animate">animate</span></span></h2>
<div class="outline-text-2" id="text-18">
<ul>
<li><code>y = m*x + b</code>
</li>
<li><code>x_2 = m*x_1 + b</code>
</li>
<li><code>0 = m*x_1 + b - x_2</code>
</li>
<li><code>0 = [m -1] * [x_1, x_2] + b</code>
</li>
<li><code>0 = w * x + b</code>
</li>
</ul>
</div>
<div id="outline-container-18-1" class="outline-3">
<h3 id="sec-18-1"><span class="section-number-3">18.1</span> Questions <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-18-1">
<ul>
<li>How do you mathematically represent a line?
</li>
<li>Now, we're not going to think of a new letter for every dimension, we're
just going to say x<sub>1</sub> , x<sub>2</sub> , x<sub>3</sub> …
</li>
<li>Rewrite mathematically
</li>
<li>How to add more dimensions? x<sub>22</sub>? Express x as a vector of all attributes
</li>
<li>Again, don't want to come up with a bunch more letters after <code>m</code>, so use
<code>w</code> as the matrix representing all the <code>m</code> slopes
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-19" class="outline-2">
<h2 id="sec-19"><span class="section-number-2">19</span> Challenge <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-19">
<ul>
<li>Find <code>w</code>, <code>b</code> such that <code>w * x + b</code> maximizes the distance between the
support vectors
</li>
</ul>
<p> <img src="img/svm.png" alt="img/svm.png" />
</p>
</div>
</div>
<div id="outline-container-20" class="outline-2">
<h2 id="sec-20"><span class="section-number-2">20</span> Maximizing Fitness Function <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-20">
<ul>
<li>Now we have a fitness function and parameters we're trying to optimize
</li>
<li>Sound familiar?
</li>
</ul>
<p> <img src="img/svm.png" alt="img/svm.png" />
</p>
</div>
</div>
<div id="outline-container-21" class="outline-2">
<h2 id="sec-21"><span class="section-number-2">21</span> Kernel Tricks <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-21">
<ul>
<li>SVM good for linearly separable data
</li>
<li>How to handle other data?
</li>
</ul>
<p> <img src="img/svm-circular.jpg" alt="img/svm-circular.jpg" />
</p>
</div>
<div id="outline-container-21-1" class="outline-3">
<h3 id="sec-21-1"><span class="section-number-3">21.1</span> Polynomial Kernel <span class="tag"><span class="slide">slide</span></span></h3>
<div class="outline-text-3" id="text-21-1">
<ul>
<li>Transform it into linearly separable
</li>
<li>What function can we apply to these data points to make them separable?
</li>
</ul>
<p> <img src="img/svm-circular.jpg" alt="img/svm-circular.jpg" />
</p>
</div>
<div id="outline-container-21-1-1" class="outline-4">
<h4 id="sec-21-1-1"><span class="section-number-4">21.1.1</span> Square <span class="tag"><span class="notes">notes</span></span></h4>
<div class="outline-text-4" id="text-21-1-1">
<ul>
<li>Square all of them
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-21-2" class="outline-3">
<h3 id="sec-21-2"><span class="section-number-3">21.2</span> Polynomial Kernel <span class="tag"><span class="slide">slide</span></span></h3>
<div class="outline-text-3" id="text-21-2">
<p> <img src="img/kernel-trick.jpg" alt="img/kernel-trick.jpg" />
</p>
<p>
Now apply SVM
</p></div>
</div>
<div id="outline-container-21-3" class="outline-3">
<h3 id="sec-21-3"><span class="section-number-3">21.3</span> Details <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-21-3">
<ul>
<li>img: <a href="http://www.sciencedirect.com/science/article/pii/S1072751511001918">http://www.sciencedirect.com/science/article/pii/S1072751511001918</a>
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-22" class="outline-2">
<h2 id="sec-22"><span class="section-number-2">22</span> <b>Break</b> <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-22">
<script type="text/javascript" src="production/org-html-slideshow.js"></script>
</div>
</div>
</div>
<div id="postamble">
<p class="date">Date: 2013-03-15 10:19:25 PDT</p>
<p class="author">Author: Jim Blomo</p>
<p class="creator">Org version 7.8.02 with Emacs version 23</p>
<a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>
</div>
</body>
</html>