SHOGUN  3.2.1
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
HierarchicalMultilabelModel.h
浏览该文件的文档.
1 /*
2  * This software is distributed under BSD 3-clause license (see LICENSE file).
3  *
4  * Copyright(C) 2014 Abinash Panda
5  * Copyright(C) 2014 Thoralf Klein
6  * Written(W) 2014 Abinash Panda
7  */
8 
9 #ifndef _HIERARCHICAL_MULTILABEL_MODEL__H__
10 #define _HIERARCHICAL_MULTILABEL_MODEL__H__
11 
12 #include <shogun/lib/config.h>
14 
15 namespace shogun
16 {
17 
30 {
31 public:
34 
48  SGVector<int32_t> taxonomy, bool leaf_nodes_mandatory = false);
49 
52 
54  virtual CStructuredLabels * structured_labels_factory(int32_t num_labels = 0);
55 
59  virtual int32_t get_dim() const;
60 
72  virtual SGVector<float64_t> get_joint_feature_vector(int32_t feat_idx,
73  CStructuredData * y);
74 
84  virtual CResultSet * argmax(SGVector<float64_t> w, int32_t feat_idx,
85  bool const training = true);
86 
95 
107  virtual void init_primal_opt(
108  float64_t regularization,
116 
118  virtual const char * get_name() const
119  {
120  return "HierarchicalMultilabelModel";
121  }
122 
123 private:
124  int32_t m_num_classes;
125  SGVector<int32_t> m_taxonomy;
126  bool m_leaf_nodes_mandatory;
127  int32_t m_root;
128  // array for vectors storing the node-ids of the children
129  // m_children[node_id] = vector of node_ids of the children
130  // = empty vector, if node is a terminal node
131  SGVector<int32_t> * m_children;
132 
133 private:
134  void init(SGVector<int32_t> taxonomy, bool leaf_nodes_mandatory);
135 
138  float64_t delta_loss(int32_t y1, int32_t y2);
139 
146  SGVector<int32_t> get_label_vector(SGVector<int32_t> sparse_label);
147 
148 }; /* class CHierarchicalMultilabelModel */
149 
150 } /* namespace shogun */
151 
152 #endif /* _HIERARCHICAL_MULTILABEL_MODEL__H__ */
153 
154 
Base class of the labels used in Structured Output (SO) problems.
virtual CStructuredLabels * structured_labels_factory(int32_t num_labels=0)
virtual SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, CStructuredData *y)
double float64_t
Definition: common.h:50
Class CStructuredModel that represents the application specific model and contains most of the applic...
virtual CResultSet * argmax(SGVector< float64_t > w, int32_t feat_idx, bool const training=true)
virtual float64_t delta_loss(CStructuredData *y1, CStructuredData *y2)
The class Features is the base class of all feature objects.
Definition: Features.h:68
Class CHierarchicalMultilabelModel represents application specific model and contains application dep...
Base class of the components of StructuredLabels.
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)

SHOGUN 机器学习工具包 - 项目文档