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-2009 Soeren Sonnenburg 00008 * Copyright (C) 1999-2009 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/SimpleFeatures.h" 00017 00018 namespace shogun 00019 { 00028 class CLinearByteKernel: public CSimpleKernel<uint8_t> 00029 { 00030 public: 00033 CLinearByteKernel(); 00034 00040 CLinearByteKernel(CSimpleFeatures<uint8_t>* l, CSimpleFeatures<uint8_t> *r); 00041 00042 virtual ~CLinearByteKernel(); 00043 00050 virtual bool init(CFeatures* l, CFeatures* r); 00051 00053 virtual void cleanup(); 00054 00059 virtual EKernelType get_kernel_type() { return K_LINEAR; } 00060 00065 virtual const char* get_name() const { return "Linear"; } 00066 00075 virtual bool init_optimization( 00076 int32_t num_suppvec, int32_t* sv_idx, float64_t* alphas); 00077 00082 virtual bool delete_optimization(); 00083 00089 virtual float64_t compute_optimized(int32_t idx); 00090 00092 virtual void clear_normal(); 00093 00099 virtual void add_to_normal(int32_t idx, float64_t weight); 00100 00101 protected: 00110 virtual float64_t compute(int32_t idx_a, int32_t idx_b); 00111 00112 protected: 00114 float64_t* normal; 00115 }; 00116 } 00117 #endif /* _LINEARBYTEKERNEL_H__ */