16 #ifdef HAVE_STD_UNORDERED_MAP 
   17     #include <unordered_map> 
   20     #include <tr1/unordered_map> 
   45 void CFactorGraphModel::init()
 
   60     REQUIRE(ftype->
get_w_dim() > 0, 
"%s::add_factor_type(): number of parameters can't be 0!\n",
 
   71             SG_PRINT(
"%s::add_factor_type(): factor_type (id = %d) has been added!\n",
 
   83     for (int32_t mi = 0; mi < w_map_cp.
size(); mi++)
 
  129     for (int32_t mi = 0; mi < w_map_cp.
size(); mi++)
 
  131         if (w_map_cp[mi] == ftype_id)
 
  193         for (int32_t wi = 0; wi < w_dim; wi++)
 
  225         for (int32_t wi = 0; wi < w_dim; wi++)
 
  226             fw[wi] = m_w_cache[fw_map[wi]];
 
  232     ASSERT(offset == m_w_cache.size());
 
  261         int32_t dat_size = dat.
size();
 
  266         for (int32_t di = 0; di < dat_size; di++)
 
  267             psi[w_map[ei*dat_size + di]] += dat[di];
 
  302         SG_SPRINT(
"\n------ example %d\n", feat_idx);
 
  310         SG_SPRINT(
"energy table before loss-aug:\n");
 
  328     ret->
score = energy_gt;
 
  337             SG_SPRINT(
"energy table after loss-aug:\n");
 
  352     ret->
score -= l_energy_pred;
 
  367         SG_SPRINT(
"dot_pred = %f, energy_pred = %f, delta = %f\n\n", dot_pred, l_energy_pred, ret->
delta);
 
  370         states_gt.display_vector(
"state_gt");
 
  372         SG_SPRINT(
"dot_truth = %f, energy_gt = %f\n\n", dot_truth, energy_gt);
 
  393     for (int32_t si = 0; si < s_pred.
size(); si++)
 
  395         if (s_pred[si] != s_truth[si])
 
  437                 if (card.
size() == 2 &&  card[0] == 2 && card[1] == 2)
 
  439                     REQUIRE(w_dim == 4, 
"GraphCut doesn't support edge features currently.");
 
SGVector< float64_t > psi_truth
 
Class CFactorType defines the way of factor parameterization. 
 
SGVector< int32_t > get_params_mapping(const int32_t ftype_id)
 
SGVector< int32_t > get_global_params_mapping() const 
 
Base class of the labels used in Structured Output (SO) problems. 
 
float64_t evaluate_energy(const SGVector< int32_t > state) const 
 
static void fill_vector(T *vec, int32_t len, T value)
 
SGVector< int32_t > get_data() const 
 
SGVector< float64_t > fparams_to_w()
 
CTableFactorType * get_factor_type() const 
 
bool is_tree_graph() const 
 
static const float64_t INFTY
infinity 
 
const SGVector< int32_t > get_variables() const 
 
SGVector< float64_t > get_loss_weights() const 
 
bool equals(SGVector< T > &other)
 
virtual SGVector< float64_t > get_w()
 
CDynamicObjectArray * m_factor_types
 
void add_factor_type(CFactorType *ftype)
 
CDynamicObjectArray * get_factors() const 
 
std::tr1::unordered_map< int32_t, int32_t > factor_counts_type
 
SGVector< float64_t > get_data() const 
 
CFactorGraph * get_sample(index_t idx)
 
virtual int32_t get_dim() const 
 
virtual SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, CStructuredData *y)
 
int32_t get_num_elements() const 
 
void scale(T alpha)
Scale vector inplace. 
 
virtual int32_t get_type_id() const 
 
void display_vector(const char *name="vector", const char *prefix="") const 
 
void set_w(SGVector< float64_t > w)
 
void w_to_fparams(SGVector< float64_t > w)
 
virtual const char * get_name() const 
 
Class SGObject is the base class of all shogun objects. 
 
virtual void init_training()
 
Class CFactorGraphObservation is used as the structured output. 
 
CDynamicObjectArray * get_factor_types() const 
 
static CFactorGraphFeatures * obtain_from_generic(CFeatures *base_feats)
 
CFactorGraphFeatures maintains an array of factor graphs, each graph is a sample, i...
 
virtual CResultSet * argmax(SGVector< float64_t > w, int32_t feat_idx, bool const training=true)
 
Dynamic array class for CSGObject pointers that creates an array that can be used like a list or an a...
 
static CFactorGraphObservation * obtain_from_generic(CStructuredData *base_data)
 
static float64_t dot(const bool *v1, const bool *v2, int32_t n)
Compute dot product between v1 and v2 (blas optimized) 
 
SGVector< float64_t > evaluate_energies() const 
 
Class CMAPInference performs MAP inference on a factor graph. Briefly, given a factor graph model...
 
Class CStructuredModel that represents the application specific model and contains most of the applic...
 
CStructuredLabels * m_labels
 
all of classes and functions are contained in the shogun namespace 
 
virtual int32_t get_w_dim() const 
 
void del_factor_type(const int32_t ftype_id)
 
Class CFactorGraph a factor graph is a structured input in general. 
 
The class Features is the base class of all feature objects. 
 
SGVector< int32_t > m_w_map
 
Class CTableFactorType the way that store assignments of variables and energies in a table or a multi...
 
void connect_components()
 
SGVector< T > clone() const 
 
virtual const SGVector< int32_t > get_cardinalities() const 
 
virtual CStructuredData * get_label(int32_t idx)
 
SGVector< float64_t > psi_pred
 
CSGObject * get_element(int32_t index) const 
 
virtual float64_t delta_loss(CStructuredData *y1, CStructuredData *y2)
 
SGVector< float64_t > m_w_cache
 
void resize_vector(int32_t n)
 
void push_back(CSGObject *e)
 
virtual void loss_augmentation(CFactorGraphObservation *gt)
 
bool delete_element(int32_t idx)
 
CFactorGraphObservation * get_structured_outputs() const 
 
int32_t index_from_universe_assignment(const SGVector< int32_t > assig, const SGVector< int32_t > var_index) const 
 
virtual void init_primal_opt(float64_t regularization, SGMatrix< float64_t > &A, SGVector< float64_t > a, SGMatrix< float64_t > B, SGVector< float64_t > &b, SGVector< float64_t > &lb, SGVector< float64_t > &ub, SGMatrix< float64_t > &C)
 
static SGMatrix< T > create_identity_matrix(index_t size, T scale)
 
SGVector< index_t > find(T elem)
 
Class CFactor A factor is defined on a clique in the factor graph. Each factor can have its own data...
 
Base class of the components of StructuredLabels. 
 
CFactorType * get_factor_type(const int32_t ftype_id) const 
 
virtual int32_t get_num_assignments() const