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 _CHI2KERNEL_H___ 00012 #define _CHI2KERNEL_H___ 00013 00014 #include "lib/common.h" 00015 #include "kernel/DotKernel.h" 00016 #include "features/Features.h" 00017 #include "features/SimpleFeatures.h" 00018 00019 namespace shogun 00020 { 00032 class CChi2Kernel: public CDotKernel 00033 { 00034 void init(void); 00035 00036 public: 00038 CChi2Kernel(void); 00039 00045 CChi2Kernel(int32_t size, float64_t width); 00046 00054 CChi2Kernel( 00055 CSimpleFeatures<float64_t>* l, CSimpleFeatures<float64_t>* r, float64_t width, int32_t size); 00056 00057 virtual ~CChi2Kernel(); 00058 00065 virtual bool init(CFeatures* l, CFeatures* r); 00066 00071 virtual EKernelType get_kernel_type() { return K_CHI2; } 00072 00077 inline virtual EFeatureClass get_feature_class() { return C_SIMPLE; } 00078 00083 virtual EFeatureType get_feature_type() { return F_DREAL; } 00084 00089 virtual const char* get_name() const { return "Chi2"; } 00090 00091 protected: 00100 virtual float64_t compute(int32_t idx_a, int32_t idx_b); 00101 00102 protected: 00104 float64_t width; 00105 }; 00106 } 00107 #endif /* _CHI2KERNEL_H__ */