DistanceMachine.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) 2006-2009 Christian Gehl
00008  * Written (W) 2006-2009 Soeren Sonnenburg
00009  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
00010  */
00011 
00012 #ifndef _DISTANCE_MACHINE_H__
00013 #define _DISTANCE_MACHINE_H__
00014 
00015 #include "lib/common.h"
00016 #include "distance/Distance.h"
00017 #include "features/Labels.h"
00018 #include "classifier/Classifier.h"
00019 
00020 #include <stdio.h>
00021 
00022 namespace shogun
00023 {
00024     class CLabels;
00025     class CDistance;
00026     class CClassifier;
00027 
00032 class CDistanceMachine : public CClassifier
00033 {
00034     public:
00036         CDistanceMachine();
00037         virtual ~CDistanceMachine();
00038 
00043         inline void set_distance(CDistance* d)
00044         {
00045             SG_UNREF(distance);
00046             SG_REF(d);
00047             distance=d;
00048         }
00049 
00054         inline CDistance* get_distance() { SG_REF(distance); return distance; }
00055 
00065         void distances_lhs(float64_t* result,int32_t idx_a1,int32_t idx_a2,int32_t idx_b);
00066 
00076         void distances_rhs(float64_t* result,int32_t idx_b1,int32_t idx_b2,int32_t idx_a);  
00077 
00083         virtual const char* get_name(void) const {
00084             return "DistanceMachine"; }
00085 
00090         virtual CLabels* classify()=0;
00091 
00097         virtual CLabels* classify(CFeatures* data)=0;
00098 
00099     protected:
00101         CDistance* distance;
00102                 
00108         static void* run_distance_thread_lhs(void* p);
00109                 
00115         static void* run_distance_thread_rhs(void* p);
00116                 
00117 };
00118 }
00119 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation