KernelDistance.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) 2010 Christian Widmer
00008  * Copyright (C) 2010 Max-Planck-Society
00009  */
00010 
00011 #include <shogun/lib/config.h>
00012 
00013 
00014 #ifndef _KERNELDISTANCE_H___
00015 #define _KERNELDISTANCE_H___
00016 
00017 #include <shogun/lib/common.h>
00018 #include <shogun/distance/Distance.h>
00019 #include <shogun/kernel/Kernel.h>
00020 
00021 namespace shogun
00022 {
00023     class CDistance;
00024 
00033 class CKernelDistance: public CDistance
00034 {
00035     public:
00037         CKernelDistance();
00038 
00044         CKernelDistance(float64_t width, CKernel* k);
00045 
00053         CKernelDistance(
00054             CFeatures *l, CFeatures *r, float64_t width, CKernel* k);
00055 
00057         virtual ~CKernelDistance();
00058 
00065         virtual bool init(CFeatures* l, CFeatures* r);
00066 
00071         inline virtual EDistanceType get_distance_type() { return D_UNKNOWN; }
00076         inline virtual EFeatureType get_feature_type() { return kernel->get_feature_type(); }
00077 
00082         inline virtual EFeatureClass get_feature_class() { return kernel->get_feature_class(); }
00083 
00088         inline virtual const char* get_name() const { return "KernelDistance"; }
00089 
00093         inline virtual void cleanup() { return kernel->cleanup(); }
00094 
00095     protected:
00104         float64_t compute(int32_t idx_a, int32_t idx_b);
00105 
00106     private:
00107         void init();
00108 
00109     private:
00111         CKernel* kernel;
00113         float64_t width;
00114 };
00115 }
00116 #endif /* _KERNELDISTANCE_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation