SHOGUN
v3.2.0
|
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 <shogun/lib/common.h> 00016 #include <shogun/distance/Distance.h> 00017 #include <shogun/labels/Labels.h> 00018 #include <shogun/labels/RegressionLabels.h> 00019 #include <shogun/machine/Machine.h> 00020 00021 #include <stdio.h> 00022 00023 namespace shogun 00024 { 00025 class CLabels; 00026 class CRegressionLabels; 00027 class CDistance; 00028 class CMachine; 00029 00034 class CDistanceMachine : public CMachine 00035 { 00036 public: 00038 CDistanceMachine(); 00039 00041 virtual ~CDistanceMachine(); 00042 00047 void set_distance(CDistance* d); 00048 00053 CDistance* get_distance() const; 00054 00064 void distances_lhs(float64_t* result,int32_t idx_a1,int32_t idx_a2,int32_t idx_b); 00065 00075 void distances_rhs(float64_t* result,int32_t idx_b1,int32_t idx_b2,int32_t idx_a); 00076 00082 virtual const char* get_name() const { return "DistanceMachine"; } 00083 00091 virtual CMulticlassLabels* apply_multiclass(CFeatures* data=NULL); 00092 00100 virtual float64_t apply_one(int32_t num); 00101 00102 protected: 00112 virtual void store_model_features(); 00113 00119 static void* run_distance_thread_lhs(void* p); 00120 00126 static void* run_distance_thread_rhs(void* p); 00127 00128 private: 00129 void init(); 00130 00131 protected: 00133 CDistance* distance; 00134 }; 00135 } 00136 #endif