Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _MULTICLASS_MODEL__H__
00012 #define _MULTICLASS_MODEL__H__
00013
00014 #include <shogun/structure/StructuredModel.h>
00015
00016 namespace shogun
00017 {
00018
00024 class CMulticlassModel : public CStructuredModel
00025 {
00026
00027 public:
00029 CMulticlassModel();
00030
00036 CMulticlassModel(CFeatures* features, CStructuredLabels* labels);
00037
00039 virtual ~CMulticlassModel();
00040
00045 virtual int32_t get_dim() const;
00046
00059 virtual SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, CStructuredData* y);
00060
00074 virtual CResultSet* argmax(SGVector< float64_t > w, int32_t feat_idx, bool const training = true);
00075
00083 virtual float64_t delta_loss(CStructuredData* y1, CStructuredData* y2);
00084
00095 virtual void init_opt(
00096 SGMatrix< float64_t > & A, SGVector< float64_t > a,
00097 SGMatrix< float64_t > B, SGVector< float64_t > & b,
00098 SGVector< float64_t > lb, SGVector< float64_t > ub,
00099 SGMatrix < float64_t > & C);
00100
00102 virtual const char* get_name() const { return "MulticlassModel"; }
00103
00133 virtual float64_t risk(float64_t* subgrad, float64_t* W, TMultipleCPinfo* info=0);
00134
00135 private:
00136 void init();
00137
00139 float64_t delta_loss(float64_t y1, float64_t y2);
00140 float64_t delta_loss(int32_t y1_idx, float64_t y2);
00141
00142 private:
00144 int32_t m_num_classes;
00145
00146 };
00147
00148 }
00149
00150 #endif