SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DistanceMachine.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2006-2009 Christian Gehl
8  * Written (W) 2006-2009 Soeren Sonnenburg
9  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
10  */
11 
12 #ifndef _DISTANCE_MACHINE_H__
13 #define _DISTANCE_MACHINE_H__
14 
15 #include <shogun/lib/common.h>
17 #include <shogun/labels/Labels.h>
19 #include <shogun/machine/Machine.h>
20 
21 #include <stdio.h>
22 
23 namespace shogun
24 {
25  class CLabels;
26  class CRegressionLabels;
27  class CDistance;
28  class CMachine;
29 
34 class CDistanceMachine : public CMachine
35 {
36  public:
39 
41  virtual ~CDistanceMachine();
42 
47  void set_distance(CDistance* d);
48 
53  CDistance* get_distance() const;
54 
64  void distances_lhs(float64_t* result,int32_t idx_a1,int32_t idx_a2,int32_t idx_b);
65 
75  void distances_rhs(float64_t* result,int32_t idx_b1,int32_t idx_b2,int32_t idx_a);
76 
82  virtual const char* get_name() const { return "DistanceMachine"; }
83 
91  virtual CMulticlassLabels* apply_multiclass(CFeatures* data=NULL);
92 
100  virtual float64_t apply_one(int32_t num);
101 
102  protected:
112  virtual void store_model_features();
113 
119  static void* run_distance_thread_lhs(void* p);
120 
126  static void* run_distance_thread_rhs(void* p);
127 
128  private:
129  void init();
130 
131  protected:
134 };
135 }
136 #endif

SHOGUN Machine Learning Toolbox - Documentation