Mercurial > hg > camir-aes2014
comparison toolboxes/SVM-light/src/kernel.h @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 /************************************************************************/ | |
2 /* */ | |
3 /* kernel.h */ | |
4 /* */ | |
5 /* User defined kernel function. Feel free to plug in your own. */ | |
6 /* */ | |
7 /* Copyright: Thorsten Joachims */ | |
8 /* Date: 16.12.97 */ | |
9 /* */ | |
10 /************************************************************************/ | |
11 | |
12 /* KERNEL_PARM is defined in svm_common.h The field 'custom' is reserved for */ | |
13 /* parameters of the user defined kernel. You can also access and use */ | |
14 /* the parameters of the other kernels. Just replace the line | |
15 return((double)(1.0)); | |
16 with your own kernel. */ | |
17 | |
18 /* Example: The following computes the polynomial kernel. sprod_ss | |
19 computes the inner product between two sparse vectors. | |
20 | |
21 return((CFLOAT)pow(kernel_parm->coef_lin*sprod_ss(a->words,b->words) | |
22 +kernel_parm->coef_const,(double)kernel_parm->poly_degree)); | |
23 */ | |
24 | |
25 /* If you are implementing a kernel that is not based on a | |
26 feature/value representation, you might want to make use of the | |
27 field "userdefined" in SVECTOR. By default, this field will contain | |
28 whatever string you put behind a # sign in the example file. So, if | |
29 a line in your training file looks like | |
30 | |
31 -1 1:3 5:6 #abcdefg | |
32 | |
33 then the SVECTOR field "words" will contain the vector 1:3 5:6, and | |
34 "userdefined" will contain the string "abcdefg". */ | |
35 | |
36 double custom_kernel(KERNEL_PARM *kernel_parm, SVECTOR *a, SVECTOR *b) | |
37 /* plug in you favorite kernel */ | |
38 { | |
39 return((double)(1.0)); | |
40 } |