SHOGUN
v3.2.0
|
00001 #include <shogun/labels/FactorGraphLabels.h> 00002 00003 using namespace shogun; 00004 00005 CFactorGraphObservation::CFactorGraphObservation(SGVector<int32_t> observed_state, 00006 SGVector<float64_t> loss_weights) 00007 : CStructuredData(), m_observed_state(observed_state) 00008 { 00009 if (loss_weights.size() == 0) 00010 { 00011 loss_weights.resize_vector(observed_state.size()); 00012 SGVector<float64_t>::fill_vector(loss_weights.vector, loss_weights.vlen, 1.0 / observed_state.size()); 00013 } 00014 00015 set_loss_weights(loss_weights); 00016 } 00017 00018 SGVector<int32_t> CFactorGraphObservation::get_data() const 00019 { 00020 return m_observed_state; 00021 } 00022 00023 SGVector<float64_t> CFactorGraphObservation::get_loss_weights() const 00024 { 00025 return m_loss_weights; 00026 } 00027 00028 void CFactorGraphObservation::set_loss_weights(SGVector<float64_t> loss_weights) 00029 { 00030 REQUIRE(loss_weights.size() == m_observed_state.size(), "%s::set_loss_weights(): \ 00031 loss_weights should be the same length as observed_states", get_name()); 00032 00033 m_loss_weights = loss_weights; 00034 } 00035 00036 //------------------------------------------------------------------- 00037 00038 CFactorGraphLabels::CFactorGraphLabels() 00039 : CStructuredLabels() 00040 { 00041 } 00042 00043 CFactorGraphLabels::CFactorGraphLabels(int32_t num_labels) 00044 : CStructuredLabels(num_labels) 00045 { 00046 init(); 00047 } 00048 00049 CFactorGraphLabels::~CFactorGraphLabels() 00050 { 00051 } 00052 00053 void CFactorGraphLabels::init() 00054 { 00055 }