DistanceKernel.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) 2007 Christian Gehl
00008  * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #include "lib/config.h"
00012 
00013 
00014 #ifndef _DISTANCEKERNEL_H___
00015 #define _DISTANCEKERNEL_H___
00016 
00017 #include "lib/common.h"
00018 #include "kernel/Kernel.h"
00019 #include "distance/Distance.h"
00020 
00027 class CDistanceKernel: public CKernel
00028 {
00029     public:
00036         CDistanceKernel(INT cache, DREAL width, CDistance* dist);
00037 
00045         CDistanceKernel(CFeatures *l, CFeatures *r, DREAL width, CDistance* dist);
00046 
00047         virtual ~CDistanceKernel();
00048 
00055         virtual bool init(CFeatures* l, CFeatures* r);
00056 
00061         inline virtual EKernelType get_kernel_type() { return K_DISTANCE; }
00066         inline virtual EFeatureType get_feature_type() { return distance->get_feature_type(); }
00067 
00072         inline virtual EFeatureClass get_feature_class() { return distance->get_feature_class(); }
00073 
00078         inline virtual const CHAR* get_name() { return distance->get_name(); }
00079 
00085         bool load_init(FILE* src);
00086 
00092         bool save_init(FILE* dest);
00093 
00094     protected:
00103         DREAL compute(INT idx_a, INT idx_b);
00104 
00105     private:
00107         CDistance* distance;
00109         DREAL width;
00110 };
00111 
00112 #endif /* _DISTANCEKERNEL_H__ */
00113 

SHOGUN Machine Learning Toolbox - Documentation