<?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 
            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.
            After reading this example another good one to consult would be the <a href="model_selection_ex.cpp.html">model selection</a>
            example program.  Finally, if you came here looking for a binary classification or regression tool then I would
            try the <a href="#krr_trainer">krr_trainer</a> first as it is generally the easiest method to use.
         </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>


         <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>

   </body>

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

   <menu width="150">
    <top>

      <center><h2><u>Primary Algorithms</u></h2></center>
      <section>
         <name>Binary Classification</name>
         <item>svm_nu_trainer</item> 
         <item>svm_c_trainer</item> 
         <item>svm_c_linear_trainer</item> 
         <item>svm_c_ekm_trainer</item> 
         <item>rvm_trainer</item> 
         <item>svm_pegasos</item> 
         <item>train_probabilistic_decision_function</item> 
      </section>
      <section>
         <name>Multiclass Classification</name>
         <item>one_vs_one_trainer</item> 
         <item>one_vs_all_trainer</item> 
         <item>svm_multiclass_linear_trainer</item> 
      </section>
      <section>
         <name>Regression</name>
         <item>mlp</item> 
         <item>krls</item>
         <item>krr_trainer</item> 
         <item>rr_trainer</item> 
         <item>svr_trainer</item> 
         <item>rvm_regression_trainer</item> 
         <item>rbf_network_trainer</item> 
      </section>
      <section>
         <name>Structured Prediction</name>
         <item>structural_svm_problem</item> 
         <item>structural_svm_problem_threaded</item> 
         <item>svm_struct_controller_node</item> 
         <item>svm_struct_processing_node</item> 
      </section>
      <section>
         <name>Unsupervised</name>
         <item>kcentroid</item>
         <item>linearly_independent_subset_finder</item>
         <item>empirical_kernel_map</item>
         <item>kkmeans</item>
         <item>svm_one_class_trainer</item> 
         <item>find_clusters_using_kmeans</item> 
         <item>vector_normalizer</item> 
         <item>vector_normalizer_pca</item> 
      </section>
      <section>
         <name>Semi-Supervised</name>
         <item>linear_manifold_regularizer</item>
         <item>discriminant_pca</item> 
         <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>
               <item>find_approximate_k_nearest_neighbors</item>
               <item>remove_short_edges</item>
               <item>remove_long_edges</item>
               <item>remove_percent_longest_edges</item>
               <item>remove_percent_shortest_edges</item>
               <item>squared_euclidean_distance</item>
               <item>use_weights_of_one</item>
               <item>use_gaussian_weights</item>
            </sub>
         </item>
      </section>
      <section>
         <name>Feature Selection</name>
         <item>rank_features</item> 
         <item>sort_basis_vectors</item> 
      </section>

      <center><h2><u>Other Tools</u></h2></center>
      <section>
         <name>Validation</name>
         <item>cross_validate_trainer</item> 
         <item>cross_validate_trainer_threaded</item> 
         <item>cross_validate_multiclass_trainer</item> 
         <item>cross_validate_regression_trainer</item> 
         <item>test_binary_decision_function</item> 
         <item>test_multiclass_decision_function</item> 
         <item>test_regression_function</item> 
      </section>

      <section>
         <name>Trainer Adapters</name>
         <item>reduced</item> 
         <item>reduced2</item> 
         <item>batch</item> 
         <item>probabilistic</item> 
         <item>verbose_batch</item> 
         <item>batch_cached</item> 
         <item>verbose_batch_cached</item> 
         <item>null_trainer</item> 
         <item>roc_c1_trainer</item> 
         <item>roc_c2_trainer</item> 
      </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>

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

      </section>

      <section>
         <name>Function Objects</name>
         <item>decision_function</item>
         <item>projection_function</item>
         <item>distance_function</item>
         <item>probabilistic_decision_function</item>
         <item>probabilistic_function</item>
         <item>normalized_function</item>
         <item>one_vs_one_decision_function</item>
         <item>multiclass_linear_decision_function</item>
         <item>one_vs_all_decision_function</item>
      </section>

      <section>
         <name>Data IO</name>
         <item>load_libsvm_formatted_data</item> 
         <item>save_libsvm_formatted_data</item> 
         <item>sparse_to_dense</item>
         <item>fix_nonzero_indexing</item>
      </section>

      <section>
         <name>Miscellaneous</name>
         <item>simplify_linear_decision_function</item> 
         <item>fill_lisf</item> 
         <item>randomize_samples</item> 
         <item>is_binary_classification_problem</item> 
         <item>approximate_distance_function</item> 
         <item>is_learning_problem</item> 
         <item>select_all_distinct_labels</item> 
         <item>pick_initial_centers</item> 
         <item>find_gamma_with_big_centroid_gap</item> 
         <item>compute_mean_squared_distance</item> 
         <item>kernel_matrix</item> 
         <item>
               <name>sparse vectors</name>
               <link>dlib/svm/sparse_vector_abstract.h.html#sparse_vectors</link>
         </item>

         

      </section>

    </top>  
   </menu>

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

   <components>
   
   <!-- ************************************************************************* -->
      
      <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 
            <a href="#find_approximate_k_nearest_neighbors">find_approximate_k_nearest_neighbors</a>.
         </description>

      </component>

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

      <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>

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

      <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>

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

      <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>
            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 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 
                which has data samples at its vertices.  
         </description>

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

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

      
      <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>

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

      <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>

   <!-- ************************************************************************* -->
      
      <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_exp_abstract.h.html#matrix_exp">matrix expression</a>
            that represents the kernel matrix.
         </description>
                                 
      </component>

   <!-- ************************************************************************* -->
      
      <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)
                    by Shai Shalev-Shwartz, Yoram Singer, Nathan Srebro 
                    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>
            <example>svm_sparse_ex.cpp.html</example>
         </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>
      
   <!-- ************************************************************************* -->

      
      <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>
                    A New Discriminant Principal Component Analysis Method with Partial Supervision (2009)
                    by Dan Sun and Daoqiang Zhang
                  </blockquote>
                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.  
         </description>

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

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

      <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 (aka dictionary) of linearly independent vectors in a kernel induced 
                feature space.  To use it you decide how large you would like the dictionary 
                to be and then you feed it sample points.  
            </p>
            <p>
                The implementation 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.  The metric is 
                simply the squared distance between a test point and the subspace spanned by 
                the set of dictionary vectors.
            </p>
            <p>
                Each time you present this object with a new sample point  
                it calculates the projection distance and if it is sufficiently large then this 
                new point is included into the dictionary.  Note that this object can be configured 
                to have a maximum size.  Once the max dictionary size is reached each new point 
                kicks out a previous point.  This is done by removing the dictionary vector that 
                has the smallest projection distance onto the others.  That is, the "least linearly 
                independent" vector is removed to make room for the new one.
            </p>
         </description>
         <examples>
            <example>empirical_kernel_map_ex.cpp.html</example>
         </examples>

      </component>
      
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>fill_lisf</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/linearly_independent_subset_finder_abstract.h</spec_file>
         <description>
               This is a simple function for filling a 
               <a href="#linearly_independent_subset_finder">linearly_independent_subset_finder</a>
               with data points by using random sampling.   
         </description>
         <examples>
            <example>empirical_kernel_map_ex.cpp.html</example>
         </examples>

      </component>
      
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>sort_basis_vectors</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/sort_basis_vectors_abstract.h</spec_file>
         <description>
              A kernel based learning method ultimately needs to select a set of basis functions
              represented by a particular choice of kernel and a set of basis vectors.  
              sort_basis_vectors() is a function which attempts to perform supervised
              basis set selection.  In particular, you give it a candidate set of basis
              vectors and it sorts them according to how useful they are for solving
              a particular decision problem.
         </description>
      </component>
      
      
   <!-- ************************************************************************* -->
      
      <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>
                Many learning algorithms attempt to minimize a function that, at a high 
                level, looks like this:   
<pre>
   f(w) == complexity + training_set_error
</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>

                <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 
                unlabeled data by first defining which data samples are "close" to each other 
                (perhaps by using their 3 <a href="#find_k_nearest_neighbors">nearest neighbors</a>) 
                and then adding a term to 
                the above function that penalizes any decision rule which produces 
                different outputs on data samples which we have designated as being close.
               </p>
                
                <p>
                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 
                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.
               <blockquote>
                    Linear Manifold Regularization for Large Scale Semi-supervised Learning
                    by Vikas Sindhwani, Partha Niyogi, and Mikhail Belkin
               </blockquote>
               </p>

         </description>
         <examples>
            <example>linear_manifold_regularizer_ex.cpp.html</example>
         </examples>
      </component>
      
      
   <!-- ************************************************************************* -->
      
      <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>
                This object represents a map from objects of sample_type (the kind of object 
                a <a href="dlib/svm/kernel_abstract.h.html#Kernel_Function_Objects">kernel function</a> 
                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>
                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.   
            </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> 
                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.
            </p>
         </description>
         <examples>
            <example>empirical_kernel_map_ex.cpp.html</example>
            <example>linear_manifold_regularizer_ex.cpp.html</example>
         </examples>
      </component>
      
      
   <!-- ************************************************************************* -->
      
      
      <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
                feature space.  It can be used to kernelize any algorithm that requires only
                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_function">probabilistic_function</a> using 
               some sort of binary classification trainer object such as the <a href="#svm_nu_trainer">svm_nu_trainer</a> or
               <a href="#krr_trainer">krr_trainer</a>.
            </p>
            The probability model is created by using the technique described in the following papers:
            <blockquote>
                Probabilistic Outputs for Support Vector Machines and
                Comparisons to Regularized Likelihood Methods by 
                John C. Platt.  March 26, 1999
            </blockquote>
            <blockquote>
                A Note on Platt's Probabilistic Outputs for Support Vector Machines
                by Hsuan-Tien Lin, Chih-Jen Lin, and Ruby C. Weng
            </blockquote>
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>probabilistic</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_abstract.h</spec_file>
         <description>
            This is a trainer adapter which simply runs the trainer it is given though the
            <a href="#train_probabilistic_decision_function">train_probabilistic_decision_function</a>
            function.  
         </description>
                                 
      </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>. 
               This object can be used for either regression or binary classification problems.
               It's worth pointing out that this object is essentially an unregularized version 
               of <a href="#krr_trainer">kernel ridge regression</a>.  This means 
               you should really prefer to use kernel ridge regression instead.
         </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>krr_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/krr_trainer_abstract.h</spec_file>
         <description>
            <p>
               Performs kernel ridge regression and outputs a <a href="#decision_function">decision_function</a> that 
               represents the learned function. 
            </p>
            The implementation is done using the <a href="#empirical_kernel_map">empirical_kernel_map</a> and 
            <a href="#linearly_independent_subset_finder">linearly_independent_subset_finder</a> to kernelize
            the <a href="#rr_trainer">rr_trainer</a> object.  Thus it allows you to run the algorithm on large 
            datasets and obtain sparse outputs.  It is also capable of automatically estimating its 
            regularization parameter using leave-one-out cross-validation.
         </description>
         <examples>
            <example>krr_regression_ex.cpp.html</example>
            <example>krr_classification_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>rr_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/rr_trainer_abstract.h</spec_file>
         <description>
            <p>
               Performs linear ridge regression and outputs a <a href="#decision_function">decision_function</a> that 
               represents the learned function.  In particular, this object can only be used with
               the <a href="#linear_kernel">linear_kernel</a>.  It is optimized for the linear case where
               the number of features in each sample vector is small (i.e. on the order of 1000 or less since the 
               algorithm is cubic in the number of features.).  
               If you want to use a nonlinear kernel then you should use the <a href="#krr_trainer">krr_trainer</a>.
            </p>
              This object is capable of automatically estimating its regularization parameter using 
              leave-one-out cross-validation.  
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>svr_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svr_trainer_abstract.h</spec_file>
         <description>
            <p>
                This object implements a trainer for performing epsilon-insensitive support 
                vector regression.  It is implemented using the <a href="optimization.html#solve_qp3_using_smo">SMO</a> algorithm.
            </p>
                The implementation of the eps-SVR training algorithm used by this object is based
                on the following paper:
               <ul>
                  <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>svr_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>svm_nu_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_nu_trainer_abstract.h</spec_file>
         <description>
            <p>
               Trains a nu support vector machine for solving binary classification problems and 
               outputs a <a href="#decision_function">decision_function</a>. 
               It is implemented using the <a href="optimization.html#solve_qp2_using_smo">SMO</a> algorithm.
            </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>
            <example>model_selection_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>svm_one_class_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_one_class_trainer_abstract.h</spec_file>
         <description>
            <p>
               Trains a one-class support vector classifier and outputs a <a href="#decision_function">decision_function</a>. 
               It is implemented using the <a href="optimization.html#solve_qp3_using_smo">SMO</a> algorithm.
            </p>
               The implementation of the one-class training algorithm used by this library is based
               on the following paper:
               <ul>
                  <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>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <component>
         <name>svm_c_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_c_trainer_abstract.h</spec_file>
         <description>
            <p>
               Trains a C support vector machine for solving binary classification problems 
               and outputs a <a href="#decision_function">decision_function</a>. 
               It is implemented using the <a href="optimization.html#solve_qp3_using_smo">SMO</a> algorithm.
            </p>
               The implementation of the C-SVM training algorithm used by this library is based
               on the following paper:
               <ul>
                  <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>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <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 to solve binary classification problems. 
                It is optimized for the case where linear kernels are used and  
                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
                      by  Vojtech Franc, Soren Sonnenburg; Journal of Machine Learning 
                      Research, 10(Oct):2157--2192, 2009. 
                </blockquote>
         </description>
         <examples>
            <example>svm_sparse_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->

      <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 for solving binary classification problems.   
                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
                capable of learning from very large datasets.

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

      <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
                kernel-based learning-machines.  It returns an 
                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>probabilistic_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
                any kind of binary classifier.  It returns an 
                estimate of the probability that a given sample is in the +1 class. 
         </description>
      </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 
                represents to points in input space as well as other points
                represented by distance_functions.
         </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 classification or regression function that was 
                learned by a kernel based learning algorithm.  Therefore, it is a function 
                object that takes a sample object and returns a scalar value.
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>one_vs_one_decision_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/one_vs_one_decision_function_abstract.h</spec_file>
         <description>
                This object represents a multiclass classifier built out
                of a set of binary classifiers.  Each binary classifier
                is used to vote for the correct multiclass label using a 
                one vs. one strategy.  Therefore, if you have N classes then
                there will be N*(N-1)/2 binary classifiers inside this object.
         </description>
         <examples>
            <example>multiclass_classification_ex.cpp.html</example>
            <example>custom_trainer_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>one_vs_one_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/one_vs_one_trainer_abstract.h</spec_file>
         <description>
                This object is a tool for turning a bunch of binary classifiers
                into a multiclass classifier.  It does this by training the binary
                classifiers in a one vs. one fashion.  That is, if you have N possible
                classes then it trains N*(N-1)/2 binary classifiers which are then used
                to vote on the identity of a test sample.
         </description>
         <examples>
            <example>multiclass_classification_ex.cpp.html</example>
            <example>custom_trainer_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>one_vs_all_decision_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/one_vs_all_decision_function_abstract.h</spec_file>
         <description>
                This object represents a multiclass classifier built out
                of a set of binary classifiers.  Each binary classifier
                is used to vote for the correct multiclass label using a 
                one vs. all strategy.  Therefore, if you have N classes then
                there will be N binary classifiers inside this object.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>multiclass_linear_decision_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/function_abstract.h</spec_file>
         <description>
                This object represents a multiclass classifier built out of a set of 
                binary classifiers.  Each binary classifier is used to vote for the 
                correct multiclass label using a one vs. all strategy.  Therefore, 
                if you have N classes then there will be N binary classifiers inside 
                this object.  Additionally, this object is linear in the sense that
                each of these binary classifiers is a simple linear plane.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>one_vs_all_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/one_vs_all_trainer_abstract.h</spec_file>
         <description>
                This object is a tool for turning a bunch of binary classifiers
                into a multiclass classifier.  It does this by training the binary
                classifiers in a one vs. all fashion.  That is, if you have N possible
                classes then it trains N binary classifiers which are then used
                to vote on the identity of a test sample.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>svm_multiclass_linear_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/svm_multiclass_linear_trainer_abstract.h</spec_file>
         <description>
                This object represents a tool for training a multiclass support 
                vector machine.  It is optimized for the case where linear kernels 
                are used and implemented using the <a href="optimization.html#structural_svm_problem">structural_svm_problem</a>
                object.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <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 
               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>.
         </description>
         <examples>
            <example>linear_manifold_regularizer_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <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>
      
      
   <!-- ************************************************************************* -->
      
      <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>
         <examples>
            <example>svm_sparse_ex.cpp.html</example>
         </examples>
                                 
      </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>
      
      
   <!-- ************************************************************************* -->
      
      <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>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>is_learning_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 learning problem.  In this case it just means
             that the two vectors have the same length and aren't empty.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>select_all_distinct_labels</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/multiclass_tools_abstract.h</spec_file>
         <description>
              This is a function which determines all distinct values present in a 
              std::vector and returns the result.  
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <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>
      
   <!-- ************************************************************************* -->

      <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. 
         </description>
         <examples>
            <example>rank_features_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <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.  Also, some LIBSVM formatted files number
            their features beginning with 1 rather than 0.  If this bothers you, then you
            can fix it by using the <a href="#fix_nonzero_indexing">fix_nonzero_indexing</a> function
            on the data after it is loaded.
         </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>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>fix_nonzero_indexing</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 makes sure they are zero-indexed (e.g. makes sure the first index value is zero).   
         </description>
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>find_gamma_with_big_centroid_gap</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/feature_ranking_abstract.h</spec_file>
         <description>
            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.
         </description>
         <examples>
            <example>rank_features_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <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>
      
   <!-- ************************************************************************* -->
      
      <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>
         <examples>
            <example>svm_pegasos_ex.cpp.html</example>
         </examples>
                                 
      </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>
         <examples>
            <example>svm_pegasos_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <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>
      
   <!-- ************************************************************************* -->
      
      <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>
         <name>null_trainer_type</name>
         <file>dlib/svm.h</file>
         <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>
         <description>
            This is a convenience function for creating 
            <a href="#null_trainer_type">null_trainer_type</a>
            objects.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <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>
      
   <!-- ************************************************************************* -->
      
      <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 
               basis vectors.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <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>
      
   <!-- ************************************************************************* -->

      <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 
               basis vectors.  
               </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.  The gradient based optimization is
               implemented using the <a href="#approximate_distance_function">approximate_distance_function</a> routine.
               </p>
         </description>
         <examples>
            <example>svm_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>approximate_distance_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/reduced_abstract.h</spec_file>
         <description>
              This function attempts to find a <a href="#distance_function">distance_function</a> object which is close
              to a target distance_function.  That is, it searches for an X such that target(X) is
              minimized.  Critically, X may be set to use fewer basis vectors than the target.   

              <p>The optimization begins with an initial guess supplied by the user 
              and searches for an X which locally minimizes target(X).  Since
              this problem can have many local minima the quality of the starting point
              can significantly influence the results.   </p>
         </description>
                                 
      </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>test_multiclass_decision_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/cross_validate_multiclass_trainer_abstract.h</spec_file>
         <description>
            Tests a multiclass decision function (e.g. <a href="#one_vs_one_decision_function">one_vs_one_decision_function</a>)
            and returns a confusion matrix describing the results.
         </description>
         <examples>
            <example>multiclass_classification_ex.cpp.html</example>
            <example>custom_trainer_ex.cpp.html</example>
         </examples>
                                 
      </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 binary classification 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 binary classification 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>
            <example>model_selection_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>cross_validate_multiclass_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/cross_validate_multiclass_trainer_abstract.h</spec_file>
         <description>
            Performs k-fold cross validation on a user supplied multiclass classification trainer object such
            as the <a href="#one_vs_one_trainer">one_vs_one_trainer</a>.  The result is described by a 
            confusion matrix.
         </description>
         <examples>
            <example>multiclass_classification_ex.cpp.html</example>
            <example>custom_trainer_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>cross_validate_regression_trainer</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/cross_validate_regression_trainer_abstract.h</spec_file>
         <description>
            Performs k-fold cross validation on a user supplied regression trainer object such
            as the <a href="#svr_trainer">svr_trainer</a> and returns the mean squared error.
         </description>
         <examples>
            <example>svr_ex.cpp.html</example>
         </examples>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>test_regression_function</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/cross_validate_regression_trainer_abstract.h</spec_file>
         <description>
            Tests a regression function (e.g. <a href="#decision_function">decision_function</a>)
            and returns the mean squared error.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>structural_svm_problem</name>
         <file>dlib/svm.h</file>
         <spec_file link="true">dlib/svm/structural_svm_problem_abstract.h</spec_file>
         <description>
                This object, when used with the <a href="optimization.html#oca">oca</a> optimizer, is a tool 
                for solving the optimization problem associated 
                with a structural support vector machine.  A structural SVM is a supervised 
                machine learning method for learning to predict complex outputs.  This is
                contrasted with a binary classifier which makes only simple yes/no predictions.  
                A structural SVM, on the other hand, can learn to predict outputs as complex
                as entire parse trees.  To do this, it learns a function F(x,y) which measures 
                how well a particular data sample x matches a label y.  When used for prediction,
                the best label for a new x is given by the y which maximizes F(x,y).   

               <p>
                  If you want to see example code that uses this object then take a look at
                  the implementation of the 
                  <a href="dlib/svm/svm_multiclass_linear_trainer.h.html">svm_multiclass_linear_trainer</a>
                  object.
               </p>

                <br/>

                For an introduction to structured support vector machines you should consult 
                the following paper: 
                <blockquote>
                    Predicting Structured Objects with Support Vector Machines by 
                    By Thorsten Joachims, Thomas Hofmann, Yisong Yue, and Chun-nam Yu
                </blockquote>

                For a more detailed discussion of the particular algorithm implemented by this
                object see the following paper:  
                <blockquote>
                    T. Joachims, T. Finley, Chun-Nam Yu, Cutting-Plane Training of Structural SVMs, 
                    Machine Learning, 77(1):27-59, 2009.
                </blockquote>

                    Note that this object is essentially a tool for solving the 1-Slack structural
                    SVM with margin-rescaling.  Specifically, see Algorithm 3 in the above referenced 
                    paper.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>structural_svm_problem_threaded</name>
         <file>dlib/svm_threaded.h</file>
         <spec_file link="true">dlib/svm/structural_svm_problem_threaded_abstract.h</spec_file>
         <description>
            This is just a version of the <a href="#structural_svm_problem">structural_svm_problem</a> 
            which is capable of using multiple cores/threads at a time.  You should use it if
            you have a multi-core CPU and the separation oracle takes a long time to compute.
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>svm_struct_controller_node</name>
         <file>dlib/svm_threaded.h</file>
         <spec_file link="true">dlib/svm/structural_svm_distributed_abstract.h</spec_file>
         <description>
            This object is a tool for distributing the work involved in solving a 
            <a href="#structural_svm_problem">structural_svm_problem</a> across many computers.  
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
      <component>
         <name>svm_struct_processing_node</name>
         <file>dlib/svm_threaded.h</file>
         <spec_file link="true">dlib/svm/structural_svm_distributed_abstract.h</spec_file>
         <description>
            This object is a tool for distributing the work involved in solving a 
            <a href="#structural_svm_problem">structural_svm_problem</a> across many computers.  
         </description>
                                 
      </component>
      
   <!-- ************************************************************************* -->
      
   </components>

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


</doc>


