LinearStringKernel.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 1999-2008 Soeren Sonnenburg
00008  * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef _LINEARSTRINGKERNEL_H___
00012 #define _LINEARSTRINGKERNEL_H___
00013 
00014 #include "lib/common.h"
00015 #include "kernel/StringKernel.h"
00016 
00024 class CLinearStringKernel: public CStringKernel<char>
00025 {
00026     public:
00029         CLinearStringKernel();
00030 
00036         CLinearStringKernel(CStringFeatures<char>* l, CStringFeatures<char>* r);
00037 
00038         virtual ~CLinearStringKernel();
00039 
00046         virtual bool init(CFeatures* l, CFeatures* r);
00047 
00049         virtual void cleanup();
00050 
00056         virtual bool load_init(FILE* src);
00057 
00063         virtual bool save_init(FILE* dest);
00064 
00069         virtual EKernelType get_kernel_type()
00070         {
00071             return K_LINEAR;
00072         }
00073 
00078         virtual const char* get_name()
00079         {
00080             return "Linear";
00081         }
00082 
00091         virtual bool init_optimization(
00092             int32_t num_suppvec, int32_t* sv_idx, float64_t* alphas);
00093 
00098         virtual bool delete_optimization();
00099 
00105         virtual float64_t compute_optimized(int32_t idx);
00106 
00108         virtual void clear_normal();
00109 
00115         virtual void add_to_normal(int32_t idx, float64_t weight);
00116 
00117     protected:
00126         virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00127 
00128     protected:
00130         float64_t* normal;
00131 };
00132 
00133 #endif /* _LINEARSTRINGKERNEL_H___ */

SHOGUN Machine Learning Toolbox - Documentation