SHOGUN  v3.0.0
 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 
18 
19 namespace shogun
20 {
31  class CLatentModel: public CSGObject
32  {
33  public:
35  CLatentModel();
36 
43  CLatentModel(CLatentFeatures* feats, CLatentLabels* labels, bool do_caching = true);
44 
46  virtual ~CLatentModel();
47 
52  virtual int32_t get_num_vectors() const;
53 
58  virtual int32_t get_dim() const=0;
59 
64  void set_labels(CLatentLabels* labs);
65 
70  CLatentLabels* get_labels() const;
71 
76  void set_features(CLatentFeatures* feats);
77 
83 
89 
98  virtual CData* infer_latent_variable(const SGVector<float64_t>& w, index_t idx)=0;
99 
105  virtual void argmax_h(const SGVector<float64_t>& w);
106 
110  void cache_psi_features();
111 
117 
122  inline bool get_caching() const
123  {
124  return m_do_caching;
125  }
126 
131  inline void set_caching(bool caching)
132  {
133  m_do_caching = caching;
134  }
135 
140  virtual const char* get_name() const { return "LatentModel"; }
141 
142  protected:
151 
152  private:
154  void register_parameters();
155  };
156 }
157 
158 #endif /* __LATENTMODEL_H__ */
159 

SHOGUN Machine Learning Toolbox - Documentation