SHOGUN
v1.1.0
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
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/features/Labels.h
>
18
#include <
shogun/machine/Machine.h
>
19
20
#include <stdio.h>
21
22
namespace
shogun
23
{
24
class
CLabels;
25
class
CDistance;
26
class
CMachine;
27
32
class
CDistanceMachine
:
public
CMachine
33
{
34
public
:
36
CDistanceMachine
();
37
virtual
~CDistanceMachine
();
38
43
inline
void
set_distance
(
CDistance
* d)
44
{
45
SG_UNREF
(
distance
);
46
SG_REF
(d);
47
distance
=d;
48
}
49
54
inline
CDistance
*
get_distance
() {
SG_REF
(
distance
);
return
distance
; }
55
65
void
distances_lhs
(
float64_t
* result,int32_t idx_a1,int32_t idx_a2,int32_t idx_b);
66
76
void
distances_rhs
(
float64_t
* result,int32_t idx_b1,int32_t idx_b2,int32_t idx_a);
77
83
virtual
const
char
*
get_name
()
const
{
return
"DistanceMachine"
; }
84
91
virtual
CLabels
*
apply
();
92
100
virtual
CLabels
*
apply
(
CFeatures
* data);
101
109
virtual
float64_t
apply
(int32_t num);
110
111
protected
:
121
virtual
void
store_model_features
()
122
{
123
SG_ERROR
(
"store_model_features not yet implemented for %s!\n"
,
124
get_name
());
125
}
126
132
static
void
*
run_distance_thread_lhs
(
void
* p);
133
139
static
void
*
run_distance_thread_rhs
(
void
* p);
140
141
private
:
142
void
init();
143
144
protected
:
146
CDistance
*
distance
;
147
};
148
}
149
#endif
SHOGUN
Machine Learning Toolbox - Documentation