SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CustomMahalanobisDistance.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) 2013 Fernando J. Iglesias Garcia
00008  * Copyright (C) 2013 Fernando J. Iglesias Garcia
00009  */
00010 
00011 #ifndef CUSTOM_MAHALANOBIS_DISTANCE_
00012 #define CUSTOM_MAHALANOBIS_DISTANCE_
00013 
00014 #ifdef HAVE_EIGEN3
00015 
00016 #include <shogun/distance/RealDistance.h>
00017 #include <shogun/features/DenseFeatures.h>
00018 #include <shogun/lib/SGMatrix.h>
00019 
00020 namespace shogun
00021 {
00022 
00030 class CCustomMahalanobisDistance : public CRealDistance
00031 {
00032     public:
00034         CCustomMahalanobisDistance();
00035 
00042         CCustomMahalanobisDistance(CFeatures* l, CFeatures* r, SGMatrix<float64_t> m);
00043 
00045         virtual ~CCustomMahalanobisDistance();
00046 
00048         virtual void cleanup();
00049 
00051         virtual const char* get_name() const;
00052 
00057         virtual EDistanceType get_distance_type();
00058 
00059     protected:
00069         virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00070 
00071     private:
00073         void register_params();
00074 
00075     private:
00077         SGMatrix<float64_t> m_mahalanobis_matrix;
00078 
00079 }; /* class CCustomMahalanobisDistance */
00080 
00081 } /* namespace shogun */
00082 
00083 #endif /* HAVE_EIGEN3 */
00084 
00085 #endif /* CUSTOM_MAHALANOBIS_DISTANCE_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation