SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
labels
FactorGraphLabels.cpp
浏览该文件的文档.
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
机器学习工具包 - 项目文档