MulticlassModel.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 2012 Fernando José Iglesias García
00008  * Copyright (C) 2012 Fernando José Iglesias García
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 }; /* MulticlassModel */
00147 
00148 } /* namespace shogun */
00149 
00150 #endif /* _MULTICLASS_MODEL__H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation