SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HashedMultilabelModel.h
Go to the documentation of this file.
1 /*
2  * This software is distributed under BSD 3-clause license (see LICENSE file).
3  *
4  * Copyright(C) 2014 Abinash Panda
5  * Written(W) 2014 Abinash Panda
6  */
7 
8 #ifndef _HASHED_MULTILABEL_MODEL__H__
9 #define _HASHED_MULTILABEL_MODEL__H__
10 
11 #include <shogun/lib/config.h>
13 
14 namespace shogun
15 {
23 {
24 public:
27 
35  int32_t dim);
36 
38  virtual ~CHashedMultilabelModel();
39 
41  virtual CStructuredLabels * structured_labels_factory(int32_t num_examples = 0);
42 
46  virtual int32_t get_dim() const;
47 
59  virtual SGVector<float64_t> get_joint_feature_vector(int32_t feat_idx,
60  CStructuredData * y);
61 
74  CStructuredData * y);
75 
90  virtual CResultSet * argmax(SGVector<float64_t> w, int32_t feat_idx,
91  bool const training = true);
92 
105 
111  virtual void set_misclass_cost(float64_t false_positive,
112  float64_t false_negative);
113 
125  virtual void init_primal_opt(
126  float64_t regularization,
134 
139  virtual void set_seeds(SGVector<uint32_t> seeds);
140 
142  virtual const char * get_name() const
143  {
144  return "HashedMultilabelModel";
145  }
146 
147 private:
148  float64_t m_false_positive;
149  float64_t m_false_negative;
150  int32_t m_num_classes;
151  int32_t m_dim;
152  SGVector<uint32_t> m_seeds;
153 
154 private:
155  void init(int32_t dim);
156 
160 
170  SGSparseVector<float64_t> get_hashed_feature_vector(int32_t feat_idx,
171  uint32_t seed);
172 
178  SGVector<int32_t> to_sparse(SGVector<float64_t> dense_vector,
179  float64_t d_true, float64_t d_false);
180 
181 };
183 }
185 #endif
virtual const char * get_name() const
Base class of the labels used in Structured Output (SO) problems.
virtual void set_seeds(SGVector< uint32_t > seeds)
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)
virtual CStructuredLabels * structured_labels_factory(int32_t num_examples=0)
virtual SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, CStructuredData *y)
virtual void set_misclass_cost(float64_t false_positive, float64_t false_negative)
double float64_t
Definition: common.h:50
Class CHashedMultilabelModel represents application specific model and contains application dependent...
virtual float64_t delta_loss(CStructuredData *y1, CStructuredData *y2)
virtual SGSparseVector< float64_t > get_sparse_joint_feature_vector(int32_t feat_idx, CStructuredData *y)
Class CStructuredModel that represents the application specific model and contains most of the applic...
The class Features is the base class of all feature objects.
Definition: Features.h:68
Base class of the components of StructuredLabels.
virtual CResultSet * argmax(SGVector< float64_t > w, int32_t feat_idx, bool const training=true)

SHOGUN Machine Learning Toolbox - Documentation