SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 

SHOGUN Machine Learning Toolbox - Documentation