SHOGUN
v3.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
labels
FactorGraphLabels.cpp
Go to the documentation of this file.
1
#include <
shogun/labels/FactorGraphLabels.h
>
2
3
using namespace
shogun;
4
5
CFactorGraphObservation::CFactorGraphObservation
(
SGVector<int32_t>
observed_state,
6
SGVector<float64_t>
loss_weights)
7
:
CStructuredData
(), m_observed_state(observed_state)
8
{
9
if
(loss_weights.
size
() == 0)
10
{
11
loss_weights.
resize_vector
(observed_state.
size
());
12
SGVector<float64_t>::fill_vector
(loss_weights.
vector
, loss_weights.
vlen
, 1.0 / observed_state.
size
());
13
}
14
15
set_loss_weights
(loss_weights);
16
}
17
18
SGVector<int32_t>
CFactorGraphObservation::get_data
()
const
19
{
20
return
m_observed_state
;
21
}
22
23
SGVector<float64_t>
CFactorGraphObservation::get_loss_weights
()
const
24
{
25
return
m_loss_weights
;
26
}
27
28
void
CFactorGraphObservation::set_loss_weights
(
SGVector<float64_t>
loss_weights)
29
{
30
REQUIRE
(loss_weights.
size
() ==
m_observed_state
.
size
(),
"%s::set_loss_weights(): \
31
loss_weights should be the same length as observed_states"
,
get_name
());
32
33
m_loss_weights
= loss_weights;
34
}
35
36
//-------------------------------------------------------------------
37
38
CFactorGraphLabels::CFactorGraphLabels
()
39
:
CStructuredLabels
()
40
{
41
}
42
43
CFactorGraphLabels::CFactorGraphLabels
(int32_t num_labels)
44
:
CStructuredLabels
(num_labels)
45
{
46
init();
47
}
48
49
CFactorGraphLabels::~CFactorGraphLabels
()
50
{
51
}
52
53
void
CFactorGraphLabels::init()
54
{
55
}
SHOGUN
Machine Learning Toolbox - Documentation