12345678910111213141516171819202122232425262728293031323334353637 |
- #ifndef _NICE_OBJREC_GENERICKERNELSELECTION_INCLUDE
- #define _NICE_OBJREC_GENERICKERNELSELECTION_INCLUDE
- #include <vector>
- #include "KernelRBF.h"
- #include "KernelExp.h"
- namespace OBJREC {
- class GenericKernelSelection
- {
- public:
- static Kernel *selectKernel ( const NICE::Config *conf, std::string kernel_type )
- {
- Kernel *kernel = NULL;
- if ( kernel_type == "rbf" ) {
- double log_rbf_gamma = conf->gD("Kernel","log_rbf_gamma",-2.5);
- kernel = new KernelRBF (log_rbf_gamma);
- } else if ( kernel_type == "exp" ) {
- double log_rbf_gamma = conf->gD("Kernel","log_rbf_gamma",-2.5);
- double log_rbf_sv = conf->gD("Kernel","log_rbf_sv",0.0);
- kernel = new KernelExp (log_rbf_gamma, log_rbf_sv);
- } else {
- fthrow(Exception, "Kernel type " << kernel_type << " is unknown" );
- }
- return kernel;
- }
- };
- }
- #endif
|