SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LatentModel.h
Go to the documentation of this file.
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 Viktor Gal
8  * Copyright (C) 2012 Viktor Gal
9  */
10 
11 #ifndef __LATENTMODEL_H__
12 #define __LATENTMODEL_H__
13 
14 #include <shogun/lib/config.h>
15 
20 
21 namespace shogun
22 {
33  class CLatentModel: public CSGObject
34  {
35  public:
37  CLatentModel();
38 
45  CLatentModel(CLatentFeatures* feats, CLatentLabels* labels, bool do_caching = true);
46 
48  virtual ~CLatentModel();
49 
54  virtual int32_t get_num_vectors() const;
55 
60  virtual int32_t get_dim() const=0;
61 
66  void set_labels(CLatentLabels* labs);
67 
72  CLatentLabels* get_labels() const;
73 
78  void set_features(CLatentFeatures* feats);
79 
85 
91 
100  virtual CData* infer_latent_variable(const SGVector<float64_t>& w, index_t idx)=0;
101 
107  virtual void argmax_h(const SGVector<float64_t>& w);
108 
112  void cache_psi_features();
113 
119 
124  inline bool get_caching() const
125  {
126  return m_do_caching;
127  }
128 
133  inline void set_caching(bool caching)
134  {
135  m_do_caching = caching;
136  }
137 
142  virtual const char* get_name() const { return "LatentModel"; }
143 
144  protected:
153 
154  private:
156  void register_parameters();
157  };
158 }
159 
160 #endif /* __LATENTMODEL_H__ */
161 
CDotFeatures * m_cached_psi
Definition: LatentModel.h:152
Abstract class CLatentModel It represents the application specific model and contains most of the app...
Definition: LatentModel.h:33
Latent Features class The class if for representing features for latent learning, e...
int32_t index_t
Definition: common.h:62
void set_caching(bool caching)
Definition: LatentModel.h:133
CLatentLabels * get_labels() const
Definition: LatentModel.cpp:55
bool get_caching() const
Definition: LatentModel.h:124
CLatentFeatures * get_features() const
Definition: LatentModel.cpp:96
Features that support dot products among other operations.
Definition: DotFeatures.h:44
void set_labels(CLatentLabels *labs)
Definition: LatentModel.cpp:48
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:112
CLatentLabels * m_labels
Definition: LatentModel.h:148
dummy data holder
Definition: Data.h:25
virtual CData * infer_latent_variable(const SGVector< float64_t > &w, index_t idx)=0
virtual const char * get_name() const
Definition: LatentModel.h:142
CLatentFeatures * m_features
Definition: LatentModel.h:146
virtual void argmax_h(const SGVector< float64_t > &w)
Definition: LatentModel.cpp:68
CDotFeatures * get_cached_psi_features() const
virtual CDotFeatures * get_psi_feature_vectors()=0
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual int32_t get_dim() const =0
virtual int32_t get_num_vectors() const
Definition: LatentModel.cpp:43
void set_features(CLatentFeatures *feats)
Definition: LatentModel.cpp:61
abstract class for latent labels As latent labels always depends on the given application, this class only defines the API that the user has to implement for latent labels.
Definition: LatentLabels.h:26

SHOGUN Machine Learning Toolbox - Documentation