ml.xml 65.9 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?>

<doc>
   <title>Machine Learning</title>

   <!-- ************************************************************************* -->

   <body>
      <br/><br/>

         <p>
            This page documents all the machine learning algorithms present in
            the library.  In particular, there are algorithms for performing 
            binary classification, regression, clustering, anomaly detection, 
            and feature ranking, as well as algorithms for doing more 
            specialized computations.
         </p>

         <p> 
            A good tutorial and introduction to the general concepts used by most of the
            objects in this part of the library can be found in the <a href="svm_ex.cpp.html">svm example</a> program.
Davis King's avatar
Davis King committed
23
24
            After reading this example another good one to consult would be the <a href="model_selection_ex.cpp.html">model selection</a>
            example program.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
         </p>

         <p>   
            The major design goal of this portion of the library is to provide a highly modular and
            simple architecture for dealing with kernel algorithms. Towards this end, dlib takes a generic
            programming approach using C++ templates. In particular, each algorithm is parameterized
            to allow a user to supply either one of the predefined dlib kernels (e.g. <a 
            href="#radial_basis_kernel">RBF</a> operating
            on <a href="containers.html#matrix">column vectors</a>), or a new user defined kernel. 
            Moreover, the implementations of the algorithms are totally separated from the data on 
            which they operate. This makes the dlib implementation generic enough to operate on 
            any kind of data, be it column vectors, images, or some other form of structured data. 
            All that is necessary is an appropriate kernel.
         </p>

Davis King's avatar
Davis King committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

         <br/> 
         <h3>Paper Describing dlib Machine Learning</h3>
         <pre>
Davis E. King. <a href="http://www.jmlr.org/papers/volume10/king09a/king09a.pdf">Dlib-ml: A Machine Learning Toolkit</a>. 
   <i>Journal of Machine Learning Research</i> 10, pp. 1755-1758, 2009

@Article{dlib09,
  author = {Davis E. King},
  title = {Dlib-ml: A Machine Learning Toolkit},
  journal = {Journal of Machine Learning Research},
  year = {2009},
  volume = {10},
  pages = {1755-1758},
}
         </pre>

57
58
59
60
61
62
63
64
65
66
67
68
69
   </body>

   <!-- ************************************************************************* -->

   <menu width="150">
    <top>

      <section>
         <name>Primary Algorithms</name>
         <item>mlp</item> 
         <item>krls</item>
         <item>kcentroid</item>
         <item>linearly_independent_subset_finder</item>
Davis King's avatar
Davis King committed
70
         <item>linear_manifold_regularizer</item>
Davis King's avatar
Davis King committed
71
         <item>empirical_kernel_map</item>
72
73
         <item>kkmeans</item>
         <item>svm_nu_trainer</item> 
Davis King's avatar
Davis King committed
74
         <item>svm_c_linear_trainer</item> 
Davis King's avatar
Davis King committed
75
         <item>svm_c_ekm_trainer</item> 
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
         <item>rvm_trainer</item> 
         <item>rvm_regression_trainer</item> 
         <item>rbf_network_trainer</item> 
         <item>rank_features</item> 
         <item>svm_pegasos</item> 
      </section>

      <section>
         <name>Trainer Adapters</name>
         <item>train_probabilistic_decision_function</item> 
         <item>reduced_decision_function_trainer</item> 
         <item>reduced</item> 
         <item>reduced_decision_function_trainer2</item> 
         <item>reduced2</item> 
         <item>batch</item> 
         <item>verbose_batch</item> 
Davis King's avatar
Davis King committed
92
93
         <item>batch_cached</item> 
         <item>verbose_batch_cached</item> 
94
         <item>batch_trainer</item> 
Davis King's avatar
Davis King committed
95
96
         <item>null_trainer_type</item> 
         <item>null_trainer</item> 
Davis King's avatar
Davis King committed
97
98
99
         <item>roc_trainer_type</item> 
         <item>roc_c1_trainer</item> 
         <item>roc_c2_trainer</item> 
100
101
102
103
104
105
106
107
108
      </section>

      <section>
         <name>Kernels</name>
         <item>radial_basis_kernel</item>
         <item>polynomial_kernel</item>
         <item>sigmoid_kernel</item>
         <item>linear_kernel</item>
         <item>offset_kernel</item>
Davis King's avatar
Davis King committed
109
110
111
112
113
114

         <item>sparse_radial_basis_kernel</item>
         <item>sparse_polynomial_kernel</item>
         <item>sparse_sigmoid_kernel</item>
         <item>sparse_linear_kernel</item>

115
116
117
118
119
      </section>

      <section>
         <name>Function Objects</name>
         <item>decision_function</item>
Davis King's avatar
Davis King committed
120
         <item>projection_function</item>
121
122
123
124
125
         <item>distance_function</item>
         <item>probabilistic_decision_function</item>
         <item>normalized_function</item>
      </section>

Davis King's avatar
Davis King committed
126
127
128
129
130
131
132
      <section>
         <name>Data IO</name>
         <item>load_libsvm_formatted_data</item> 
         <item>save_libsvm_formatted_data</item> 
         <item>sparse_to_dense</item>
      </section>

133
134
      <section>
         <name>Miscellaneous</name>
Davis King's avatar
Davis King committed
135
         <item>simplify_linear_decision_function</item> 
136
         <item>vector_normalizer</item> 
Davis King's avatar
Davis King committed
137
         <item>vector_normalizer_pca</item> 
Davis King's avatar
Davis King committed
138
         <item>discriminant_pca</item> 
139
140
141
142
143
144
         <item>randomize_samples</item> 
         <item>is_binary_classification_problem</item> 
         <item>test_binary_decision_function</item> 
         <item>cross_validate_trainer</item> 
         <item>cross_validate_trainer_threaded</item> 
         <item>pick_initial_centers</item> 
Davis King's avatar
Davis King committed
145
         <item>find_gamma_with_big_centroid_gap</item> 
Davis King's avatar
Davis King committed
146
         <item>compute_mean_squared_distance</item> 
Davis King's avatar
Davis King committed
147
         <item>kernel_matrix</item> 
Davis King's avatar
Davis King committed
148
         <item>find_clusters_using_kmeans</item> 
149
150
151
152
153
         <item>
               <name>sparse vectors</name>
               <link>dlib/svm/sparse_vector_abstract.h.html#sparse_vectors</link>
         </item>

Davis King's avatar
Davis King committed
154
155
156
157
158
159
160
         
         <item nolink="true">
            <name>manifold_regularization_tools</name>
            <sub>
               <item>sample_pair</item>
               <item>find_percent_shortest_edges_randomly</item>
               <item>find_k_nearest_neighbors</item>
Davis King's avatar
Davis King committed
161
               <item>find_approximate_k_nearest_neighbors</item>
Davis King's avatar
Davis King committed
162
163
164
165
               <item>remove_short_edges</item>
               <item>remove_long_edges</item>
               <item>remove_percent_longest_edges</item>
               <item>remove_percent_shortest_edges</item>
Davis King's avatar
Davis King committed
166
167
168
169
170
171
               <item>squared_euclidean_distance</item>
               <item>use_weights_of_one</item>
               <item>use_gaussian_weights</item>
            </sub>
         </item>

172
173
174
175
176
177
178
179
180
181
182
      </section>

    </top>  
   </menu>

   <!-- ************************************************************************* -->
   <!-- ************************************************************************* -->
   <!-- ************************************************************************* -->

   <components>
   
Davis King's avatar
Davis King committed
183
184
   <!-- ************************************************************************* -->
      
Davis King's avatar
Davis King committed
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
      <component>
         <name>use_gaussian_weights</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/function_objects_abstract.h</spec_file>
         <description>
                This is a simple function object that takes a single argument
                which should be an object similar to <a href="#sample_pair">sample_pair</a>.  
         </description>
         <examples>
            <example>linear_manifold_regularizer_ex.cpp.html</example>
         </examples>

      </component>

   <!-- ************************************************************************* -->
      
      <component>
         <name>use_weights_of_one</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/function_objects_abstract.h</spec_file>
         <description>
                This is a simple function object that takes a single argument
                and always returns 1 
         </description>

      </component>

   <!-- ************************************************************************* -->
      
      
      <component>
         <name>squared_euclidean_distance</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/function_objects_abstract.h</spec_file>
         <description>
                This is a simple function object that computes squared euclidean distance
                between two <a href="containers.html#matrix">matrix</a> objects.
         </description>
         <examples>
            <example>linear_manifold_regularizer_ex.cpp.html</example>
         </examples>

      </component>

   <!-- ************************************************************************* -->
      
      <component>
         <name>find_k_nearest_neighbors</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/graph_creation_abstract.h</spec_file>
         <description>
            This is a function which finds all the k nearest neighbors of a set of points and outputs
            the result as a vector of <a href="#sample_pair">sample_pair</a> objects.  It takes O(n^2) where
            n is the number of data samples.  A faster approximate version is provided by 
Davis King's avatar
Davis King committed
239
            <a href="#find_approximate_k_nearest_neighbors">find_approximate_k_nearest_neighbors</a>.
Davis King's avatar
Davis King committed
240
241
242
243
         </description>

      </component>

Davis King's avatar
Davis King committed
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
   <!-- ************************************************************************* -->

      <component>
         <name>remove_short_edges</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/graph_creation_abstract.h</spec_file>
         <description>
            This is a simple function for removing edges with a small distance value from
            a vector of <a href="#sample_pair">sample_pairs</a>.
         </description>

      </component>

   <!-- ************************************************************************* -->

      <component>
         <name>remove_percent_shortest_edges</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/graph_creation_abstract.h</spec_file>
         <description>
            This is a simple function for removing edges with a small distance value from
            a vector of <a href="#sample_pair">sample_pairs</a>.
         </description>

      </component>

   <!-- ************************************************************************* -->

      <component>
         <name>remove_long_edges</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/graph_creation_abstract.h</spec_file>
         <description>
            This is a simple function for removing edges with a large distance value from
            a vector of <a href="#sample_pair">sample_pairs</a>.
         </description>

      </component>

   <!-- ************************************************************************* -->

      <component>
         <name>remove_percent_longest_edges</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/graph_creation_abstract.h</spec_file>
         <description>
            This is a simple function for removing edges with a large distance value from
            a vector of <a href="#sample_pair">sample_pairs</a>.
         </description>

      </component>

Davis King's avatar
Davis King committed
296
297
298
299
300
301
302
303
304
305
306
307
308
   <!-- ************************************************************************* -->

      <component>
         <name>find_approximate_k_nearest_neighbors</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/graph_creation_abstract.h</spec_file>
         <description>
            This function is a simple approximate form of <a href="#find_k_nearest_neighbors">find_k_nearest_neighbors</a>.
            Instead of checking all possible edges it randomly samples a large number of them and then performs 
            exact k-nearest-neighbors on that randomly selected subset.
         </description>
      </component>

Davis King's avatar
Davis King committed
309
310
311
312
313
314
315
   <!-- ************************************************************************* -->

      <component>
         <name>find_percent_shortest_edges_randomly</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/graph_creation_abstract.h</spec_file>
         <description>
Davis King's avatar
Davis King committed
316
            This function is a simple approximate form of <a href="#find_k_nearest_neighbors">find_k_nearest_neighbors</a>.
Davis King's avatar
Davis King committed
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
            Instead of checking all possible edges it randomly samples a large number of them and
            then returns the best ones.  
         </description>

         <examples>
            <example>linear_manifold_regularizer_ex.cpp.html</example>
         </examples>
                                 
      </component>

   <!-- ************************************************************************* -->

      
      <component>
         <name>sample_pair</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/sample_pair_abstract.h</spec_file>
         <description>
            This object is intended to represent an edge in an undirected graph 
Davis King's avatar
Davis King committed
336
                which has data samples at its vertices.  
Davis King's avatar
Davis King committed
337
338
339
340
341
342
343
344
345
346
347
         </description>

         <examples>
            <example>linear_manifold_regularizer_ex.cpp.html</example>
         </examples>
                                 
      </component>

   <!-- ************************************************************************* -->

      
Davis King's avatar
Davis King committed
348
349
350
351
352
353
354
355
356
357
      <component>
         <name>find_clusters_using_kmeans</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/kkmeans_abstract.h</spec_file>
         <description>
            This is just a simple linear kmeans clustering implementation.
         </description>
                                 
      </component>

358
   <!-- ************************************************************************* -->
Davis King's avatar
Davis King committed
359

360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
      <component>
         <name>pick_initial_centers</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/kkmeans_abstract.h</spec_file>
         <description>
            This is a function that you can use to seed data clustering algorithms
            like the <a href="#kkmeans">kkmeans</a> clustering method.  What it 
            does is pick reasonable starting points for clustering by basically
            trying to find a set of points that are all far away from each other.
         </description>
         <examples>
            <example>kkmeans_ex.cpp.html</example>
         </examples>
                                 
      </component>

Davis King's avatar
Davis King committed
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
   <!-- ************************************************************************* -->
      
      <component>
         <name>kernel_matrix</name>
         <file>dlib/svm.h</file>
         <spec_file>dlib/svm/kernel_matrix_abstract.h</spec_file>
         <description>
            This is a simple set of functions that makes it easy to turn a kernel 
            object and a set of samples into a kernel matrix.  It takes these two
            things and returns a <a href="dlib/matrix/matrix_abstract.h.html#matrix_exp">matrix expression</a>
            that represents the kernel matrix.
         </description>
                                 
      </component>

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
   <!-- ************************************************************************* -->
      
      <component checked="true">
         <name>mlp</name>
         <file>dlib/mlp.h</file>
         <spec_file>dlib/mlp/mlp_kernel_abstract.h</spec_file>
         <description>
            <p>
                This object represents a multilayer layer perceptron network that is
                trained using the back propagation algorithm.  The training algorithm also
                incorporates the momentum method.  That is, each round of back propagation
                training also adds a fraction of the previous update.  This fraction
                is controlled by the momentum term set in the constructor.  
            </p>
            <p>
               It is worth noting that a MLP is, in general, very inferior to modern
               kernel algorithms such as the support vector machine.  So if you haven't
               tried any other techniques with your data you really should.  
            </p>
         </description>

         <examples>
            <example>mlp_ex.cpp.html</example>
         </examples>
         
         <implementations>
            <implementation>
               <name>mlp_kernel_1</name>
               <file>dlib/mlp/mlp_kernel_1.h</file>
               <description> 
                  This is implemented in the obvious way.
               </description> 
    
               <typedefs>
                  <typedef>
                     <name>kernel_1a</name>
                     <description>is a typedef for mlp_kernel_1</description>
                  </typedef>
               </typedefs>                
               
            </implementation> 
                     
         </implementations>
                        
      </component>
            
   <!-- ************************************************************************* -->
      
      <component>
         <name>krls</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/krls_abstract.h</spec_file>
         <description>
                This is an implementation of the kernel recursive least squares algorithm 
                described in the paper The Kernel Recursive Least Squares Algorithm by Yaakov Engel.
            <p>
                The long and short of this algorithm is that it is an online kernel based 
                regression algorithm.  You give it samples (x,y) and it learns the function
                f(x) == y.  For a detailed description of the algorithm read the above paper.
            </p>
         </description>

         <examples>
            <example>krls_ex.cpp.html</example>
            <example>krls_filter_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>svm_pegasos</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/pegasos_abstract.h</spec_file>
         <description>
                This object implements an online algorithm for training a support 
                vector machine for solving binary classification problems.  

            <p>
                The implementation of the Pegasos algorithm used by this object is based
                on the following excellent paper:
               <blockquote>
                    Pegasos: Primal estimated sub-gradient solver for SVM (2007)
Davis King's avatar
Davis King committed
475
                    by Shai Shalev-Shwartz, Yoram Singer, Nathan Srebro 
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
                    In ICML 
               </blockquote>
            </p>
            <p>
                This SVM training algorithm has two interesting properties.  First, the 
                pegasos algorithm itself converges to the solution in an amount of time
                unrelated to the size of the training set (in addition to being quite fast
                to begin with).  This makes it an appropriate algorithm for learning from
                very large datasets.  Second, this object uses the <a href="#kcentroid">kcentroid</a> object 
                to maintain a sparse approximation of the learned decision function.  
                This means that the number of support vectors in the resulting decision 
                function is also unrelated to the size of the dataset (in normal SVM
                training algorithms, the number of support vectors grows approximately 
                linearly with the size of the training set).  
            </p>
         </description>

         <examples>
            <example>svm_pegasos_ex.cpp.html</example>
Davis King's avatar
Davis King committed
495
            <example>svm_sparse_ex.cpp.html</example>
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
         </examples>
      </component>
      
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>kkmeans</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/kkmeans_abstract.h</spec_file>
         <description>
                This is an implementation of a kernelized k-means clustering algorithm.  
                It performs k-means clustering by using the <a href="#kcentroid">kcentroid</a> object.  
         </description>

         <examples>
            <example>kkmeans_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>vector_normalizer</name>
         <file>dlib/statistics.h</file>
         <spec_file link="true">dlib/statistics/statistics_abstract.h</spec_file>
         <description>
                This object represents something that can learn to normalize a set 
                of column vectors.  In particular, normalized column vectors should 
                have zero mean and a variance of one.  
         </description>

         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
Davis King's avatar
Davis King committed
536
537
538
   <!-- ************************************************************************* -->

      
Davis King's avatar
Davis King committed
539
540
541
542
543
544
545
      <component>
         <name>discriminant_pca</name>
         <file>dlib/statistics.h</file>
         <spec_file link="true">dlib/statistics/dpca_abstract.h</spec_file>
         <description>
                This object implements the Discriminant PCA technique described in the paper:
                  <blockquote>
Davis King's avatar
Davis King committed
546
                    A New Discriminant Principal Component Analysis Method with Partial Supervision (2009)
Davis King's avatar
Davis King committed
547
548
                    by Dan Sun and Daoqiang Zhang
                  </blockquote>
Davis King's avatar
Davis King committed
549
550
551
                This algorithm is basically a straightforward generalization of the classical PCA
                technique to handle partially labeled data.  It is useful if you want to learn a linear
                dimensionality reduction rule using a bunch of data that is partially labeled.  
Davis King's avatar
Davis King committed
552
553
554
555
556
557
         </description>

      </component>
      
   <!-- ************************************************************************* -->

Davis King's avatar
Davis King committed
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
      <component>
         <name>vector_normalizer_pca</name>
         <file>dlib/statistics.h</file>
         <spec_file link="true">dlib/statistics/statistics_abstract.h</spec_file>
         <description>
                This object represents something that can learn to normalize a set 
                of column vectors.  In particular, normalized column vectors should 
                have zero mean and a variance of one.  

                This object also uses principal component analysis for the purposes 
                of reducing the number of elements in a vector.  
         </description>

      </component>
      
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
   <!-- ************************************************************************* -->

      <component>
         <name>linearly_independent_subset_finder</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/linearly_independent_subset_finder_abstract.h</spec_file>
         <description>
            <p>
                This is an implementation of an online algorithm for recursively finding a
                set of linearly independent vectors in a kernel induced feature space.  To 
                use it you decide how large you would like the set to be and then you feed it 
                sample points.  
            </p>
            <p>
                
                Each time you present it with a new sample point it either 
                keeps the current set of independent points unchanged, or if the new point 
                is "more linearly independent" than one of the points it already has,  
                it replaces the weakly linearly independent point with the new one.
            </p>

            <p>
                
                This object uses the Approximately Linearly Dependent metric described in the paper 
                The Kernel Recursive Least Squares Algorithm by Yaakov Engel to decide which
                points are more linearly independent than others.
            </p>
         </description>
Davis King's avatar
Davis King committed
601
602
603
         <examples>
            <example>empirical_kernel_map_ex.cpp.html</example>
         </examples>
604
605
606
607

      </component>
      
      
Davis King's avatar
Davis King committed
608
609
610
611
612
613
614
615
   <!-- ************************************************************************* -->
      
      <component>
         <name>linear_manifold_regularizer</name>
         <file>dlib/manifold_regularization.h</file>
         <spec_file link="true">dlib/manifold_regularization/linear_manifold_regularizer_abstract.h</spec_file>
         <description>
            <p>
Davis King's avatar
Davis King committed
616
617
                Many learning algorithms attempt to minimize a function that, at a high 
                level, looks like this:   
Davis King's avatar
Davis King committed
618
<pre>
Davis King's avatar
Davis King committed
619
   f(w) == complexity + training_set_error
Davis King's avatar
Davis King committed
620
621
622
623
624
625
626
627
628
629
</pre>
            </p>

               <p>
                The idea is to find the set of parameters, w, that gives low error on 
                your training data but also is not "complex" according to some particular
                measure of complexity.  This strategy of penalizing complexity is 
                usually called regularization.
               </p>

Davis King's avatar
Davis King committed
630
631
632
633
                <p>
                In the above setting, all the training data consists of labeled samples.  
                However, it would be nice to be able to benefit from unlabeled data.  
                The idea of manifold regularization is to extract useful information from 
Davis King's avatar
Davis King committed
634
                unlabeled data by first defining which data samples are "close" to each other 
Davis King's avatar
Davis King committed
635
636
                (perhaps by using their 3 <a href="#find_k_nearest_neighbors">nearest neighbors</a>) 
                and then adding a term to 
Davis King's avatar
Davis King committed
637
                the above function that penalizes any decision rule which produces 
Davis King's avatar
Davis King committed
638
                different outputs on data samples which we have designated as being close.
Davis King's avatar
Davis King committed
639
640
641
               </p>
                
                <p>
Davis King's avatar
Davis King committed
642
643
                It turns out that it is possible to transform these manifold regularized learning
                problems into the normal form shown above by applying a certain kind of 
Davis King's avatar
Davis King committed
644
645
646
647
648
649
650
651
652
653
654
655
656
657
                preprocessing to all our data samples.  Once this is done we can use a 
                normal learning algorithm, such as the <a href="#svm_c_linear_trainer">svm_c_linear_trainer</a>, 
                on just the
                labeled data samples and obtain the same output as the manifold regularized
                learner would have produced.  
               </p>
                
                <p>
                The linear_manifold_regularizer is a tool for creating this preprocessing 
                transformation.  In particular, the transformation is linear.  That is, it 
                is just a matrix you multiply with all your samples.  For a more detailed 
                discussion of this topic you should consult the following paper.  In 
                particular, see section 4.2.  This object computes the inverse T matrix 
                described in that section.
Davis King's avatar
Davis King committed
658
659
660
661
662
               <blockquote>
                    Linear Manifold Regularization for Large Scale Semi-supervised Learning
                    by Vikas Sindhwani, Partha Niyogi, and Mikhail Belkin
               </blockquote>
               </p>
Davis King's avatar
Davis King committed
663

Davis King's avatar
Davis King committed
664
665
666
667
668
669
670
         </description>
         <examples>
            <example>linear_manifold_regularizer_ex.cpp.html</example>
         </examples>
      </component>
      
      
Davis King's avatar
Davis King committed
671
672
673
674
675
676
677
678
   <!-- ************************************************************************* -->
      
      <component>
         <name>empirical_kernel_map</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/empirical_kernel_map_abstract.h</spec_file>
         <description>
            <p>
Davis King's avatar
Davis King committed
679
                This object represents a map from objects of sample_type (the kind of object 
Davis King's avatar
Davis King committed
680
                a <a href="dlib/svm/kernel_abstract.h.html#Kernel_Function_Objects">kernel function</a> 
Davis King's avatar
Davis King committed
681
682
683
684
685
686
                operates on) to finite dimensional column vectors which 
                represent points in the kernel feature space defined by whatever kernel 
                is used with this object. 
            </p>

            <p>
Davis King's avatar
Davis King committed
687
688
689
                To use the empirical_kernel_map you supply it with a particular kernel and a set of 
                basis samples.  After that you can present it with new samples and it will project 
                them into the part of kernel feature space spanned by your basis samples.   
Davis King's avatar
Davis King committed
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
            </p>
                
            <p>
                This means the empirical_kernel_map is a tool you can use to very easily kernelize 
                any algorithm that operates on column vectors.  All you have to do is select a 
                set of basis samples and then use the empirical_kernel_map to project all your 
                data points into the part of kernel feature space spanned by those basis samples.
                Then just run your normal algorithm on the output vectors and it will be effectively 
                kernelized.  
            </p>

            <p>
                Regarding methods to select a set of basis samples, if you are working with only a 
                few thousand samples then you can just use all of them as basis samples.  
                Alternatively, the 
                <a href="#linearly_independent_subset_finder">linearly_independent_subset_finder</a> 
Davis King's avatar
Davis King committed
706
707
                often works well for selecting a basis set.  I also find that picking a 
                <a href="algorithms.html#random_subset_selector">random subset</a> typically works well.
Davis King's avatar
Davis King committed
708
709
            </p>
         </description>
Davis King's avatar
Davis King committed
710
711
         <examples>
            <example>empirical_kernel_map_ex.cpp.html</example>
Davis King's avatar
Davis King committed
712
            <example>linear_manifold_regularizer_ex.cpp.html</example>
Davis King's avatar
Davis King committed
713
         </examples>
Davis King's avatar
Davis King committed
714
715
716
      </component>
      
      
717
718
719
720
721
722
723
724
725
726
   <!-- ************************************************************************* -->
      
      
      <component>
         <name>kcentroid</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/kcentroid_abstract.h</spec_file>
         <description>

                This object represents a weighted sum of sample points in a kernel induced
Davis King's avatar
Davis King committed
727
                feature space.  It can be used to kernelize any algorithm that requires only
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
                the ability to perform vector addition, subtraction, scalar multiplication,
                and inner products.  

                  <p>
                An example use of this object is as an online algorithm for recursively estimating 
                the centroid of a sequence of training points.  This object then allows you to 
                compute the distance between the centroid and any test points.  So you can use 
                this object to predict how similar a test point is to the data this object has 
                been trained on (larger distances from the centroid indicate dissimilarity/anomalous 
                points).  
                  </p>

                  <p>
                The object internally keeps a set of "dictionary vectors" 
                that are used to represent the centroid.  It manages these vectors using the 
                sparsification technique described in the paper The Kernel Recursive Least 
                Squares Algorithm by Yaakov Engel.  This technique allows us to keep the 
                number of dictionary vectors down to a minimum.  In fact, the object has a 
                user selectable tolerance parameter that controls the trade off between 
                accuracy and number of stored dictionary vectors.
                  </p>

         </description>

         <examples>
            <example>kcentroid_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>train_probabilistic_decision_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_abstract.h</spec_file>
         <description>
            <p>
               Trains a <a href="#probabilistic_decision_function">probabilistic_decision_function</a> using 
               some sort of batch trainer object such as the <a href="#svm_nu_trainer">svm_nu_trainer</a> or
               <a href="#rbf_network_trainer">rbf_network_trainer</a>.
            </p>
            The probability model is created by using the technique described in the paper:
            <blockquote>
                Probabilistic Outputs for Support Vector Machines and
                Comparisons to Regularized Likelihood Methods by 
Davis King's avatar
Davis King committed
775
                John C. Platt.  March 26, 1999
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
            </blockquote>
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>rbf_network_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/rbf_network_abstract.h</spec_file>
         <description>
               Trains a radial basis function network and outputs a <a href="#decision_function">decision_function</a>. 
         </description>
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>rvm_regression_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/rvm_abstract.h</spec_file>
         <description>
            <p>
               Trains a relevance vector machine for solving regression problems.  
               Outputs a <a href="#decision_function">decision_function</a> that represents the learned 
               regression function. 
            </p>
               The implementation of the RVM training algorithm used by this library is based
               on the following paper:
               <blockquote>
                Tipping, M. E. and A. C. Faul (2003). Fast marginal likelihood maximisation 
                for sparse Bayesian models. In C. M. Bishop and B. J. Frey (Eds.), Proceedings 
                of the Ninth International Workshop on Artificial Intelligence and Statistics, 
                Key West, FL, Jan 3-6.
               </blockquote>
         </description>
         <examples>
            <example>rvm_regression_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      
      <component>
         <name>rvm_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/rvm_abstract.h</spec_file>
         <description>
            <p>
               Trains a relevance vector machine for solving binary classification problems.  
               Outputs a <a href="#decision_function">decision_function</a> that represents the learned classifier. 
            </p>
               The implementation of the RVM training algorithm used by this library is based
               on the following paper:
               <blockquote>
                Tipping, M. E. and A. C. Faul (2003). Fast marginal likelihood maximisation 
                for sparse Bayesian models. In C. M. Bishop and B. J. Frey (Eds.), Proceedings 
                of the Ninth International Workshop on Artificial Intelligence and Statistics, 
                Key West, FL, Jan 3-6.
               </blockquote>
         </description>
         <examples>
            <example>rvm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      
      <component>
         <name>svm_nu_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_abstract.h</spec_file>
         <description>
            <p>
               Trains a nu support vector classifier and outputs a <a href="#decision_function">decision_function</a>. 
            </p>
               The implementation of the nu-svm training algorithm used by this library is based
               on the following excellent papers:
               <ul>
                  <li>Chang and Lin, Training {nu}-Support Vector Classifiers: Theory and Algorithms</li>
                  <li>Chih-Chung Chang and Chih-Jen Lin, LIBSVM : a library for support vector 
                     machines, 2001. Software available at 
                     <a href="http://www.csie.ntu.edu.tw/~cjlin/libsvm">http://www.csie.ntu.edu.tw/~cjlin/libsvm</a></li>
               </ul>
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
Davis King's avatar
Davis King committed
871
            <example>model_selection_ex.cpp.html</example>
872
873
874
875
         </examples>
                                 
      </component>
      
Davis King's avatar
Davis King committed
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
   <!-- ************************************************************************* -->

      <component>
         <name>svm_c_linear_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_c_linear_trainer_abstract.h</spec_file>
         <description>
                This object represents a tool for training the C formulation of 
                a support vector machine and is optimized for the case where
                linear kernels are used.   

                It is implemented using the <a href="optimization.html#oca">oca</a>  
                optimizer and uses the exact line search described in the 
                following paper:
                <blockquote>
                    Optimized Cutting Plane Algorithm for Large-Scale Risk Minimization
Davis King's avatar
Davis King committed
892
893
                      by  Vojtech Franc, Soren Sonnenburg; Journal of Machine Learning 
                      Research, 10(Oct):2157--2192, 2009. 
Davis King's avatar
Davis King committed
894
895
                </blockquote>
         </description>
Davis King's avatar
Davis King committed
896
897
898
         <examples>
            <example>svm_sparse_ex.cpp.html</example>
         </examples>
Davis King's avatar
Davis King committed
899
900
901
                                 
      </component>
      
Davis King's avatar
Davis King committed
902
903
904
905
906
907
908
909
910
911
   <!-- ************************************************************************* -->

      <component>
         <name>svm_c_ekm_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_c_ekm_trainer_abstract.h</spec_file>
         <description>
                This object represents a tool for training the C formulation of 
                a support vector machine.   It is implemented using the <a href="#empirical_kernel_map">empirical_kernel_map</a>
                to kernelize the <a href="#svm_c_linear_trainer">svm_c_linear_trainer</a>.  This makes it a very fast algorithm
Davis King's avatar
Davis King committed
912
                capable of learning from very large datasets.
Davis King's avatar
Davis King committed
913
914
915
916
917

         </description>
                                 
      </component>
      
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
   <!-- ************************************************************************* -->

      <component>
         <name>normalized_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/function_abstract.h</spec_file>
         <description>
                This object represents a container for another function
                object and an instance of the <a href="#vector_normalizer">vector_normalizer</a> object.  

                It automatically normalizes all inputs before passing them
                off to the contained function object.
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->


      <component>
         <name>probabilistic_decision_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/function_abstract.h</spec_file>
         <description>
                This object represents a binary decision function for use with
Davis King's avatar
Davis King committed
946
                kernel-based learning-machines.  It returns an 
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
                estimate of the probability that a given sample is in the +1 class. 
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>distance_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/function_abstract.h</spec_file>
         <description>
                This object represents a point in kernel induced feature space. 
                You may use this object to find the distance from the point it 
Davis King's avatar
Davis King committed
964
965
                represents to points in input space as well as other points
                represented by distance_functions.
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>decision_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/function_abstract.h</spec_file>
         <description>
                This object represents a decision or regression function that was 
                learned by a kernel based learning algorithm.  
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
Davis King's avatar
Davis King committed
986
987
988
989
990
991
992
993
994
   <!-- ************************************************************************* -->
      
      <component>
         <name>projection_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/function_abstract.h</spec_file>
         <description>
               This object represents a function that takes a data sample and projects
               it into kernel feature space.  The result is a real valued column vector that 
Davis King's avatar
Davis King committed
995
996
997
               represents a point in a kernel feature space.   Instances of
               this object are created using the 
               <a href="#empirical_kernel_map">empirical_kernel_map</a>.
Davis King's avatar
Davis King committed
998
         </description>
Davis King's avatar
Davis King committed
999
1000
1001
         <examples>
            <example>linear_manifold_regularizer_ex.cpp.html</example>
         </examples>
Davis King's avatar
Davis King committed
1002
1003
1004
                                 
      </component>
      
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
   <!-- ************************************************************************* -->
      
      <component>
         <name>offset_kernel</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/kernel_abstract.h</spec_file>
         <description>
                This object represents a kernel with a fixed value offset
                added to it.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>linear_kernel</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/kernel_abstract.h</spec_file>
         <description>
                This object represents a linear function kernel for use with
                kernel learning machines.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>sigmoid_kernel</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/kernel_abstract.h</spec_file>
         <description>
                This object represents a sigmoid kernel for use with
                kernel learning machines.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>polynomial_kernel</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/kernel_abstract.h</spec_file>
         <description>
                This object represents a polynomial kernel for use with
                kernel learning machines.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>radial_basis_kernel</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/kernel_abstract.h</spec_file>
         <description>
                This object represents a radial basis function kernel for use with
                kernel learning machines.
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
      
Davis King's avatar
Davis King committed
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
   <!-- ************************************************************************* -->
      
      <component>
         <name>sparse_linear_kernel</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/sparse_kernel_abstract.h</spec_file>
         <description>
                This object represents a linear function kernel for use with
                kernel learning machines that operate on 
                <a href="dlib/svm/sparse_vector_abstract.h.html#sparse_vectors">sparse vectors</a>.
         </description>
Davis King's avatar
Davis King committed
1085
1086
1087
         <examples>
            <example>svm_sparse_ex.cpp.html</example>
         </examples>
Davis King's avatar
Davis King committed
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>sparse_sigmoid_kernel</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/sparse_kernel_abstract.h</spec_file>
         <description>
                This object represents a sigmoid kernel for use with
                kernel learning machines that operate on 
                <a href="dlib/svm/sparse_vector_abstract.h.html#sparse_vectors">sparse vectors</a>.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>sparse_polynomial_kernel</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/sparse_kernel_abstract.h</spec_file>
         <description>
                This object represents a polynomial kernel for use with
                kernel learning machines that operate 
                <a href="dlib/svm/sparse_vector_abstract.h.html#sparse_vectors">sparse vectors</a>.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>sparse_radial_basis_kernel</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/sparse_kernel_abstract.h</spec_file>
         <description>
                This object represents a radial basis function kernel for use with
                kernel learning machines that operate 
                <a href="dlib/svm/sparse_vector_abstract.h.html#sparse_vectors">sparse vectors</a>.
         </description>
                                 
      </component>
      
      
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
   <!-- ************************************************************************* -->
      
      <component>
         <name>is_binary_classification_problem</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_abstract.h</spec_file>
         <description>
             This function simply takes two vectors, the first containing feature vectors and
             the second containing labels, and reports back if the two could possibly 
             contain data for a well formed classification problem.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
Davis King's avatar
Davis King committed
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
      <component>
         <name>simplify_linear_decision_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/simplify_linear_decision_function_abstract.h</spec_file>
         <description>
            This is a set of functions that takes various forms of linear <a href="#decision_function">decision functions</a>
            and collapses them down so that they only compute a single dot product when invoked. 
         </description>
      </component>
      
   <!-- ************************************************************************* -->

1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
      <component>
         <name>randomize_samples</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_abstract.h</spec_file>
         <description>
               Randomizes the order of samples in a column vector containing sample data.
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>rank_features</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/feature_ranking_abstract.h</spec_file>
         <description>
             Finds a ranking of the top N (a user supplied parameter) features in a set of data 
             from a two class classification problem.  It  
              does this by computing the distance between the centroids of both classes in kernel defined 
              feature space.  Good features are then ones that result in the biggest separation between
              the two centroids. 
Davis King's avatar
Davis King committed
1187
1188
1189
1190
1191
1192
1193
         </description>
         <examples>
            <example>rank_features_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
Davis King's avatar
Davis King committed
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
   <!-- ************************************************************************* -->
      
      <component>
         <name>load_libsvm_formatted_data</name>
         <file>dlib/data_io.h</file>
         <spec_file link="true">dlib/data_io/libsvm_io_abstract.h</spec_file>
         <description>
            This is a function that loads the data from a file that uses
            the LIBSVM format.  It loads the data into a std::vector of
            <a href="dlib/svm/sparse_vector_abstract.h.html#sparse_vectors">sparse vectors</a>.
            If you want to load data into dense vectors (i.e.
            dlib::matrix objects) then you can use the <a href="#sparse_to_dense">sparse_to_dense</a>
            function to perform the conversion.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>save_libsvm_formatted_data</name>
         <file>dlib/data_io.h</file>
         <spec_file link="true">dlib/data_io/libsvm_io_abstract.h</spec_file>
         <description>
            This is actually a pair of overloaded functions.  Between the two of them
            they let you save <a href="dlib/svm/sparse_vector_abstract.h.html#sparse_vectors">sparse</a> 
            or dense data vectors to file using the LIBSVM format.  
         </description>
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>sparse_to_dense</name>
         <file>dlib/data_io.h</file>
         <spec_file link="true">dlib/data_io/libsvm_io_abstract.h</spec_file>
         <description>
            This is a simple function that takes a std::vector of 
            <a href="dlib/svm/sparse_vector_abstract.h.html#sparse_vectors">sparse vectors</a> 
            and returns to you the equivalent std::vector of dense vectors. 
         </description>
      </component>
      
Davis King's avatar
Davis King committed
1237
1238
1239
   <!-- ************************************************************************* -->
      
      <component>
Davis King's avatar
Davis King committed
1240
         <name>find_gamma_with_big_centroid_gap</name>
Davis King's avatar
Davis King committed
1241
1242
1243
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/feature_ranking_abstract.h</spec_file>
         <description>
Davis King's avatar
Davis King committed
1244
1245
1246
1247
            This is a function that tries to pick a reasonable default value for the
            gamma parameter of the <a href="#radial_basis_kernel">radial_basis_kernel</a>.  It
            picks the parameter that gives the largest separation between the centroids, in 
            kernel feature space, of two classes of data.
Davis King's avatar
Davis King committed
1248
1249
1250
1251
1252
1253
1254
         </description>
         <examples>
            <example>rank_features_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
Davis King's avatar
Davis King committed
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
   <!-- ************************************************************************* -->
      
      <component>
         <name>compute_mean_squared_distance</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/feature_ranking_abstract.h</spec_file>
         <description>
            This is a function that simply finds the average squared distance between all
            pairs of a set of data samples.  It is often convenient to use the reciprocal
            of this value as the estimate of the gamma parameter of the 
            <a href="#radial_basis_kernel">radial_basis_kernel</a>.  
         </description>
                                 
      </component>
      
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
   <!-- ************************************************************************* -->
      
      <component>
         <name>batch</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/pegasos_abstract.h</spec_file>
         <description>
            This is a convenience function for creating 
            <a href="#batch_trainer">batch_trainer</a> objects.
         </description>
Davis King's avatar
Davis King committed
1280
1281
1282
         <examples>
            <example>svm_pegasos_ex.cpp.html</example>
         </examples>
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>verbose_batch</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/pegasos_abstract.h</spec_file>
         <description>
            This is a convenience function for creating 
            <a href="#batch_trainer">batch_trainer</a> objects.  This function
            generates a batch_trainer that will print status messages to standard
            output so that you can observe the progress of a training algorithm.
         </description>
Davis King's avatar
Davis King committed
1298
1299
1300
         <examples>
            <example>svm_pegasos_ex.cpp.html</example>
         </examples>
1301
1302
1303
                                 
      </component>
      
Davis King's avatar
Davis King committed
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
   <!-- ************************************************************************* -->
      
      <component>
         <name>batch_cached</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/pegasos_abstract.h</spec_file>
         <description>
            This is a convenience function for creating 
            <a href="#batch_trainer">batch_trainer</a> objects that are setup
            to use a kernel matrix cache.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>verbose_batch_cached</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/pegasos_abstract.h</spec_file>
         <description>
            This is a convenience function for creating 
            <a href="#batch_trainer">batch_trainer</a> objects.  This function
            generates a batch_trainer that will print status messages to standard
            output so that you can observe the progress of a training algorithm.
            It will also be configured to use a kernel matrix cache.
         </description>
                                 
      </component>
      
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
   <!-- ************************************************************************* -->
      
      <component>
         <name>batch_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/pegasos_abstract.h</spec_file>
         <description>
               This is a batch trainer object that is meant to wrap online trainer objects 
               that create <a href="#decision_function">decision_functions</a>.  It
               turns an online learning algorithm such as <a href="#svm_pegasos">svm_pegasos</a>
               into a batch learning object.  This allows you to use objects like
               svm_pegasos with functions (e.g. <a href="#cross_validate_trainer">cross_validate_trainer</a>)
               that expect batch mode training objects. 
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
Davis King's avatar
Davis King committed
1354
         <name>null_trainer_type</name>
1355
         <file>dlib/svm.h</file>
Davis King's avatar
Davis King committed
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
         <spec_file link="true">dlib/svm/null_trainer_abstract.h</spec_file>
         <description>
                This object is a simple tool for turning a <a href="#decision_function">decision_function</a> 
                (or any object with an interface compatible with decision_function)
                into a trainer object that always returns the original decision
                function when you try to train with it.  

               <p>
                dlib contains a few "training post processing" algorithms (e.g. 
                <a href="#reduced">reduced</a> and <a href="#reduced2">reduced2</a>).  These tools 
                take in a trainer object,
                tell it to perform training, and then they take the output decision
                function and do some kind of post processing to it.  The null_trainer_type 
                object is useful because you can use it to run an already
                learned decision function through the training post processing
                algorithms by turning a decision function into a null_trainer_type
                and then giving it to a post processor.  
               </p>
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>null_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/null_trainer_abstract.h</spec_file>
1384
1385
         <description>
            This is a convenience function for creating 
Davis King's avatar
Davis King committed
1386
            <a href="#null_trainer_type">null_trainer_type</a>
1387
1388
1389
1390
1391
            objects.
         </description>
                                 
      </component>
      
Davis King's avatar
Davis King committed
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
   <!-- ************************************************************************* -->
      
      <component>
         <name>roc_c1_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/roc_trainer_abstract.h</spec_file>
         <description>
            This is a convenience function for creating 
            <a href="#roc_trainer_type">roc_trainer_type</a> objects that are
            setup to pick a point on the ROC curve with respect to the +1 class.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>roc_c2_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/roc_trainer_abstract.h</spec_file>
         <description>
            This is a convenience function for creating 
            <a href="#roc_trainer_type">roc_trainer_type</a> objects that are
            setup to pick a point on the ROC curve with respect to the -1 class.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>roc_trainer_type</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/roc_trainer_abstract.h</spec_file>
         <description>
                This object is a simple trainer post processor that allows you to 
                easily adjust the bias term in a trained decision_function object.
                That is, this object lets you pick a point on the ROC curve and 
                it will adjust the bias term appropriately.  

               <p>
                So for example, suppose you wanted to set the bias term so that
                the accuracy of your decision function on +1 labeled samples was 99%.
                To do this you would use an instance of this object declared as follows:
                <tt>roc_trainer_type&lt;trainer_type&gt;(your_trainer, 0.99, +1);</tt>
               </p>
         </description>
                                 
      </component>
      
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
   <!-- ************************************************************************* -->
      
      <component>
         <name>reduced_decision_function_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/reduced_abstract.h</spec_file>
         <description>
               This is a batch trainer object that is meant to wrap other batch trainer objects 
               that create <a href="#decision_function">decision_function</a> objects.
               It performs post processing on the output decision_function objects 
               with the intent of representing the decision_function with fewer 
Davis King's avatar
Davis King committed
1453
               basis vectors.
1454
1455
1456
1457
1458
1459
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
Davis King's avatar
Davis King committed
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
      <component>
         <name>reduced</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/reduced_abstract.h</spec_file>
         <description>
            This is a convenience function for creating 
            <a href="#reduced_decision_function_trainer">reduced_decision_function_trainer</a>
            objects.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->

1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
      <component>
         <name>reduced2</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/reduced_abstract.h</spec_file>
         <description>
            This is a convenience function for creating 
            <a href="#reduced_decision_function_trainer2">reduced_decision_function_trainer2</a>
            objects.
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>reduced_decision_function_trainer2</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/reduced_abstract.h</spec_file>
         <description>
               <p>
               This is a batch trainer object that is meant to wrap other batch trainer objects 
               that create <a href="#decision_function">decision_function</a> objects.
               It performs post processing on the output decision_function objects 
               with the intent of representing the decision_function with fewer 
Davis King's avatar
Davis King committed
1501
               basis vectors.  
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
               </p>
               <p>
               It begins by performing the same post processing as
               the <a href="#reduced_decision_function_trainer">reduced_decision_function_trainer</a>
               object but it also performs a global gradient based optimization 
               to further improve the results.
               </p>
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>test_binary_decision_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_abstract.h</spec_file>
         <description>
            Tests a <a href="#decision_function">decision_function</a> that represents a binary decision function and
            returns the test accuracy.  

         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      
      <component>
         <name>cross_validate_trainer_threaded</name>
         <file>dlib/svm_threaded.h</file>
         <spec_file link="true">dlib/svm/svm_threaded_abstract.h</spec_file>
         <description>
               Performs k-fold cross validation on a user supplied trainer object such
               as the <a href="#svm_nu_trainer">svm_nu_trainer</a> or <a href="#rbf_network_trainer">rbf_network_trainer</a>.  
               This function does the same thing as <a href="#cross_validate_trainer">cross_validate_trainer</a>
               except this function also allows you to specify how many threads of execution to use.
               So you can use this function to take advantage of a multi-core system to perform
               cross validation faster.
         </description>
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>cross_validate_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_abstract.h</spec_file>
         <description>
               Performs k-fold cross validation on a user supplied trainer object such
               as the <a href="#svm_nu_trainer">svm_nu_trainer</a> or <a href="#rbf_network_trainer">rbf_network_trainer</a>.
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
Davis King's avatar
Davis King committed
1560
            <example>model_selection_ex.cpp.html</example>
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
   </components>

   <!-- ************************************************************************* -->


</doc>