SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
StructuredModel.h
浏览该文件的文档.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2012 Fernando José Iglesias García
8  * Copyright (C) 2012 Fernando José Iglesias García
9  */
10 
11 #ifndef _STRUCTURED_MODEL__H__
12 #define _STRUCTURED_MODEL__H__
13 
14 #include <shogun/lib/config.h>
15 
16 #include <shogun/base/SGObject.h>
19 
20 #include <shogun/lib/common.h>
21 #include <shogun/lib/SGVector.h>
22 #include <shogun/lib/SGMatrix.h>
25 
26 namespace shogun
27 {
28 
29 #define IGNORE_IN_CLASSLIST
30 
41  TMultipleCPinfo(uint32_t from, uint32_t N) : m_from(from), m_N(N) { }
43  uint32_t m_from;
45  uint32_t m_N;
46 };
47 
48 class CStructuredModel;
49 
51 struct CResultSet : public CSGObject
52 {
54  CResultSet();
55 
57  virtual ~CResultSet();
58 
60  virtual const char* get_name() const;
61 
64 
67 
70 
73 
76 
79 
82 
86 
89 };
90 
102 {
103  public:
106 
112  CStructuredModel(CFeatures* features, CStructuredLabels* labels);
113 
115  virtual ~CStructuredModel();
116 
128  virtual void init_primal_opt(
129  float64_t regularization,
134 
139  virtual int32_t get_dim() const = 0;
140 
145  void set_labels(CStructuredLabels* labs);
146 
152 
154  virtual CStructuredLabels* structured_labels_factory(int32_t num_labels=0);
155 
160  void set_features(CFeatures* feats);
161 
167 
180  SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, int32_t lab_idx);
181 
194  virtual SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, CStructuredData* y);
195 
209  int32_t lab_idx);
210 
224  CStructuredData* y);
225 
239  virtual CResultSet* argmax(SGVector< float64_t > w, int32_t feat_idx, bool const training = true) = 0;
240 
248  float64_t delta_loss(int32_t ytrue_idx, CStructuredData* ypred);
249 
258 
260  virtual const char* get_name() const { return "StructuredModel"; }
261 
266  virtual void init_training();
267 
275  virtual bool check_training_setup() const;
276 
286  virtual int32_t get_num_aux() const;
287 
297  virtual int32_t get_num_aux_con() const;
298 
299  private:
301  void init();
302 
303  protected:
306 
309 
310 }; /* class CStructuredModel */
311 
312 } /* namespace shogun */
313 
314 #endif /* _STRUCTURED_MODEL__H__ */
SGVector< float64_t > psi_truth
Base class of the labels used in Structured Output (SO) problems.
void set_labels(CStructuredLabels *labs)
virtual int32_t get_dim() const =0
SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, int32_t lab_idx)
CStructuredLabels * get_labels()
virtual int32_t get_num_aux_con() const
virtual int32_t get_num_aux() const
void set_features(CFeatures *feats)
virtual const char * get_name() const
SGSparseVector< float64_t > get_sparse_joint_feature_vector(int32_t feat_idx, int32_t lab_idx)
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:112
virtual CStructuredLabels * structured_labels_factory(int32_t num_labels=0)
double float64_t
Definition: common.h:50
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)
float64_t delta_loss(int32_t ytrue_idx, CStructuredData *ypred)
virtual bool check_training_setup() const
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
Definition: class_list.h:18
virtual CResultSet * argmax(SGVector< float64_t > w, int32_t feat_idx, bool const training=true)=0
TMultipleCPinfo(uint32_t from, uint32_t N)
The class Features is the base class of all feature objects.
Definition: Features.h:68
CStructuredData * argmax
SGVector< float64_t > psi_pred
SGSparseVector< float64_t > psi_truth_sparse
#define IGNORE_IN_CLASSLIST
virtual const char * get_name() const
SGSparseVector< float64_t > psi_pred_sparse
Base class of the components of StructuredLabels.

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