Mercurial > hg > camir-ismir2012
comparison toolboxes/SVM-light/src/kernel.h @ 0:cc4b1211e677 tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
| author | Daniel Wolff |
|---|---|
| date | Fri, 19 Aug 2016 13:07:06 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:cc4b1211e677 |
|---|---|
| 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 } |
