Added more meat to a comment

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402515
This commit is contained in:
Davis King 2008-09-14 16:58:51 +00:00
parent 00f7474973
commit 4d396beecb
1 changed files with 16 additions and 0 deletions

View File

@ -37,12 +37,28 @@ int main()
// results without much fiddling.
typedef radial_basis_kernel<sample_type> kernel_type;
// Here we declare an instance of the kcentroid object. The first argument to the constructor
// is the kernel we wish to use. The second is a parameter that determines the numerical
// accuracy with which the object will perform part of the learning algorithm. Generally
// smaller values give better results but cause the algorithm to run slower. You just have
// to play with it to decide what balance of speed and accuracy is right for your problem.
// Here we have set it to 0.01.
//
// Also, since we are using the radial basis kernel we have to pick the RBF width parameter.
// Here we have it set to 0.1. But in general, a reasonable way of picking this value is
// to start with some initial guess and to just run all the data through the resulting
// kcentroid. Then print out kc.dictionary_size() to see how many support vectors the
// kcentroid object is using. A good rule of thumb is that you should have somewhere
// in the range of 10-100 support vectors (but this rule isn't carved in stone).
// So if you aren't in that range then you can change the RBF parameter. Making it
// smaller will decrease the dictionary size and making it bigger will increase the
// dictionary size.
//
// So what I often do is I set the kcentroid's second parameter to 0.01 or 0.001. Then
// I find an RBF kernel parameter that gives me the number of support vectors that I
// feel is appropriate for the problem I'm trying to solve. Again, this just comes down
// to playing with it and getting a feel for how things work.
kcentroid<kernel_type> kc(kernel_type(0.1),0.01);
// Now we make an instance of the kkmeans object and tell it to use kcentroid objects