SHOGUN
v2.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
machine
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
>
16
#include <
shogun/distance/Distance.h
>
17
#include <
shogun/labels/Labels.h
>
18
#include <
shogun/labels/RegressionLabels.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
:
38
CDistanceMachine
();
39
virtual
~CDistanceMachine
();
40
45
inline
void
set_distance
(
CDistance
* d)
46
{
47
SG_UNREF
(
distance
);
48
SG_REF
(d);
49
distance
=d;
50
}
51
56
inline
CDistance
*
get_distance
() {
SG_REF
(
distance
);
return
distance
; }
57
67
void
distances_lhs
(
float64_t
* result,int32_t idx_a1,int32_t idx_a2,int32_t idx_b);
68
78
void
distances_rhs
(
float64_t
* result,int32_t idx_b1,int32_t idx_b2,int32_t idx_a);
79
85
virtual
const
char
*
get_name
()
const
{
return
"DistanceMachine"
; }
86
94
virtual
CMulticlassLabels
*
apply_multiclass
(
CFeatures
* data=NULL);
95
103
virtual
float64_t
apply_one
(int32_t num);
104
105
protected
:
115
virtual
void
store_model_features
()
116
{
117
SG_ERROR
(
"store_model_features not yet implemented for %s!\n"
,
118
get_name
());
119
}
120
126
static
void
*
run_distance_thread_lhs
(
void
* p);
127
133
static
void
*
run_distance_thread_rhs
(
void
* p);
134
135
private
:
136
void
init();
137
138
protected
:
140
CDistance
*
distance
;
141
};
142
}
143
#endif
SHOGUN
Machine Learning Toolbox - Documentation