21 register_parameters();
29 register_parameters();
36 register_parameters();
52 #ifdef USE_REFERENCE_COUNTING 54 SG_DEBUG(
"CFactorGraph::~CFactorGraph(): m_factors->ref_count() = %d.\n",
m_factors->ref_count());
57 SG_DEBUG(
"CFactorGraph::~CFactorGraph(): m_datasources->ref_count() = %d.\n",
m_datasources->ref_count());
59 SG_DEBUG(
"CFactorGraph::~CFactorGraph(): this->ref_count() = %d.\n", this->ref_count());
63 void CFactorGraph::register_parameters()
73 void CFactorGraph::init()
82 #ifdef USE_REFERENCE_COUNTING 84 SG_DEBUG(
"CFactorGraph::init(): m_factors->ref_count() = %d.\n",
m_factors->ref_count());
188 cumprod_cards[n] = num_assig;
193 for (int32_t ei = 0; ei < num_assig; ++ei)
225 for (int32_t vi = 1; vi < vars.
size(); vi++)
269 if (loss.
size() == 0)
275 int32_t num_vars = states_gt.
size();
288 for (int32_t vi = 0; vi < vars.
size(); vi++)
290 int32_t vv = vars[vi];
296 for (int32_t ei = 0; ei < energies.
size(); ei++)
302 if (states_gt[vv] == vstate)
316 int32_t min_var =
CMath::min(var_flags.vector, var_flags.vlen);
void set_energy(int32_t ei, float64_t value)
SGVector< float64_t > get_loss_weights() const
float64_t evaluate_energy(const SGVector< int32_t > state) const
void add_factor(CFactor *factor)
void add_data_source(CFactorDataSource *datasource)
SGVector< float64_t > evaluate_energies() const
int32_t state_from_index(int32_t ei, int32_t var_index) const
CSGObject * get_element(int32_t index) const
CDynamicObjectArray * get_factors() const
CDynamicObjectArray * m_datasources
bool is_tree_graph() const
int32_t get_num_edges() const
bool is_connected_graph() const
void set_cardinalities(SGVector< int32_t > cards)
Class SGObject is the base class of all shogun objects.
Class CFactorGraphObservation is used as the structured output.
Class CFactorDataSource Source for factor data. In some cases, the same data can be shared by many fa...
SGVector< int32_t > get_cardinalities() const
CDynamicObjectArray * get_factor_data_sources() const
Dynamic array class for CSGObject pointers that creates an array that can be used like a list or an a...
int32_t get_num_factors() const
Class CDisjointSet data structure for linking graph nodes It's easy to identify connected graph...
static void fill_vector(T *vec, int32_t len, T value)
int32_t get_num_elements() const
const SGVector< int32_t > get_variables() const
CDisjointSet * get_disjoint_set() const
bool is_acyclic_graph() const
float64_t evaluate_energy(const SGVector< int32_t > state) const
all of classes and functions are contained in the shogun namespace
int32_t get_num_vars() const
CDynamicObjectArray * m_factors
Class CFactorGraph a factor graph is a structured input in general.
void set_connected(bool is_connected)
Class CTableFactorType the way that store assignments of variables and energies in a table or a multi...
void connect_components()
SGVector< int32_t > get_data() const
void push_back(CSGObject *e)
virtual void loss_augmentation(CFactorGraphObservation *gt)
int32_t link_set(int32_t xroot, int32_t yroot)
void resize_vector(int32_t n)
int32_t find_set(int32_t x)
#define SG_UNSTABLE(func,...)
SGVector< int32_t > m_cardinalities
Class CFactor A factor is defined on a clique in the factor graph. Each factor can have its own data...
CTableFactorType * get_factor_type() const
SGVector< T > clone() const
SGVector< float64_t > get_energies() const