SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
FactorGraphLabels.cpp
Go to the documentation of this file.
2 
3 using namespace shogun;
4 
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 
19 {
20  return m_observed_state;
21 }
22 
24 {
25  return m_loss_weights;
26 }
27 
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 
40 {
41 }
42 
44 : CStructuredLabels(num_labels)
45 {
46  init();
47 }
48 
50 {
51 }
52 
53 void CFactorGraphLabels::init()
54 {
55 }
virtual const char * get_name() const
Base class of the labels used in Structured Output (SO) problems.
static void fill_vector(T *vec, int32_t len, T value)
Definition: SGVector.cpp:223
SGVector< int32_t > get_data() const
SGVector< float64_t > get_loss_weights() const
#define REQUIRE(x,...)
Definition: SGIO.h:206
SGVector< int32_t > m_observed_state
void set_loss_weights(SGVector< float64_t > loss_weights)
int32_t size() const
Definition: SGVector.h:115
index_t vlen
Definition: SGVector.h:494
SGVector< float64_t > m_loss_weights
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
void resize_vector(int32_t n)
Definition: SGVector.cpp:259
Base class of the components of StructuredLabels.

SHOGUN Machine Learning Toolbox - Documentation