LinearByteKernel.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 _LINEARBYTEKERNEL_H___
00012 #define _LINEARBYTEKERNEL_H___
00013 
00014 #include "lib/common.h"
00015 #include "kernel/SimpleKernel.h"
00016 #include "features/ByteFeatures.h"
00017 
00023 class CLinearByteKernel: public CSimpleKernel<uint8_t>
00024 {
00025     public:
00028         CLinearByteKernel();
00029 
00035         CLinearByteKernel(CByteFeatures* l, CByteFeatures *r);
00036 
00037         virtual ~CLinearByteKernel();
00038 
00045         virtual bool init(CFeatures* l, CFeatures* r);
00046 
00048         virtual void cleanup();
00049 
00055         virtual bool load_init(FILE* src);
00056 
00062         virtual bool save_init(FILE* dest);
00063 
00068         virtual EKernelType get_kernel_type() { return K_LINEAR; }
00069 
00074         virtual const char* get_name() { return "Linear"; }
00075 
00084         virtual bool init_optimization(
00085             int32_t num_suppvec, int32_t* sv_idx, float64_t* alphas);
00086 
00091         virtual bool delete_optimization();
00092 
00098         virtual float64_t compute_optimized(int32_t idx);
00099 
00101         virtual void clear_normal();
00102 
00108         virtual void add_to_normal(int32_t idx, float64_t weight);
00109 
00110     protected:
00119         virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00120 
00121     protected:
00123         float64_t* normal;
00124 };
00125 
00126 #endif /* _LINEARBYTEKERNEL_H__ */

SHOGUN Machine Learning Toolbox - Documentation