SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 {
29 {
30 public:
33 
41  int32_t dim);
42 
44  virtual ~CHashedMultilabelModel();
45 
47  virtual CStructuredLabels * structured_labels_factory(int32_t num_examples = 0);
48 
52  virtual int32_t get_dim() const;
53 
65  virtual SGVector<float64_t> get_joint_feature_vector(int32_t feat_idx,
66  CStructuredData * y);
67 
80  CStructuredData * y);
81 
96  virtual CResultSet * argmax(SGVector<float64_t> w, int32_t feat_idx,
97  bool const training = true);
98 
111 
117  virtual void set_misclass_cost(float64_t false_positive,
118  float64_t false_negative);
119 
131  virtual void init_primal_opt(
132  float64_t regularization,
140 
145  virtual void set_seeds(SGVector<uint32_t> seeds);
146 
148  virtual const char * get_name() const
149  {
150  return "HashedMultilabelModel";
151  }
152 
153 private:
154  float64_t m_false_positive;
155  float64_t m_false_negative;
156  int32_t m_num_classes;
157  int32_t m_dim;
158  SGVector<uint32_t> m_seeds;
159 
160 private:
161  void init(int32_t dim);
162 
166 
176  SGSparseVector<float64_t> get_hashed_feature_vector(int32_t feat_idx,
177  uint32_t seed);
178 
184  SGVector<int32_t> to_sparse(SGVector<float64_t> dense_vector,
185  float64_t d_true, float64_t d_false);
186 
187 };
189 }
191 #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...
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
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