SimpleLocalityImprovedStringKernel.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 Gunnar Raetsch
00008  * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef _SIMPLELOCALITYIMPROVEDSTRINGKERNEL_H___
00012 #define _SIMPLELOCALITYIMPROVEDSTRINGKERNEL_H___
00013 
00014 #include "lib/common.h"
00015 #include "kernel/StringKernel.h"
00016 
00018 class CSimpleLocalityImprovedStringKernel: public CStringKernel<CHAR>
00019 {
00020     public:
00028         CSimpleLocalityImprovedStringKernel(int size, INT length,
00029             INT inner_degree, INT outer_degree);
00030 
00039         CSimpleLocalityImprovedStringKernel(
00040             CStringFeatures<CHAR>* l, CStringFeatures<CHAR>* r,
00041             INT length, INT inner_degree, INT outer_degree);
00042 
00043         virtual ~CSimpleLocalityImprovedStringKernel();
00044 
00051         virtual bool init(CFeatures *l, CFeatures *r);
00052 
00054         virtual void cleanup();
00055 
00061         bool load_init(FILE *src);
00062 
00068         bool save_init(FILE *dest);
00069 
00074         virtual EKernelType get_kernel_type()
00075         {
00076             return K_SIMPLELOCALITYIMPROVED;
00077         }
00078 
00083         virtual const CHAR *get_name()
00084         {
00085             return "SimpleLocalityImproved";
00086         }
00087 
00088     private:
00100         DREAL dot_pyr (const CHAR* const x1, const CHAR* const x2,
00101                 const INT NOF_NTS, const INT NTWIDTH,
00102                 const INT DEGREE1, const INT DEGREE2, DREAL *pyra);
00103 
00104     protected:
00113         DREAL compute(INT idx_a, INT idx_b);
00114 
00115     protected:
00117         INT length;
00119         INT inner_degree;
00121         INT outer_degree;
00123         DREAL *pyramid_weights;
00124 };
00125 
00126 #endif /* _SIMPLELOCALITYIMPROVEDSTRINGKERNEL_H___ */

SHOGUN Machine Learning Toolbox - Documentation